Expose forge credentials in repository settings #385

Closed
opened 2026-10-27 13:36:07 +00:00 by sam · 0 comments
Owner

Private repository clones have no dashboard configuration path. Implement organisation-owned forge connections with secret references, repository bindings and explicit execution-identity operation permissions. Apply changes live, verify through the daemon actual access path, report structured failures, and keep daemon credentials outside containers. Supersedes exposing root forge configuration as the product model.

Acceptance criteria

An organisation admin can configure a forge connection with a secret reference and verified external account, bind repositories, and permit an execution identity specified operations. Commit author is separate from authentication. Save applies without server login/restart; show saved, applied, verified and failed truthfully. Test access exercises the daemon actual repository access path. Credential rotation reaches subsequent operations. Failures are structured by the responsible service, not classified from UI error strings. Verify an authenticated private-repository equivalent, cross-org isolation and that secrets never enter containers/logs. Production changes require separate explicit authorization.

Notes

Include repository selection from configured repository policies in new-task creation, not just historical task repositories. Recheck existing repository form issue archie-core-4vzda within this flow; do not duplicate or close it without current evidence.
Implementation 2026-10-17 (third agent, taken over after the previous session expired with no work).

Landed:

  • 5f998122 feat(controlplane): organisation forge connections. New org-owned resource kind forge-connections whose document is []config.ForgeConnection: id, name, type, host, account, a SecretRef credential and, per execution identity ID, the operations that identity may perform (clone, push, pr). Validation refuses a half credential reference, an unknown or duplicated operation, an identity permitted nothing, a duplicate or slash-bearing ID and any unknown document field, so a token value cannot be stored in place of a reference. Seeded from the file: [forge] becomes the root connection default, and each identity that declared its own forge becomes a connection permitted to that identity alone. config.Repo gained a Connection reference.
  • c56caa45 feat(controlplane): the instance forge is its root connection. RuntimeConfig layers the kind and takes the root connection as cfg.Forge, keeping the file's webhook intake and secret. A document with no root connection disables the forge rather than falling back to a file credential the operator may have withdrawn. Every organisation now holds its own empty forge-connections document instead of not-found.

Verified: table-driven validation and migration tests in forge_connections_test.go; layering tests in forge_connection_layering_test.go; go build ./... and go test -short on controlplane, config and archied.

Remaining, in order:

  1. archied runtime slice (written, not yet committed): reopenForge re-resolves the connection after the live watch republishes, replacing the daemon root forge, the worktree token, the boot forge client and the root task RPC servers, so a rotated credential reaches the next operation without a restart. Blocked on the execution-identity agent's concurrent edits to the same files (internal/app/archied/bootstrap.go, main.go, internal/daemon/*).
  2. Daemon per-organisation resolution: repoFor, forgeFor and treesFor still read the instance config, so an organisation other than the system org has no repository binding, no connection and no permitted operations applied. Needs a repository/connection reader injected into the daemon and the identity's operations enforced at the point of the real git and forge operations. This is what the acceptance criteria call the daemon actual access path.
  3. Access verification: a check that resolves the credential the way archied does, reports the external account it actually reached, and probes the repository and base branch without creating a commit, branch or PR. Report which operation was checked and return a structured cause, not a classified string.
  4. Dashboard surface for connections and repository bindings; repository choices in new-task creation from configured repositories; migration of the per-identity [identities.*.forge] sections off the file once the daemon resolves connections.
  5. repository-policies stays instance-only until (2) lands: while only the system org document is read, another org's write would be stored and never applied.
    Identity prerequisite completed in 5d6d24c1. GET org agents over gRPC returns assignment records; HTTP GET org agents returns full identity records including display_name and lifecycle for the selector. Runtime execution and task broker use canonical identity IDs. New database identities intentionally have no implicit forge client/repository access; complete authorised per-task connection resolution and operation routing rather than reintroducing root fallback. Starter-attribution ingress bug is tracked separately in 3z4fd.10.
    Progress 2026-10-17 (same session, after the runtime and dashboard slices landed).

Landed since the last note: 0315057d (the connections kind joins the live resource watches; a changed or rotated connection re-resolves without a restart and replaces the boot forge, the worktree token, the daemon root forge and the root task RPC servers) and ef0bb0f3 (a Connections page under Settings: host, forge type, credential reference, external account and per-identity operations, saved through the normal draft/save/review path). task check passed on that tree; ui/dist was rebuilt and verified against a fresh build.

Live evidence gathered on an isolated state store, dashboard and daemon built from the tree, against a throwaway database:

  • The file [forge] section seeded forge-connections for the system org as one connection: id default, name Instance forge, type github, host https://github.com, credential reference env/ARCHIE_GITHUB_TOKEN, no permitted identity.
  • The dashboard saved a permit through the resource API: version 2 then 3, ending as {"": ["clone","push"]}, and the page rendered it back.
  • Validation refused an unknown operation, half a credential reference and a plaintext token field through the real API, each with a message naming the connection and the cause.
  • The daemon logged its forge resolution from the connection at boot (forge_type github, instance default), then after the dashboard replaced the connection reported runtime settings applied kind=forge-connections version 3 and immediately re-resolved with the new document (forge_type gitea, credential env/ARCHIE_ROTATED, reported unavailable by name). No restart, no reuse of the boot credential.

