chore(runtime): delete Kit and external agent harness support (#1877) #1887

Merged
sam merged 8 commits from chore/delete-kit-harness into main 2026-11-12 11:27:21 +00:00
Owner

Closes #1877.

Archie runs its own agent loop only. This deletes Kit and external agent harness support.

Removed

  • Kit resolution and launch (infrastructure/kit, kitrun, container/kit.go, daemon/kit_task.go, Pool.AcquireKit), the harness runner and adapters, and the capture MCP server (archie-agent mcp, archie-agent hold).
  • The setup terminal and the task Sandbox tab (harness.v1, harnessrpc, harnesssession, container/pty.go, container/logs.go, webui/harness.go, ui/src/harness, SandboxView.vue). The Sandbox tab only ever followed Kit containers, so default tasks lose nothing.
  • Harness secrets and OAuth capture: the State Store contract, SQL, and migration 0075 drops harness_secrets.
  • The gateway TaskToolsService and infrastructure/tasktools: only Kit containers reached them, through the egress proxy.
  • AgentProfile.Kit and .Adapter; profiles carry image and tools only. A credential binding must now name a secret.
  • github.com/docker/sandbox-kit-spec and the @xterm/* packages.

Kept

  • The egress proxy, trimmed to the model-session path: an allow list plus key substitution. Its setup moved to archied/model_egress_setup.go.
  • The sandbox network and relay code (egress/networks.go, tunnel.go, and the relay env helpers moved from kitrun to egress/sandbox_env.go) for #1867.
  • The daemon contract listener, which now serves only repository checks (archied/daemon_rpc.go).

Notes

  • proto/buf.yaml has a one-off exception for the deleted packages and services. Drop it once main carries this change.
  • This branch is stacked on the four unpushed fix/dba-review-2026-11 commits (#1857 to #1860), because migration 0075 follows their 0074. Merging this merges them too.
  • The workflow needs: block is left in place. It only fed the harness capability check, but removing it would make strict decoding reject any stored definition that sets it.

Checked

  • task check passes.
  • On the local e2e stack, a triage task dispatched, started its container and ran its first stage. It then parked on "no model alias default", because the dev stack has no model configured. A keyed provider call through the proxy was not exercised.
Closes #1877. Archie runs its own agent loop only. This deletes Kit and external agent harness support. **Removed** - Kit resolution and launch (`infrastructure/kit`, `kitrun`, `container/kit.go`, `daemon/kit_task.go`, `Pool.AcquireKit`), the harness runner and adapters, and the capture MCP server (`archie-agent mcp`, `archie-agent hold`). - The setup terminal and the task Sandbox tab (`harness.v1`, `harnessrpc`, `harnesssession`, `container/pty.go`, `container/logs.go`, `webui/harness.go`, `ui/src/harness`, `SandboxView.vue`). The Sandbox tab only ever followed Kit containers, so default tasks lose nothing. - Harness secrets and OAuth capture: the State Store contract, SQL, and migration 0075 drops `harness_secrets`. - The gateway `TaskToolsService` and `infrastructure/tasktools`: only Kit containers reached them, through the egress proxy. - `AgentProfile.Kit` and `.Adapter`; profiles carry image and tools only. A credential binding must now name a secret. - `github.com/docker/sandbox-kit-spec` and the `@xterm/*` packages. **Kept** - The egress proxy, trimmed to the model-session path: an allow list plus key substitution. Its setup moved to `archied/model_egress_setup.go`. - The sandbox network and relay code (`egress/networks.go`, `tunnel.go`, and the relay env helpers moved from `kitrun` to `egress/sandbox_env.go`) for #1867. - The daemon contract listener, which now serves only repository checks (`archied/daemon_rpc.go`). **Notes** - `proto/buf.yaml` has a one-off exception for the deleted packages and services. Drop it once main carries this change. - This branch is stacked on the four unpushed `fix/dba-review-2026-11` commits (#1857 to #1860), because migration 0075 follows their 0074. Merging this merges them too. - The workflow `needs:` block is left in place. It only fed the harness capability check, but removing it would make strict decoding reject any stored definition that sets it. **Checked** - `task check` passes. - On the local e2e stack, a triage task dispatched, started its container and ran its first stage. It then parked on "no model alias default", because the dev stack has no model configured. A keyed provider call through the proxy was not exercised.
sam self-assigned this 2026-11-12 10:34:58 +00:00
sam added 5 commits 2026-11-12 10:34:58 +00:00
Postgres does not index the referencing side of a foreign key, so deleting or updating a parent row scanned the child table once per referencing row for the six keys that had no matching index: identity aliases and subjects, org memberships and agents, installed package requirements, and the task a handoff came from. Migration 0074 adds one supporting index per key; the foreign-key integrity checks on the restored snapshot pass, with every one of the 17 constraints now covered.
Archiving deletes the task row but deliberately keeps its child rows:
execution history, usage and the dispatch ledger are records about the work,
not attachments to the row. Nothing recorded that rule, so the kept rows had no
parent row to explain them and no query could say what happened to an archived
task.

Record the rule in the archive event's data. The kind is protected from audit
retention and already projects into the audit feed, so that event is the
archived-task record: it names the kept child sets and leaves event rows to the
instance's per-kind retention.
The control-plane Watch was a 250 ms database poll per subscription: an idle instance ran about 180 transactions a second (archied 14 streams, gateway 5, dashboard 26), almost all sequential scans of the small resources table. The State Store now keeps one shared view of every stored resource version, read once per 250 ms window and reused by every Watch stream; a stream reads its own resource only when its kind's version advanced, so idle database work is one read per interval for the whole process whatever the subscriber count.

The watch contract is unchanged: resume from AfterVersion, no missed update (versions are monotonic per org and kind), the immediate seed probe, the same 250 ms latency bound (streams wake on the same window boundary), and a store error still ends the stream with Unavailable so the clients' existing reconnect backoff applies.
Every service connected to PostgreSQL as the database owner, which is a
superuser, so anything that compromised an app process owned the cluster, and
every connection reached the server with an empty application_name, so
pg_stat_activity could not say which service a session belonged to.

Split the DB credential into two login roles and name every pool:

- archie_migrator owns public and its objects and runs goose. Migrations run
  on a short-lived pool opened from the new migration_database_url, before the
  serving pool opens. It is not a superuser.
- archie_runtime serves requests with SELECT, INSERT, UPDATE, DELETE, sequence
  USAGE/SELECT and function EXECUTE only. It has no CREATE privilege, so it
  cannot change the schema.
- Every pool sets application_name: archie-state-store, archie-gateway, and a
  -migrate / -recovery / -schema / -provision suffix on the transient
  administrative connections. Existing one-URL installs keep working: an
  absent migration_database_url falls back to database_url and the migration
  runs on the serving pool exactly as before.

Provisioning is a new idempotent `archie-state-store provision` subcommand: it
needs an admin URL the services never hold (database owner or superuser),
creates or reconciles both roles, hands every public-schema object to the
migration role, revokes PUBLIC's CREATE on public, sets row-level grants, and
sets the migration role's default privileges so tables future migrations
create are usable without a hand-run grant. It stores SCRAM verifiers, refuses
superuser roles, and verifies the boundary before committing.

install.sh now provisions the bundled path and separates the credentials: the
superuser password the Compose database is created with lives only in a
compose-only postgres.env, while the env file the units load holds the
non-superuser PGPASSWORD. A bundled install that predates the split is
upgraded in place: the roles are created, the superuser password is rotated
out of the env file, and config.toml is moved to the runtime and migration
URLs. External databases keep their operator-managed credential; the
deployments README documents the one-shot provision command.

setup writes both bundled URLs, dev:postgres provisions the dev database, the
e2e stack provisions its throwaway server, and the deployment templates point
at the two roles.
chore(runtime): delete Kit and external agent harness support (#1877)
ci/woodpecker/pr/quality Pipeline was successful
Quality / check (pull_request) Canceled after 7m39s
f92c5b4536
Archie runs its own agent loop only. Removes Kit resolution and launch,
the harness runner and adapters, the setup terminal and sandbox view,
harness secrets and OAuth capture (table dropped in migration 0075), the
task-tools contract that only Kit containers reached, and the
sandbox-kit-spec dependency. Agent profiles carry image and tools only.
The egress proxy keeps the model-session path; the sandbox relay code
stays for #1867.
sam added 1 commit 2026-11-12 10:42:17 +00:00
chore(runtime): remove code left dead by the Kit removal (#1877)
Quality / check (pull_request) Canceled after 0s
ci/woodpecker/pr/quality Pipeline was canceled
658a4cb50e
Drops Client.TaskPrincipalForCredential and the principal_id field only
it read, Reporter.ReportToolCall, Pool.EnsureImage and Pool.Instance,
and the binding cipher's exported domain API. Clears the remaining
harness references from the audit target kinds, docs and comments.
sam added 1 commit 2026-11-12 10:42:28 +00:00
style(staterpc): drop a blank line left by the removal
ci/woodpecker/pr/quality Pipeline was successful
Quality / check (pull_request) Successful in 8m16s
b97eb45275
sam added 1 commit 2026-11-12 11:27:08 +00:00
Merge branch 'main' into chore/delete-kit-harness
ci/woodpecker/pr/quality Pipeline was successful
Quality / check (pull_request) Successful in 4m5s
9ac8a60999
sam merged commit a7a411bd4b into main 2026-11-12 11:27:21 +00:00
sam deleted branch chore/delete-kit-harness 2026-11-12 11:27:21 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1887