4.3 KiB
Implement organisation forge connections and repository access
Read 00-start-here.md and GUIDELINES.md. Work against archie-core-oygqd.
Its prerequisite is archie-core-kgxw.13; verify acceptance before claiming
this slice. Do not treat a closed issue without evidence as proof.
Outcome and resource relationships
An organisation owns a named external connection. It identifies the forge host, authentication reference and verified external account. A repository references that connection. An execution identity is authorised for specified operations such as clone, push and opening a PR. Commit author name/email remain independent of the authenticating external account. Choose the smallest representation that fits the existing control-plane resource and policy contracts; do not build a new integration service or expose root config fields as the domain model.
Investigate first
Trace existing control-plane resource registration and organisation validation, repository policies, SecretRef handling, forge extensions and resolveForge in archied, worktree.Manager authentication, task-scoped forge/worktree RPC authority, apply-status reporting and settings API authorisation. Check every Git and forge consumer, including intake polling, review handling, retries and post-run actions. A secret-reference check currently performed by another service is not evidence that archied can resolve and use that reference.
Required behaviour
- Organisation administrators manage connections and repository bindings through API/dashboard with server-side authorisation. Other organisations cannot read, modify, select, verify or execute against them by guessing an ID.
- Reuse secret references and installed forge capabilities. Do not hardcode a closed GitHub/Gitea list if enabled extensions already supply discovery. Never return token values to the browser. Any credential-entry path must have a real secure storage consumer, not store plaintext in generic config/audit.
- Authorise operations for the actual execution identity and selected resource. A valid token does not itself grant an agent permission. Do not grant blanket write/issue/PR permissions when only clone/read is requested.
- Resolve the selected connection in archied for the actual repository operation. Apply updates live. Saved revision, applied revision and verified access are distinct; failed changes must not falsely report that the new revision runs.
- Test access through the daemon's real forge/Git path for the selected repository and base branch, under the relevant execution identity's permissions. Report which operation was checked. Read success cannot prove push or PR permission. Verification must not create commits, branches or PRs as an incidental probe.
- Credential rotation reaches subsequent operations without process restart. Revoked permissions are enforced on subsequent operations/attempts. Avoid stale cached credentials silently surviving changes.
- Produce structured failures with a cause, affected resource/operation and an authorised recovery action. Distinguish missing configuration, unavailable secret/extension, denied authority and remote authentication/access failure. A remote 401 or 'Repository not found' does not prove which underlying cause occurred. Do not implement frontend substring/regex diagnosis.
- Populate task repository choices from authorised configured repositories, not only prior tasks. A failed task can lead to its connection and return to retry.
- Migrate existing forge/repository configuration to its existing owner without widening grants; remove obsolete runtime paths after all consumers migrate. Do not force connection setup for repository-free workflows.
Acceptance evidence
Use an isolated authenticated private-repository equivalent. Demonstrate dashboard configuration, actual daemon clone, permitted push/PR execution where the test workflow calls for it, credential rotation and refused unauthorised operations. Show that another org and an ungranted agent cannot use the same connection. Inspect worker handoff/logs to confirm tokens do not leak. Run a repository-free workflow independently. Record exact limitations; no production configuration or external posting is authorised by this prompt.