Still open, in order:

  1. Daemon per-organisation resolution. repoFor, forgeFor and treesFor still read the instance configuration, so a task in an organisation other than the system org resolves no repository binding and no connection, and the permitted operations are not enforced where the git and forge operations actually run. This is the acceptance criterion the current work does not meet: no real clone or push has been attempted through a connection.
  2. Access verification: a check that resolves the credential as archied does, reports the external account it reached, and probes repository and base branch without creating a commit, branch or PR, returning a structured cause.
  3. Repository choices in new-task creation from licensed configured repositories rather than prior tasks only.
  4. Migration of the per-identity [identities.*.forge] sections off the file once (1) resolves connections for tasks.
  5. repository-policies is still instance-only, and config.Repo.Connection is stored but unread, until (1) lands.

Implemented in e624a373: organisation repository bindings are consumed during clone and each credential-backed push/forge RPC. Connection permissions, active assigned execution identity and organisation scope are checked at the operation boundary. Credentials are resolved per operation; Git authentication uses the connection account separately from commit attribution, and pushes pin the authorised remote URL. Organisation Repositories now provides connection selection and read-only account/repository/base-branch verification through the daemon contract; new-task choices come from configured repositories. Full task check passed. Authenticated Git fixture tests cover clone, push, missing base branch, revoked permissions, rotation, organisation isolation, redirect refusal and credential absence from Git config. Live dashboard/API/daemon verification and immediate permission revocation passed. A real local task prepared the private clone but then parked on unrelated model credential requirements, tracked in 0tb7z. Startup issue discovery and legacy file credentials remain tracked in bfd9o; do not count discovery as migrated.

Close reason

Implemented in e624a373. Gated organisation connection routing, per-operation permissions, credential rotation and read-only daemon verification. Verified authenticated private Git clone/push fixtures, actual local task clone, live dashboard account/repository/branch checks and immediate permission revocation. Separate remaining discovery migration is bfd9o; unrelated model gating is 0tb7z.


Imported from beads archie-core-oygqd · GitHub #1693 · type bug · priority P1 · created 2026-10-16 · closed 2026-10-16

