Commit Graph
17 Commits
Author SHA1 Message Date
sam 9bd95c9238 feat(workflow): retries, parallel branches, review steps; every shipped workflow is YAML and the per-workflow step types are gone 2026-10-05 00:10:04 +11:00
sam ef538f0c6c feat(workflow): when conditions, handoff, human approval and forge steps; feasibility and triage ship as YAML 2026-10-05 00:06:35 +11:00
sam 609528e9ca feat(workflow): repository step types; implement and tdd ship as YAML in general steps 2026-10-05 00:04:34 +11:00
sam 90d06c2455 feat(workflow): step ids, {{ }} references to earlier results, agent.run result schemas, workflow.finish and on_failure 2026-10-05 00:02:07 +11:00
sam 20d5624840 refactor: cut remaining long comments down to what the code does 2026-10-03 22:06:57 +10:00
sam 96e5d7b84b refactor: strip doc and issue narration from code comments
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.
2026-10-03 21:47:46 +10:00
sam ff424b70ac refactor: testing from the beginning. a journey in 150k lines of tests to none 2026-10-03 21:16:25 +10:00
sam 1ba38ac32b feat(workflow): add the command.run step type
archie-core-ndm8 accepted the command-step trust decision, so a stored
workflow definition may run operator argv. The workflow engine has exactly one
call site -- agentworker, which is what the container agent serves -- so the
step runs on the container path by construction. A non-zero exit parks the run;
level: warn makes it advisory.

Settings mirror the repository gate's command shape (name, argv,
expect_failure) so a command means the same thing in both places. The settings
type is local rather than agentexec.Command because that struct carries JSON
wire tags only, and YAML decoding silently dropped expect_failure -- a command
declared to fail would have been reported as passing. A reflection test holds
the two shapes together.
2026-10-03 02:07:45 +10:00
sam 0aa0277ee9 docs(prds): name the registered step type and hold the vocabulary PRD to the provider set
docs/prds/workflow-step-vocabulary.md named the repository-rules step type
`workflow.diff-rules` while the vocabulary a deployment resolves carries
`gate.diff-rules` (workflow.DiffRulesStepName), so a definition written to
the document's word is refused at save and at run. The same decision's
sibling, docs/prds/runtime-control-plane.md, still claimed "Plugins can add
step types", which this document's closed-set rule contradicts: an
interpreted plugin contributes none, and a step type arrives as a provider
in the compiled-in set.

Correct both documents, and hold the vocabulary PRD to the provider set with
a guard test: every step-type-shaped name the document identifies must
resolve in workflowsteps.Providers(). The test fails on the pre-fix document
("workflow.diff-rules" is contributed by no provider) and passes after.

Refs: archie-core-vwqc, split from archie-core-gcoj (closed as invalidated by
re-verification: the provider set exists and cross-side agreement is already
pinned).
2026-10-02 11:05:08 +10:00
sam 208a1a9c38 feat(workflow): workflow.call step with save-time input and cycle checks (archie-core-t2db.41) 2026-09-26 13:36:41 +10:00
sam f538f457ce fix(controlplane): stored container policies replace file profiles; add profile image and workflow examples
A stored container-runtime-policies document that carries Profiles now
replaces the file's profiles instead of merging into them, so a profile
deleted in the dashboard stays deleted; one stored before profiles existed
still inherits the file's. Profiles drop their json tags so the stored
document keys them like its other fields.

Adds examples/profiles/Dockerfile.agent-net (agent image plus network
lookup tools) with a build-only agent-net compose service,
examples/workflows/firewall-investigate.yaml with a test that parses every
example against the registered step vocabulary, and names the postgres
service in the compose header.
2026-09-24 20:58:08 +10:00
sam 47fae672f1 feat(eda): workflow inputs, optional repository and agent profiles
Workflow definitions declare inputs, repository (none, optional or
required; default required) and profile. A binding assigns each input
from a mapped parameter or a constant and may take its repository from a
parameter, which must name a configured repo; both are checked when the
binding is saved and again at dispatch. Inputs travel as structured task
data (tasks.inputs, the task brief, and a JSON block in the agent's
mission), never as body text.

A task with no repository runs in a per-task scratch workspace with no
clone and no publication grant. The agent.run step runs one mission
without a repository and finishes the task in the new completed status.

Agent profiles live under [containers.profiles.<name>]: an image and an
allowlist over the tools archie adds (MCP, scripts, plugins).
[containers].image is the default profile; an unconfigured profile parks
the task. The workflow is now pinned before the container starts so the
profile can choose its image.

Also stop two archied tests writing embedded NATS state into the package
directory, refuse an empty state_dir for embedded NATS, and drop the NATS
store files an earlier lane commit tracked.
2026-09-24 20:29:33 +10:00
sam 63565de5cd feat(workflow): register gate.diff-rules as the .archie/gate.go replacement
steps.go's StageYaegiGate tells the operator to migrate the deleted
.archie/gate.go hook to a registered YAML workflow step, and
BuiltinStepRegistry() exposed only the six shipped workflows' own stages,
so there was nothing to migrate to. What that hook did, from 924b02a1
which deleted it: it read the worktree's repository-authored Go,
exporting Check(GateContext{Diff, ChangedFiles, Dir, BaseRef, Repo})
[]Finding, where each Finding carried a level ("error" blocked the run,
"warn" was advisory) and an optional file and line, and it inspected the
committed diff.

