ADR 0015 — Control plane and workers on adam-rs, with in-process agents ​
- Status: accepted (2026-09-29). Amends ADR 0001 (the job ledger includes a local agent's journal) and ADR 0007 (a worker may host adam agents in-process, behind a Cargo feature). Both carry a dated note that points here. Amended (2026-11-19) by ADR 0076: when the orchestrator is embedded as a library in an application, a local agent runs adam in process through
adam-engineon adam's SQLite store, notadam-store-postgres, and its run state is adam's file, notorch_agent_*tables; in a server build decision 6 stands.
Context ​
The owner decided the following on 2026-09-29.
- adam-rs is a library, and any host app embeds it. In the owner's words: "eve.dev is just a library, NestJS is the app." adam-rs must fit any backend structure. It also ships a convenience binary,
adam-coder. adam-rs isvymalo/another-adam-rs. This repository is one of its hosts. - The control plane and the runtime workers are decoupled. One control plane and N workers, or more, deployed apart.
- The roles are an enum in adam-rs. This repository reuses it and only says which role a process runs.
- In-process ("local") adam agents in an orchestrator worker are wanted, including agents that run tools and sandboxes. The owner chose this over the more conservative option (sandbox-free agents only).
- Agents with a filesystem need a workspace. Where it lives is the deployer's choice: "A worker can do the work, it can own a folder, it can have an isolated pvc, it can use only a2a."
What the code does today:
orchestrator/bin/orchestrator/src/boot.rsstarts the HTTP server and the dispatcher in one process and stops them by hand: it marks the process as shutting down, stops the server, then the dispatcher, each bounded by a grace time. The first half to end takes the process down.- The two halves already talk only through Postgres: the outbox, the thread version compare-and-swap (CAS), and
LISTEN/NOTIFY(ADR 0001). Nothing else couples them. AgentClientinorch-portsis the only way the orchestrator talks to an agent. Its one implementation,orch-agent-a2a, speaks A2A.- The word "control plane" already names the Next.js chat app in this repository's docs.
- ADR 0014 makes
adam-coderthe default agent over plain A2A, with no crate dependency on adam-rs. - Lesson 1: one pod ran the UI, the API and every agent's builds. A single
cargo buildstarved the API and the pod headed for a restart.
The adam-rs side of this decision is its own ADR 0001, "Library first: host roles in adam-host". It is in that repository at docs/decisions/0001-library-first-host-roles.md.
Decision ​
adam-rs is a library that hosts embed. This repository is a host. It uses adam-rs by git dependency and does not fork or vendor it.
Two roles, decoupled. A process is a control plane, a worker, or both. A deployment runs one control plane and N workers, or more of each. Nothing forces them onto one machine.
The role is one closed enum,
Role, owned by adam-rs. It lives in the newadam-hostcrate:All(default),ControlPlane,Worker.adam-hostalso gives a role-aware supervisor,Host. This repository reuses both and adds no role of its own. It only provides which role a process runs:ORCH_ROLEor--role, defaultall.Git dependency, pinned to a full commit sha.
Cargo.tomlnames the adam-rs repository and a 40-characterrev. A PR bumps it. Never a branch, never a tag. adam-rs is public, so CI and Docker need no token.What each orchestrator role runs.
Role Runs control-planemigrations, the axum server (health, resource API, the surfaces in ORCH_SURFACES), the transitions for user inputs, event streams, thread cardsworkermigrations, the dispatcher (with the transition for agent updates), in-process adam agents, a health-only router all(default)both: today's behaviour The seam is Postgres. Outbox, thread version CAS and
LISTEN/NOTIFYare already the only coupling. There is no new protocol between the roles.transitionstays a pure function that both roles call; the CAS decides who wins.In-process ("local") adam agents are allowed in orchestrator workers, including agents that run tools and sandboxes.
- They sit behind the existing
AgentClientport. The implementation is a separate crate,orch-agent-adam, behind the Cargo featureagent-local, off by default. It is the only crate that depends on adam agent and runtime crates. - Remote agents stay plain A2A. That includes the
adam-coderdefault agent (ADR 0014). - State. A local agent's run state lives in the orchestrator's Postgres, in tables prefixed
orch_agent_*. The job ledger now includes an agent's journal. This was the plan's recommended answer; the owner did not separately confirm it. Revisit it before the first local agent ships. - This deliberately amends ADR 0007. See What this amends.
- They sit behind the existing
Naming. "Control plane" now means the orchestrator role. The Next.js app is the web chat surface. The docs are renamed in this change.
Workspace placement is the deployer's choice (decided in principle). An agent with a filesystem, such as the coder, needs a workspace for a run. adam-rs will offer a closed, deployer-selected placement policy. The candidate names are:
Shared: an RWX volume. Any worker may resume any run.Affinity: a run is leased only by the worker that owns its folder.Isolated: one PVC per worker. It implies affinity.- A2A-only deployments need none of these: the worker only calls remote agents.
The exact enum and mechanism are follow-up design work in adam-rs, not decided here. The runtime has no run-to-worker affinity today. A run can be leased by any worker, so with per-worker volumes a run may land on a worker that does not have its worktree. Until affinity exists, a coder deployment runs one worker, or a shared volume.
What this amends ​
ADR 0007 (protocols only). The rule was: no dependency on an agent host, gateway product or host SDK. Two things change.
adam-hostis a hard dependency of the orchestrator binary. It is process plumbing (a role enum and a supervisor). It has no agent code. It still is a git dependency on a sibling repository.- adam agents may run inside a worker, behind
agent-local. That is a real exception: the orchestrator can host an agent in its own process. What stays true: a remote agent is an A2A agent-card URL, the port has no adam types, and with the feature off nothing from adam agents is linked.
Lesson 1 (control plane and workers are separate). The decision keeps the two apart, but it also lets a worker run agent builds and tool calls. A local agent that runs cargo build can starve the process it lives in. That is the failure Lesson 1 described, moved from the pod that serves the UI to a worker pod. In the default role (all) it would still be the same pod as the API, so all is for development. The mitigations:
- The feature is off by default.
- Worker pods are separate from control-plane pods, so a build starves only a worker.
- Resource limits on worker pods.
- Sandboxing is the agent's responsibility, not the orchestrator's.
ADR 0001 (stateless processes, one event log). Processes stay stateless. The rule "only the job ledger and event log persist" now counts a local agent's journal as part of the job ledger. It is stored in the same Postgres, in orch_agent_* tables. No second store.
ADR 0009 stands: Role and Host are not ports, because no one swaps them. orch-agent-adam implements a port and puts no adam type in its signature.
Diagrams ​
The topology. The web chat surface never talks to a worker. Workers never serve users.
flowchart LR
you((You)) -- chat --> web["Web chat surface<br/>Next.js + assistant-ui"]
web -- "AG-UI over HTTP + SSE" --> cp
ext["Other systems · webhooks · MCP clients"] --> cp
subgraph orch["Orchestrator (orch-* crates, one binary, --role)"]
cp["Control plane × 1..n<br/>role control-plane<br/>API · surfaces · user-input transitions · event streams"]
wk["Worker × 1..n<br/>role worker<br/>dispatcher · agent-update transitions"]
local["Local adam agents<br/>feature agent-local, off by default<br/>behind the AgentClient port"]
wk --> local
end
cp <-- "outbox · thread version CAS ·<br/>LISTEN/NOTIFY · event log" --> db[(Postgres<br/>job ledger · event log · orch_agent_* journal)]
wk <-- "claim · commit" --> db
wk -- "A2A (AgentClient)" --> remote["Remote agents<br/>adam-coder (default) · platform · kagent · any A2A"]
local -. "workspace, deployer's choice" .-> ws[("Shared RWX volume ·<br/>per-worker PVC · none")]
wk -- "MCP · OpenAI-compatible" --> tools["Tools · model endpoint"]One chat turn across the seam. The two roles never call each other.
sequenceDiagram
actor U as You
participant W as Web chat surface
participant C as Control plane
participant DB as Postgres
participant K as Worker
participant A as Agent (remote A2A, or local behind the port)
U->>W: message
W->>C: AG-UI run request
C->>DB: one transaction: append user event, thread version CAS, outbox row
DB-->>K: NOTIFY (or the next poll)
K->>DB: claim outbox row (SKIP LOCKED, lease)
K->>A: AgentClient::send
loop while the agent works
A-->>K: status, message parts
K->>DB: transition (pure), CAS, append events
DB-->>C: NOTIFY (or the next poll)
C-->>W: AG-UI events over SSE
end
A-->>K: completed
K->>DB: transition to Done, CAS, append events
DB-->>C: NOTIFY
C-->>W: final events, run finishedThe lifecycle of one process under the adam-host supervisor.
stateDiagram-v2
[*] --> Running: components for the role started
Running --> Stopping: shutdown signal
Running --> Stopping: a component ended on its own
Stopping --> DrainingControlPlane: mark shutting down, cancel control-plane components
DrainingControlPlane --> DrainingWorkers: drained, or the drain time is up
DrainingWorkers --> Stopped: workers done, or the grace time is up (abort)
Stopped --> [*]: exit 0 after a signal
Stopped --> Failed: first failure reported by component name
Failed --> [*]: exit non-zero, restarted by the platformA process that has no component for its role never starts: Host::run returns NothingToRun.
Consequences ​
Positive
- The API and the workers scale apart: N control-plane pods for users, M worker pods for agent work. A build starves a worker, not the API.
- The hand-written stop logic in
boot.rsgoes away. One supervisor gives one stop order to every adam-rs host. - The role vocabulary is shared with adam-coder. An operator learns
control-plane | worker | allonce. - One process (
all) still works for development and for small installs. No behaviour change by default. - A local agent gets the orchestrator's durability: its journal is in the same Postgres and the same transactions.
Negative
- A coupling to adam-rs. A bump of the pinned sha is a PR here, and adam-rs changes can break the build. The two repositories share one owner today; that is what makes this cheap.
- Lesson 1 is only mitigated. A tool-running local agent can hurt the worker that hosts it. Nothing in the orchestrator sandboxes it.
- The orchestrator is no longer a pure protocol layer when
agent-localis on. Its supply chain, build time and attack surface grow with that feature. - Split roles degrade until events cross processes. Live events, worker wake-up and cancel between processes rely on polling until Postgres
NOTIFYsupport lands in adam-rs. Unverified: theNOTIFYpayload limit of 8000 bytes, from memory. - Coder scale-out is limited (one worker, or a shared volume) until placement exists.
- More configuration to get right: a role per Deployment, secrets per role.
Alternatives considered ​
- A protocol seam between the roles (gRPC, HTTP). Rejected. Postgres is already the only coupling and it is transactional. A new protocol adds a second source of truth, a versioned contract, and retry logic for what a CAS already settles.
- adam-runtime as the orchestrator's engine. Rejected. It would replace the pure
transitionand the job ledger (ADR 0001, ADR 0004) with another engine's run model. adam agents are hosted behind a port instead, so the orchestrator stays the owner of job state. - Separate binaries (
orchestrator-control-plane,orchestrator-worker). Rejected. Two binaries repeat the composition, andallfor development would need a third. One enum and one binary keep it to one build and one image. - Sandbox-free local agents only. Rejected by the owner. It is safer, and it would have kept Lesson 1 closed. The owner wants agents that run tools and sandboxes hosted in the worker. This ADR records the mitigations instead.
- Never link adam-rs (A2A only, ADR 0014 unchanged). Rejected as the only path. It stays the default: remote agents,
adam-coderincluded, are plain A2A, and the feature is off. But the role enum and the supervisor would be copied into this repository, and the roles would drift.
Hard to reverse ​
Roleis public and closed. A new role breaks every host that matches on it. That is meant, and it costs a major version. A role cannot be removed without breaking deployments that set it.ORCH_ROLEand--rolevalues (all,control-plane,worker) become part of every deployment's manifests.orch_agent_*tables. Once a local agent stores a journal there, the schema needs migrations and a retention rule. Moving to a separate database later is a data migration.- Hosting agents in a worker. Once tool-running agents run in worker pods, deployments size their nodes and limits for them. Removing the feature is a breaking change for those users.
- The placement enum, once it ships in adam-rs, is closed like
Role.
Easy to reverse: the pinned sha, the agent-local feature (off by default), and the split into pods (all still works).
Migration: PR order ​
- adam-rs:
feat(adam-host):Roleand the supervisor; its ADR 0001. - This repository: this ADR, the amendments, the rename to "web chat surface".
refactor(orchestrator):boot.rsbecomes shared setup plus two halves. No new dependency, no behaviour change.- adam-rs:
refactor(adam-coder): serve onadam-hostwithROLE; a test with front and worker over one database completes a task. - adam-rs: pin the workspace, fix the
repositoryfield, move the tokiotest-utilfeature ofadam-model-openaito dev-dependencies (the orchestrator will link it). feat(orchestrator):--role/ORCH_ROLEthroughadam-hostby git rev; a health-only router for the worker; an end-to-end test with 1 control plane and 2 workers, where a killed worker hands over and cancel reaches the agent.- Observability and scaling: role and instance log fields, queue metrics for KEDA, trace context, a compose
splitprofile. - adam-rs: agent starters, so a control plane needs no model or GitHub secrets.
- adam-rs: Postgres event sink and listener, and worker wake-up over
NOTIFY. - adam-rs: deploy manifests: coder front Deployment and worker StatefulSet, one worker until affinity exists.
feat(orchestrator): anAgentClientconformance testkit, a closedAgentTransportenum, a fence on commit.feat(orch-agent-adam): local agents behindagent-local(off), theorch_agent_*tables.- Later: an
AuthConfig::Custominadam-a2a; an A2A surface that reusesadam-a2a.
The placement policy in adam-rs is separate design work and has no slot here yet.
Verified ​
- Verified 2026-09-29 (adam-rs branch
wt-adam-host, commit1e54a5d, crateadam-host):RolehasAll,ControlPlane,Worker, withas_str,runs_control_plane,runs_workersandfrom_optional.Host::new(role).control_plane(name, f).worker(name, f)withcontrol_plane_drain,worker_grace,healthandrun(shutdown).HostErrornames the component, andNothingToRunis returned when no component matches the role. Features:clap,serde,supervisor(default). - Verified 2026-09-29 (this repository,
orchestrator/bin/orchestrator/src/boot.rs): the HTTP server and the dispatcher start in one process; the stop order and both grace bounds are written by hand there. - Verified 2026-09-29 (this repository,
orchestrator/crates/ports/src/agent.rs):AgentClientis the one port to agents. - Unverified: that adam-rs can be cloned anonymously by CI and Docker. The owner said the repository is public; no anonymous clone was run for this ADR.
- Unverified: the dependency and toolchain compatibility of the two workspaces (same major versions of
sqlx,axum,tokioand the A2A crates; both Rust 1.94, edition 2024; bothMIT OR Apache-2.0). It comes from the planning notes of 2026-09-29, not from a build. PR 6 proves it. - Unverified: that
NOTIFYpayloads are limited to 8000 bytes.
Status note, 2026-09-29: migration step 6 built ​
orchestrator takes --role / ORCH_ROLE through adam-host and runs on adam_host::Host.
- Verified 2026-09-29 (this repository,
cargo fetch --lockedwith an emptyCARGO_HOME): cargo fetchesadam-hostby git rev fromgithub.com/vymalo/another-adam-rswith no credentials. The orchestrator toolchain (Rust 1.94.1) builds it. The lock file gains two packages,adam-hostandadam-error, andtokio-utilgains afutures-ioedge fromadam-host's workspace features; nothing else moves, so the "same major versions" unverified item above holds for what the orchestrator links. - Verified 2026-09-29 (
orchestrator/bin/orchestrator/tests/smoke.rs):--role workerserves only the probes; acontrol-planeprocess leaves a threadqueueduntil a worker process starts; with one control plane and two workers, SIGKILL of the worker holding the delegation lets the other finish it exactly once. - Unverified: the Docker build with the git dependency (
cargo chef prepareandcook): there is no Docker daemon in the environment where this was built. CI'simagejob is the proof. boot.rsnow usesHostfor the stop order, with the two grace times both set toSHUTDOWN_GRACE_SECS, so the hand-written supervisor is gone. A cancel sent to the control plane reaching the agent through the worker that took a task over after a graceful stop is covered bya_worker_stopped_with_a_running_task_hands_it_over_at_once; the SIGKILL test with two workers finishes the task instead of cancelling it.
Status note, 2026-09-29: migration step 7 built ​
Role and instance on every log line, queue metrics for autoscaling, and a compose split profile. Trace context is deferred.
- Every log line carries
roleandinstance(the lease owner): an event formatter adds them (a root span would not reach the dispatcher's spawned tasks), and each claimed outbox row runs inside anoutboxspan. The configuration is read before logging starts, so a line about an invalid configuration has neither. ThreadStore::outbox_stats(now)(a new port method with a conformance case, so the memory and Postgres stores agree) counts the open outbox rows as due, waiting and leased, with the age of the oldest due one. Every role serves it as Prometheus text onGET /metrics, without an identity. The counts are global, so an aggregation across replicas takesmax, neversum. Seedocs/orchestrator.md, "Observability and scaling".- The compose
splitprofile runs a control plane beside two workers, anddev/split-e2e.shkills the worker that holds a task and checks that the other finishes it; CI runs it at the end of the Coder E2E workflow. - Trace context is deferred: carrying a W3C
traceparentacross the outbox needs a column (a migration) and an OpenTelemetry exporter, which is a design of its own; theoutboxspan, the request id and the thread id tie the lines together meanwhile. Open question 27. - Verified 2026-09-29 (this repository,
cargo test --workspaceagainst Postgres 16, and the binary's smoke tests): theoutbox_statsconformance case passes on both stores;/metricsis served by the full router and the worker's health router without an identity; a control plane alone reports one due row until a worker starts, and every JSON log line of a worker carriesroleandinstance;docker compose configaccepts every combination of theappandsplitprofiles. - Unverified: the split profile running in containers (
dev/split-e2e.shin CI is its first run, with the workers having no healthcheck andwgetin the caddy image assumed), and everything about KEDA: that aprometheustrigger overmax(due) + max(leased)withDISPATCHER_CONCURRENCYas the threshold scales the workers, that a worker Deployment scales to zero on it while the control plane is scraped, and that thepostgresqlscaler with the count indocs/orchestrator.mddoes the same without Prometheus. These are from memory of the KEDA and Prometheus documentation; no cluster was involved.
Status note, 2026-09-29: migration step 11 built ​
An AgentClient conformance testkit, a closed AgentTransport enum, and a fence on commit. Three commits.
- Fence. Every claim of an outbox row hands out a fencing token:
Lease { id, owner, attempt }, whereattemptis the row'sattemptscounter. The four outbox writes andCommit.leasematch it, so a worker paused past its lease can no longer commit what its agent reported after another worker (or the same process, under the same owner name) claimed the row again: the store answersCommitOutcome::Fenced,App::applyreportsApplyOutcome::Fencedwithout retrying, and the worker logs that the late result was dropped. Expiry alone does not fence: a lapsed lease that nobody re-claimed still commits. No migration. The design, with its two diagrams, is indocs/orchestrator.md, "Fenced commits". The bug it closes was that the thread commit never looked at the lease,give_upcommittedDeliveryFailedbefore finishing the row, and the old test of a lost lease passed only because the heartbeat stopped the worker first. - Transport.
AgentEndpoint { id, transport }withAgentTransport::A2a { card_url, bearer }, inorch-ports. There is noLocalvariant yet: step 12 adds it with its implementation, and the compiler then lists thematchsites.AGENTS_FILEtakes an optionaltransport: a2a(ADR 0014 has the note).AgentInfo.cardUrlin the chat API stays required; step 12 makes it optional. - Testkit.
agent_client_conformance!with anAgentFixturetrait, twelve cases, run against the A2A adapter (over real HTTP) and againstScriptedAgent. The scripted agent gained afailedscript andset_unreachable. - Verified 2026-09-29 (this repository,
cargo test --workspaceagainst Postgres 16): the four fence cases (stale_attempt_is_fenced,commit_after_another_owner_reclaims_is_fenced,commit_after_complete_is_fenced,expired_unclaimed_lease_still_commits) pass on the memory and Postgres stores; two dispatcher tests, with a heartbeat that never fires, fail when the memory store's fence is removed and pass with it; a Postgres test that races commits against re-claims andmark_sentfor 25 rounds neither deadlocks nor half-writes; the twelve testkit cases pass on both agents, three runs in a row for the A2A adapter. - Verified 2026-09-29 (the code): no statement takes a thread lock while holding an outbox row lock; the outbox statements touch only outbox and binding rows, and change no foreign key, so
thread, outbox row, bindingis the only lock order. - Unverified: deadlock freedom under production load and on other Postgres versions: it rests on the lock-order argument above and the 25-round race test on one server, not on a proof. Also unverified: a process test that stops a worker with SIGSTOP past its lease and resumes it. It was not written, because
select!in the worker polls the heartbeat and the stream in a random order, so the "late result was dropped" log line would only appear about half of the time, and the outcome without the fence is the same as with it (the replayed keys are duplicates).skip_unsent_delegatesandrelease_leasesare not fenced.
Status note, 2026-09-29: migration step 12, first two changes built ​
Step 12 is split. These two come first, because they need no adam-rs dependency and the third builds on them.
- The A2A-to-envelope mapping in its own crate.
StreamMapper,snapshotand the release-channels URI moved fromorch-agent-a2ato the pure crateorch-a2a-mapping(no I/O, no async, no HTTP client). No behaviour change: the mapping's tests moved with it and pass unchanged. The point is that the in-process A2A host of the next change and the HTTP client share one set of idempotency keys. AgentTransport::Local { name },AgentEndpoint::local(id, name), inorch-ports, always compiled (the enum stays closed). The A2A adapter answers a local endpoint withAgentError::Unsupportedon every operation, through one helper.LocalAgentKind(closed,Echoonly) lives in the binary'sconfig.rs, so the configuration names kinds without an adam crate.AGENTS_FILEtakestransport: localwithagent: <kind>;cardUrlis optional in the file (required fora2a, refused forlocal);AgentInfo.card_urlisOptionandAgentInfo.cardUrlis optional indocs/api/chat-api.yaml(required: [id, name]).- The Cargo feature
agent-localis not defined yet. A feature that enabled nothing would move the failure from startup to the first message, sotransport: localis refused withConfigError::LocalAgentsNotCompiled { agent, feature: "agent-local" }(exit 78) in every build, andLocalAgentKind::compiled_inisfalse. The change that addsorch-agent-adamdefines the feature, turnscompiled_inintocfg!(feature = "agent-local"), and replaces the message's "not available yet". - Verified 2026-09-29 (this repository):
cargo test --workspaceagainst Postgres 16 passes; the generated web types makecardUrloptional andpnpm check,pnpm typecheck,pnpm testandpnpm buildinweb/pass unchanged (no UI code readscardUrl);GET /api/agentsvalidates against the contract with an agent that has no card URL (surface-chat-api's conformance test lists one from the scripted stack; since 2026-09-30 that test isorch-api'stests/contract.rs). - Unverified: a real deployment reading an agents file with a
localentry; none can run until the next change.
Status note, 2026-09-30: migration step 12 built ​
The third change of step 12: orch-agent-adam, the local agents behind the Cargo feature agent-local, with the Echo kind only. The coder kind (an agent with tools and a workspace) is the next change.
- The owner decided the journal's home on 2026-09-30. A local agent keeps its journal in the orchestrator's Postgres, in tables prefixed
orch_agent_. This settles the line in decision 6 that said the owner had not confirmed it, and closes "revisit it before the first local agent ships". A second database stays possible later (the store takes a pool), but it is a data migration ("Hard to reverse"). - What was built.
orch-agent-adam(LocalAgents,LocalAgentClient, the closedLocalKind) drives oneadam-runtimeRuntimeper process through theadam-a2aTaskBackendseam (adam-a2a-runtime), and maps the results withorch-a2a-mapping, so its idempotency keys are the HTTP client's.orch-portsgainsByTransport<A, L>, which routes each endpoint to its client by transport and holds no adam type.- The binary has the feature
agent-local, off by default:LocalAgentKind::compiled_iniscfg!(feature = "agent-local")and the refusal oftransport: localnames the feature. It readsAGENT_LOCAL_CONCURRENCY(default 4) under the feature. - The Dockerfile takes the build argument
ORCH_FEATURES(empty by default).
- The pin moved from
0e08fe07…to882e23901ea9964e4a6ed96ee1aed2f4dcea98eb(adam-rsmain). The seven adam crates the orchestrator uses share it (adam-host,adam-core,adam-runtime,adam-a2a,adam-a2a-runtime,adam-store-postgres,adam-notify-postgres). The bump is additive foradam-host(it gainedPlacement). - The TLS backend is kept single.
adam-store-postgresandadam-notify-postgresdefault to their featuretls-rustls, which selects sqlx'stls-rustls-ring; the orchestrator usestls-rustls-aws-lc-rs. The workspace depends on both withdefault-features = false. Verified 2026-09-30:cargo tree -p orchestrator -i ringfinds nothing with the feature on or off. - Where the journal lives at boot. Every role that has a local agent configured builds a pool of its own from
DATABASE_URL, sizedAGENT_LOCAL_CONCURRENCY + 4, and migrates the journal after the orchestrator's own migrations (both are idempotent under their own advisory locks). Theworkerandallroles run the agents' worker and its notifier beside the dispatcher; thecontrol-planerole runs neither and registers the agents' starters only. Each replica therefore holdsAGENT_LOCAL_CONCURRENCY + 4more database connections, on top ofDATABASE_MAX_CONNECTIONS. - Verified 2026-09-30 (adam-rs at
882e239, read in/home/user/another-adam-rs):PgStore::with_table_prefixaccepts[a-z0-9_], at most 40 characters, not starting with a digit (crates/adam-store-postgres/src/lib.rs:84); every table, index and constraint name derives from the prefix, andStore::migrateisCREATE … IF NOT EXISTSin one transaction underpg_advisory_xact_lock(hashtext('adam-rs:migrate:<prefix>'))(lib.rs:421-422);SCHEMA_VERSIONis 2 (lib.rs:50). The tables areorch_agent_runs,orch_agent_journalandorch_agent_meta.PgNotify::with_channel_prefixgives the channels{prefix}eventsand{prefix}signals(crates/adam-notify-postgres/src/lib.rs:156), hereorch_agent_eventsandorch_agent_signals; the orchestrator's areorch_thread,orch_outboxandorch_resync, and its tablesthreads,events,a2a_bindingsandoutbox, so nothing collides.- The
NOTIFYpayload limit is now verified: nothing overMAX_PAYLOAD_BYTES = 7_999is sent (crates/adam-notify-postgres/src/wire.rs:15); an oversize status is cut on a character boundary and any other oversize event is dropped (its artifact is still in the durable run). This replaces the unverified item on the 8000 bytes above. RuntimeTaskBackendimplementsTaskBackend(submit,get,cancel,subscribe) with these properties: a task id that is not a UUID givesOk(None)(crates/adam-a2a-runtime/src/backend.rs:161); one backend serves one agent name; a new task's id istask_id_for(agent, subject, context, message_id)(crates/adam-a2a-runtime/src/ids.rs:50), so resubmitting a message is idempotent; a cancel is committed asFailed "cancelled: …"and read back ascanceled(crates/adam-a2a-runtime/src/convert.rs:14).TaskEvent::ends_streamand the loop that cuts a stream (crates/adam-a2a/src/backend.rs:72,crates/adam-a2a/src/handler.rs:72) are copied, since the loop is private there.
- Verified 2026-09-30 (this repository, against Postgres 16): the
AgentClientconformance suite passes on the local client over the in-memory journal and over Postgres; a task survives its worker dying mid-step (two processes on one schema, a 1 s lease: the second steps it to its end and a resubscribe shows the original keys); the tables and channels carry the prefix and noadam_table exists; the orchestrator's tables, adam's default prefix and ours coexist in one schema; the migration is idempotent under six concurrent replicas; through the dispatcher, an echo thread completes, a restart mid-task finishes with no gap and no duplicate, and a cancel reaches the local task; the binary answers a run through a localechoagent, and a control plane starts the run without stepping it until a worker starts.cargo tree -p orchestrator -i adam-runtimefails with the feature off, so the default binary links no adam runtime. - Unverified: the Docker build with
--build-arg ORCH_FEATURES=agent-local(cargo chef cookwith--features; there is no Docker daemon here, and CI builds the default image only). Unverified: the SIGKILL process test of a local agent's worker: the durability test aborts the worker's future in-process, which drops its steps and stops its lease renewals without a process boundary. It comes with the coder kind, whose steps hold a workspace. Unverified: retention of theorch_agent_*tables:Store::purge_finishedexists in adam-rs but nothing calls it yet (open question 28).