Private repository clones have no dashboard configuration path. Implement organisation-owned forge connections with secret references, repository bindings and explicit execution-identity operation permissions. Apply changes live, verify through the daemon actual access path, report structured failures, and keep daemon credentials outside containers. Supersedes exposing root forge configuration as the product model. ### Acceptance criteria An organisation admin can configure a forge connection with a secret reference and verified external account, bind repositories, and permit an execution identity specified operations. Commit author is separate from authentication. Save applies without server login/restart; show saved, applied, verified and failed truthfully. Test access exercises the daemon actual repository access path. Credential rotation reaches subsequent operations. Failures are structured by the responsible service, not classified from UI error strings. Verify an authenticated private-repository equivalent, cross-org isolation and that secrets never enter containers/logs. Production changes require separate explicit authorization. ### Notes Include repository selection from configured repository policies in new-task creation, not just historical task repositories. Recheck existing repository form issue archie-core-4vzda within this flow; do not duplicate or close it without current evidence. Implementation 2026-10-17 (third agent, taken over after the previous session expired with no work). Landed: - 5f998122 feat(controlplane): organisation forge connections. New org-owned resource kind forge-connections whose document is []config.ForgeConnection: id, name, type, host, account, a SecretRef credential and, per execution identity ID, the operations that identity may perform (clone, push, pr). Validation refuses a half credential reference, an unknown or duplicated operation, an identity permitted nothing, a duplicate or slash-bearing ID and any unknown document field, so a token value cannot be stored in place of a reference. Seeded from the file: [forge] becomes the root connection default, and each identity that declared its own forge becomes a connection permitted to that identity alone. config.Repo gained a Connection reference. - c56caa45 feat(controlplane): the instance forge is its root connection. RuntimeConfig layers the kind and takes the root connection as cfg.Forge, keeping the file's webhook intake and secret. A document with no root connection disables the forge rather than falling back to a file credential the operator may have withdrawn. Every organisation now holds its own empty forge-connections document instead of not-found. Verified: table-driven validation and migration tests in forge_connections_test.go; layering tests in forge_connection_layering_test.go; go build ./... and go test -short on controlplane, config and archied. Remaining, in order: 1. archied runtime slice (written, not yet committed): reopenForge re-resolves the connection after the live watch republishes, replacing the daemon root forge, the worktree token, the boot forge client and the root task RPC servers, so a rotated credential reaches the next operation without a restart. Blocked on the execution-identity agent's concurrent edits to the same files (internal/app/archied/bootstrap.go, main.go, internal/daemon/*). 2. Daemon per-organisation resolution: repoFor, forgeFor and treesFor still read the instance config, so an organisation other than the system org has no repository binding, no connection and no permitted operations applied. Needs a repository/connection reader injected into the daemon and the identity's operations enforced at the point of the real git and forge operations. This is what the acceptance criteria call the daemon actual access path. 3. Access verification: a check that resolves the credential the way archied does, reports the external account it actually reached, and probes the repository and base branch without creating a commit, branch or PR. Report which operation was checked and return a structured cause, not a classified string. 4. Dashboard surface for connections and repository bindings; repository choices in new-task creation from configured repositories; migration of the per-identity [identities.*.forge] sections off the file once the daemon resolves connections. 5. repository-policies stays instance-only until (2) lands: while only the system org document is read, another org's write would be stored and never applied. Identity prerequisite completed in 5d6d24c1. GET org agents over gRPC returns assignment records; HTTP GET org agents returns full identity records including display_name and lifecycle for the selector. Runtime execution and task broker use canonical identity IDs. New database identities intentionally have no implicit forge client/repository access; complete authorised per-task connection resolution and operation routing rather than reintroducing root fallback. Starter-attribution ingress bug is tracked separately in 3z4fd.10. Progress 2026-10-17 (same session, after the runtime and dashboard slices landed). Landed since the last note: 0315057d (the connections kind joins the live resource watches; a changed or rotated connection re-resolves without a restart and replaces the boot forge, the worktree token, the daemon root forge and the root task RPC servers) and ef0bb0f3 (a Connections page under Settings: host, forge type, credential reference, external account and per-identity operations, saved through the normal draft/save/review path). task check passed on that tree; ui/dist was rebuilt and verified against a fresh build. Live evidence gathered on an isolated state store, dashboard and daemon built from the tree, against a throwaway database: - The file [forge] section seeded forge-connections for the system org as one connection: id default, name Instance forge, type github, host https://github.com, credential reference env/ARCHIE_GITHUB_TOKEN, no permitted identity. - The dashboard saved a permit through the resource API: version 2 then 3, ending as {"<identity id>": ["clone","push"]}, and the page rendered it back. - Validation refused an unknown operation, half a credential reference and a plaintext token field through the real API, each with a message naming the connection and the cause. - The daemon logged its forge resolution from the connection at boot (forge_type github, instance default), then after the dashboard replaced the connection reported runtime settings applied kind=forge-connections version 3 and immediately re-resolved with the new document (forge_type gitea, credential env/ARCHIE_ROTATED, reported unavailable by name). No restart, no reuse of the boot credential. Still open, in order: 1. Daemon per-organisation resolution. repoFor, forgeFor and treesFor still read the instance configuration, so a task in an organisation other than the system org resolves no repository binding and no connection, and the permitted operations are not enforced where the git and forge operations actually run. This is the acceptance criterion the current work does not meet: no real clone or push has been attempted through a connection. 2. Access verification: a check that resolves the credential as archied does, reports the external account it reached, and probes repository and base branch without creating a commit, branch or PR, returning a structured cause. 3. Repository choices in new-task creation from licensed configured repositories rather than prior tasks only. 4. Migration of the per-identity [identities.*.forge] sections off the file once (1) resolves connections for tasks. 5. repository-policies is still instance-only, and config.Repo.Connection is stored but unread, until (1) lands. Implemented in e624a373: organisation repository bindings are consumed during clone and each credential-backed push/forge RPC. Connection permissions, active assigned execution identity and organisation scope are checked at the operation boundary. Credentials are resolved per operation; Git authentication uses the connection account separately from commit attribution, and pushes pin the authorised remote URL. Organisation Repositories now provides connection selection and read-only account/repository/base-branch verification through the daemon contract; new-task choices come from configured repositories. Full task check passed. Authenticated Git fixture tests cover clone, push, missing base branch, revoked permissions, rotation, organisation isolation, redirect refusal and credential absence from Git config. Live dashboard/API/daemon verification and immediate permission revocation passed. A real local task prepared the private clone but then parked on unrelated model credential requirements, tracked in 0tb7z. Startup issue discovery and legacy file credentials remain tracked in bfd9o; do not count discovery as migrated. ### Close reason Implemented in e624a373. Gated organisation connection routing, per-operation permissions, credential rotation and read-only daemon verification. Verified authenticated private Git clone/push fixtures, actual local task clone, live dashboard account/repository/branch checks and immediate permission revocation. Separate remaining discovery migration is bfd9o; unrelated model gating is 0tb7z. --- _Imported from beads `archie-core-oygqd` · GitHub #1693 · type bug · priority P1 · created 2026-10-16 · closed 2026-10-16_
sam added the highbug labels 2026-10-27 13:36:07 +00:00
sam self-assigned this 2026-10-27 13:36:07 +00:00
sam closed this issue 2026-10-27 13:36:07 +00:00
sam added a new dependency 2026-10-27 13:41:40 +00:00
sam added a new dependency 2026-10-27 13:41:59 +00:00
sam added a new dependency 2026-11-14 14:45:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#385