gate.diff-rules is that behaviour as a typed step: operator-written rules
in a stored definition -- per-rule level, RE2 pattern, optional path and
exclude_path scope, message -- matched against the ADDED lines of the
diff against the base branch, reported with their new-file line numbers.
An error-level finding parks the run with the findings in the park
reason; a warn-level finding is logged and nothing else. Unlike the hook
it replaces, no code is read out of the repository being worked on, and
the rules are versioned and audited with the definition they live in.

The settings are validated at the factory, which runs where a definition
is validated and again where it is compiled: a missing level, pattern or
message, an unknown level or settings key, and an expression that is not
a RE2 all refuse the definition rather than load and check nothing.

It arrives through the extension point archie-core-fwmp landed: a
repo-hooks provider in internal/infrastructure/workflowsteps, so both
roots that resolve a step type (the State Store's validating side and the
daemon's workflow-definitions client) register it at once.

Deliberately not landed: a step type for .archie/stages/*.go, whose
faithful equivalent is running a configured command. That would make the
stored workflow-definitions resource a command-execution surface on the
agent host, which is a maintainer's trust decision, not this lane's; it
is escalated, so steps.go's repo-stages error stays as it is.
2026-09-21 20:33:47 +10:00
sam b4aa56dcb3 fix(archied): register the step vocabulary only where a root resolves it
Review pass on the step-vocabulary shape. The gateway root shared
openStateStoreAdapter with the daemon, so it registered a step vocabulary and
built a workflow-definitions client it never read: the same dead vocabulary the
previous commit removed from internal/app/archiemessaging, reintroduced through
the shared adapter, and able to fail the gateway's boot the day a provider set
can fail to load. The vocabulary and the client now belong to the daemon root
alone (openDaemonWorkflowDefinitions, called by Run before buildDaemon captures
it), which is what Client's "a process that never reads or writes a workflow
definition needs no provider set and cannot be failed by one" already claimed.

The root guard was weaker than its own comment: it asserted that a root calls
stepVocabulary(), not that the manager returned is the one handed to
NewServer/NewWorkflowDefinitionsClient, so a root could call it and inject an
empty manager and keep every test green. The pin now asserts the data flow (both
halves mutation-checked), plus Run's ordering -- after openStateStoreAdapter,
before buildDaemon.

Three root guards asserted exact equality with workflow.BuiltinStepRegistry(),
which contradicted the extension path they guard: adding a provider to
workflowsteps.Providers() -- the documented way a step type arrives -- failed
all three, and the expectation could not be satisfied by editing it. They now
assert what their doc says (every shipped stage present) plus provenance (every
name resolved is declared by the shared provider set), and the workflowsteps
guard derives its expectation from Providers() so both sides move together.

New guard on the defect class the bead exists for: TestNoProductionSiteReaches-
ForTheBuiltinStepRegistry scans the module and fails if any non-test file outside
the domain declaration and the shipped provider names BuiltinStepRegistry, which
the agreement test cannot see for a sixth resolution site added later.

Claim-vs-code corrections: openStateStoreAdapter "reads and replaces" -> the
daemon only reads, and ReplaceWorkflowDefinitions has no production caller yet;
workflowsteps' package/Providers docs no longer claim every Archie binary
registers the set (archie-gateway, archie-messaging, archie-playbooks and
archie-ui do not); the shipped-provider test no longer says production does not
call BuiltinStepRegistry, which is false -- production calls it only there.
2026-09-21 20:22:44 +10:00
sam 9fb65d0519 fix(workflow): pin the roots, drop the dead vocabulary, guard the nil manager
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.
2026-09-21 20:00:37 +10:00
sam d4f35104e3 test(workflowsteps): pin that the provider forwards the shipped factories
Self-review of the fwmp shape: the provider enumerates BuiltinStepRegistry and
forwards each factory, so no shipped behaviour changed -- but the one guard the
refactor moved off the production path lost its coverage. "A shipped stage
accepts no settings" was asserted only in
internal/domain/workflow/definition_test.go through BuiltinStepRegistry, which
production no longer calls; TestShippedVocabularyCoversEveryShippedStage
compares names only, so a provider that rebuilt the factories instead of
forwarding them would keep every name, lose the guard, and stay green.

The new test drives every shipped definition through the registered vocabulary
and asserts each step compiles to the shipped stage (not a rebuild named after
the step type) and that settings are still refused.
2026-09-21 19:46:05 +10:00
sam 54fe3a3331 feat(workflow): own the step vocabulary in a family manager registered at each composition root
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.
2026-09-21 19:42:24 +10:00