Replace the service bearer tokens with [tls] ca_file and cert_dir. Caller
identity comes from the verified certificate, not metadata. Without TLS,
services listen and dial on loopback only. Task containers get only the CA
and keep their grant.
Remove PRD/doc paths, bead IDs, phase notes and deleted-test references
from comments; drop test-only hooks left by the test deletion. Includes
in-progress archied bootstrap, gateway and query changes.
TaskContext.Guardrails was never assigned: the engine was built in
archied's composition root and held on Daemon.Guardrails, which no code
read after workflow execution moved to the full-task worker handoff.
archie-agent is a separate process, so a live engine cannot cross that
handoff. Build the engine at the agentworker composition root (the
process that runs agent stages), thread it through the task dependencies,
and set it on TaskContext; drop the now-dead archied-side construction.
Refs: archie-core-jd5v
Third review pass on the step-vocabulary shape, one fix per finding.
P1, roots unpinned. The agreement test built its own manager and injected it, so
it pinned the resolution sites and not the roots that decide the provider set; a
root regressed to workflow.NewManager() (no shipped stages) left go test green.
archied now resolves through one unit, stepVocabulary (step_vocabulary.go), and
agentworker's productionWorkerDependencies is exercised directly:
internal/app/agentworker/step_vocabulary_test.go and
internal/app/archied/step_vocabulary_test.go assert each root's manager resolves
the shared provider set's shipped stages and accepts a provider registered
through it. RunStateStore and openStateStoreAdapter own a SQLite file and a gRPC
dial, so their calls are pinned by source position, the way
composition_order_test.go pins the memory-engine ordering.
P2-B, dead vocabulary. archie-messaging registered a step vocabulary it never
resolved (its only control-plane call is RuntimeChatConfig) and could fail
startup on it before the State Store target guard. The workflow-definitions
surface is now its own type, controlplane.WorkflowDefinitionsClient, so the
vocabulary is a constructor dependency of the one surface that resolves step
types and of nothing else. The messaging root no longer imports workflowsteps.
P2-C, nil manager. A nil *workflow.Manager dereferenced on every resolution path.
stepRegistry and CompilePinnedWorkflow now refuse with an error naming the wiring
mistake; TestNilStepVocabularyFailsClosedAtEveryResolutionSite pins the refusal.
Claim-vs-code corrections: agreement is stated as within one build (vocabulary.go,
stepRegistry, openStateStoreControlPlane, openStateStoreAdapter); the Yaegi claim
now says no bridge to StepFactory has been built and cites
internal/secret/secretextract; the provider set names its three roots;
Manager.Register's ordering is documented as a constraint with its consequence,
and the shape rule no longer claims to reserve shipped stage names; the
shipped-stage test compares against the builtin factory's own stage.
archie-core-fwmp. Every call site hardcoded workflow.BuiltinStepRegistry(), so
the step vocabulary a workflow definition may name was closed to the six shipped
workflows and archie-agent could compile only what the control plane happened to
validate against the same literal.
internal/domain/workflow.Manager is the family owner (ARCHITECTURE.md#plugin-
engine-rule-strict invariant 2): a constructed, injected value with no
package-level registry and no init()-time registration. Register validates at
the producer and atomically -- nil or unnamed provider, malformed provider or
step-type identifier, a step type with no factory, a duplicate claim, a provider
declaring one type twice, and a contribution shadowing a shipped stage are each
refused, and a refused contribution applies nothing. Registry() hands back a
copy, so the closed set is a property of the manager rather than a convention.
internal/infrastructure/workflowsteps is the one package both composition roots
import: it holds the compiled-in provider set and builds the manager. archied
registers it in RunStateStore (the validating side) and in openStateStoreAdapter
(the daemon's client), archie-agent in productionWorkerDependencies (the
executing side), and archie-messaging at its own root, each before the first
resolution.
The five hardcoded sites now resolve the injected manager instead: the State
Store's workflow-definitions validate closure and encodeWorkflowDefinitions, the
control-plane client's read and write paths, and CompilePinnedWorkflow's shipped
-definition and pinned compiles (one resolution per package).
step_vocabulary_agreement_test.go registers a provider through the production
Manager and drives all three sides with it; breaking any one of the six
resolution points back to the builtin registry fails that side's assertion.
* refactor(state-store): delete NATS storerpc; agent store is gRPC-only (archie-core-8cda.4.6)
The agent is fully on the gRPC State Store contract, so the legacy NATS
storerpc path is dead (docs/prds/state-store-contract.md §12 step 4):
- delete internal/storerpc (Server, Client, subjects) and its tests
- drop the storerpc registration from registerTaskRPCServers and the
now-unused store param
- make the agent transport's State Store URL required and Store() return
only the gRPC staterpc.Client (no NATS fallback)
- rework agentworker/agent transport tests to back the store with a real
gRPC State Store server instead of the deleted NATS storerpc server
The agent binary now fails fast when STATE_STORE_URL is absent. Agent store
calls (workflow.Store) go over gRPC to the archie-state-store service.
* refactor(state-store): delete daemon/gateway in-process store ownership (archie-core-8cda.4.6)
The daemon and gateway no longer open archie.db in-process: the single SQLite
file is owned by the standalone archie-state-store process, and both consumers
dial its gRPC State StateStore contract (docs/prds/state-store-contract.md
§12 step 7, no dual-store ownership).
- openStores no longer opens the production task store or seeds b.st; it only
wires secrets/forge and the gateway conversation store
- openStateStoreAdapter now requires [services.state].target (the old local
default is deleted) and resolves b.stateStore as the remote *staterpc.Client
- delete the in-process startStateStoreServer (the multiplexed gRPC server and
its per-task bearer-token registry) from the daemon composition
- RunGateway now resolves the same remote State Store adapter; its session
SQLite stays Gateway-owned and untouched
- daemon.ConnectedStateStore carries the configured target plus the resolved
bearer token, which containerEnv injects as STATE_STORE_URL / STATE_STORE_TOKEN
so archie-agent authenticates to the same remote service
- readiness store probe reads b.stateStore
PRD-consistent choice (noted): with the in-process server gone, per-task token
generation is removed; the daemon/gateway/agent all present the single
[services.state].target_token (or STATE_STORE_TOKEN secret) that the standalone
store validates.
* docs(webui): require [services.state].target in config and deployment templates (archie-core-8cda.4.6)
After the in-process store path is deleted, archied and archie-gateway dial the
standalone archie-state-store gRPC service via [services.state].target and never
open archie.db themselves (docs/prds/state-store-contract.md §12 step 7).
- config.example.toml documents [services.state].target as required, with the
loopback vs Docker-bridge gateway + target_token rule
- deployment templates set [services.state] per topology: bridge gateway +
token for container-mode agents, loopback for host-only
- deployments/README.md and systemd-user-service.md describe start commands
for both topologies and drop the stale "not yet consumed by the daemon" note
* style: gofumpt alignment for State Store daemon literal; appease noctx/staticcheck (archie-core-8cda.4.6)
* docs(state-store): refresh stale in-process references post-cutover (archie-core-8cda.4.6)
* feat(state-store): generalize storerpc as the State Store gRPC contract
Implements archie-core-8cda.4.2 against docs/prds/state-store-contract.md
rev. 2c: generate protobuf/gRPC client and server adapters for every
ratified store contract (proto/state/v1/state.proto, 40 RPCs, one
StateStoreService), add internal/infrastructure/staterpc with a bufconn
conformance suite exercising both local and remote adapters, serve the
service in-process (bridge address + mandatory per-task bearer token when
agent containers exist, loopback-only otherwise), and flip archie-agent's
workflow.Store to a long-lived gRPC client when the daemon injects
STATE_STORE_URL/STATE_STORE_TOKEN (falling back to the legacy NATS
storerpc path otherwise -- one agent process is never both).
Also drops the *sql.Tx parameter from store.BindingDispatcher.RecordDispatch
(a required wire-blocker fix: a transaction cannot cross a gRPC boundary,
and production always passed nil).
fix(store): drop RecordDispatch's unusable *sql.Tx parameter
feat(config): add services.state contract-adapter selector
* fix(state-store): apply no-mistakes review decisions
- Drop StreamTokenInterceptor (unused; the State Store service has no
streaming RPCs and nothing calls it).
- Make StateStoreTokens.Validate compare tokens in constant time
(crypto/subtle) per the auto-fix hardening.ing finding.
- Amend config.example.toml / config.Services.State doc text so it frames
[services.state].target as the ratified surface consumed by the upcoming
standalone archie-state-store binary (.4.3), not active today.
* refactor(workflow,store): relocate Task/Status/Source and define workflow.Store
Move store.Task, store.Status*/store.Source*, and the 3-method workflow
store interface out of internal/store into internal/domain/workflow as
workflow.Task/workflow.Status/workflow.Source plus a consumer-owned
workflow.Store, superseding store.WorkflowStore. internal/domain/workflow
now imports zero internal/store symbols; internal/store persists the
domain type instead (infrastructure depends on domain), and its Store
satisfies workflow.Store.
Updates every production and test caller of the relocated symbols across
daemon, webui, gateway, agentworker, agenttransport/nats, storerpc,
taskrun, and worktreerpc, and removes TestRecordDispatchViaExplicitTx per
docs/prds/state-store-contract.md (rev. 2c) sections 4 and 12 step 2.
Two workflow-package integration tests that exercise the real *store.Store
move to an external workflow_test package (store_integration_test.go) to
avoid a workflow(test)->store->workflow(prod) import cycle now that store
depends on workflow.
* no-mistakes(document): docs(state-store): mark §4.8 relocation done in state-store-contract
Autonomous workflows now have exactly one production boundary: a task-scoped archie-agent receives a full-task core-NATS request and runs the worker-local stage loop. The legacy [agent] section remains decode-only for migration; it no longer selects runtime behavior.
Worktree RPC used to accept repository coordinates from the sandbox. It now accepts only an opaque per-dispatch grant, and the daemon derives the repository path and branch from grant-owned state.
Repository worktree paths also move from an ambiguous flattened key to encoded owner/repo components. Origin-matched legacy clones migrate safely; mismatched legacy paths are preserved.
A workflow run through the container/NATS path never wired
workflow.TaskContext.Bus, so every tc.Emit call (stage_start,
stage_finish, outcome, parked) was a silent no-op. archied's own
in-process path sets Bus and always worked; anything dispatched to an
archie-agent worker did not, which meant the dashboard's per-task
timeline showed "No events yet" for every task regardless of status
or stage -- confirmed live across a Working task and two differently
parked tasks.
Bridges the gap the same way system logs already cross this boundary:
ForwardTaskEvents relays a per-task in-process *events.Bus to a new
NATS subject (SubjectForEvents), and a new daemon-side subscriber
(subscribeAgentEvents) republishes decoded events on the daemon's own
Bus, landing them in the same persist-and-broadcast pipeline an
in-process workflow already used.
Closes#518
cmd/archie-agent used to own worker construction, NATS lifecycle, task execution, MCP setup, and workflow wiring. It now owns process input only and invokes internal/app/agentworker, while transport-specific NATS, boot-brief, and git-safety mechanics live under infrastructure.