Skip to content

factory: AgentField triggers from the app, and routing rules that run on a reasoner - #2525

Merged
santoshkumarradha merged 5 commits into
factory/general-intakefrom
factory/af-triggers-routing
Nov 9, 2026
Merged

santoshkumarradha merged 5 commits into
factory/general-intakefrom
factory/af-triggers-routing

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

What this changes

Triggers from the app. factory.agentfield_triggers {factory} now returns the control plane's source catalog alongside this node's triggers, and the new factory.agentfield_add_trigger creates a trigger aimed at <node>.intake. Feature flag: factory.agentfield_triggers.

Routing to a reasoner. A routing rule's then.run_on: "<node>.<reasoner>" sets the job's RunOn. The job then needs no repository, gets no pipeline steps, and runs like any existing run_on job. Feature flag: factory.route_run_on.

  • route.Clean checks the spelling with factory.AgentFieldTargetWord, the same check pipeline AgentField steps use, and refuses run_on combined with pipeline.
  • On this machine's factory, factory.routes_set also checks each reasoner against the control plane's node list. An unknown one is refused with routing rule "<name>": AgentField has no agent <x>; pick one it lists. A factory that isn't connected answers conflict. A team server's rules are checked for spelling only.
  • Intake: a no-repo run_on job is decided under pipeline.Defaults() instead of reading a repository's file.

when.sources: [agentfield:*] now matches every agentfield:<source> job (a trailing * after : or /). There is a test for it.

Redaction. No wire-log redaction list exists, in this repo or in codeaf-desk. What agentfield_connect does is mask its strict-decode error so the input is never quoted. Both trigger adds (_add_trigger and the older _trigger_add) now do the same, and the engine never logs a config. A test asserts a malformed add doesn't quote its input.

Manual. factory-agentfield.md rewrites "add a trigger" (it can be done from the app; the secret lives in the control plane's env var) and adds "send jobs to an AgentField reasoner with a routing rule". factory.md routing rules list run_on and agentfield:*. Two probes were added. PROTOCOL.md documents both features.

Contract

Everything the desk lanes code against is there with the exact names. These are additive or worth knowing:

  • factory.agentfield_triggers also keeps its existing node_id, and each trigger keeps its existing fields (reasoner, ingest_url, managed_by, secret_env_var, events_24h, failed_24h, last_event_at). webhook_url equals ingest_url and is absent for a loop source (cron). label is the source's label.
  • sources[] also carries secret_required and config_schema. sources[].event_types? (the factory lead's addition) is passed through from /api/v1/sources when the control plane lists it, trimmed and de-duplicated, and left out otherwise. Today's AgentField catalog does not send it, so it is absent against current control planes.
  • config_fields[].secret is true when the schema says writeOnly or format: password, or when the field name contains a word like secret, token, password or key.
  • factory.agentfield_add_trigger takes an additional optional secret_env_var. AgentField refuses a secret-requiring source (linear, generic_bearer, generic_hmac…) without one, so the engine refuses first, in words: <Label> needs a signing secret: name the control plane's environment variable that holds it (secret_env_var).
  • setup.secret is never filled. AgentField reads secrets from its own environment and never returns one. setup additionally carries secret_env_var. setup is absent when there's nothing to set up (a cron trigger).
  • Not connected answers conflict: this organization is not connected to AgentField; connect it first.
  • factory.agentfield_sources / factory.agentfield_trigger_add stay as they were, as the older pair.

Refusal wording. Every refusal this PR adds says "agent", not "reasoner", because the desk shows refusals word for word. This covers the save-time check, the run_on spelling (then run_on names an AgentField agent as node.agent: …) and the no-pipeline refusal. "reasoner" stays in code, wire field names and comments.

Proof

make pr-ready BASE=origin/factory/general-intake, tail:

ok  github.com/Agent-Field/codeaf/cmd/codeaf  shard 8/8  364s
FAIL  github.com/Agent-Field/codeaf/cmd/codeaf  8 shards  364s  failing: TestRunInCellSealsItsCallsAndContinuesFromThem,TestStartCrewConcurrentSameRequestSendsTheGoalOnce
ok  	github.com/Agent-Field/codeaf/cmd/codeaf	1.537s
::warning::github.com/Agent-Field/codeaf/cmd/codeaf: TestRunInCellSealsItsCallsAndContinuesFromThem: flaky
ok  	github.com/Agent-Field/codeaf/cmd/codeaf	0.099s
::warning::github.com/Agent-Field/codeaf/cmd/codeaf: TestStartCrewConcurrentSameRequestSendsTheGoalOnce: flaky
touched rest: ./internal/appwire ./internal/factory/agentfield ./internal/factory/intake ./internal/factory/route ./internal/manual
ok  	github.com/Agent-Field/codeaf/internal/appwire	1.912s
ok  	github.com/Agent-Field/codeaf/internal/factory/agentfield	1.374s
ok  	github.com/Agent-Field/codeaf/internal/factory/intake	2.189s
ok  	github.com/Agent-Field/codeaf/internal/factory/route	0.005s
ok  	github.com/Agent-Field/codeaf/internal/manual	5.610s
Every selected test passed on its first run.
exit 0

The two cmd/codeaf tests that failed in shard runs passed on their re-run, so the classifier marked them flaky. Neither touches this code. An earlier run flagged TestMemoryPausedJobLifecycle/stop_tail the same way.

🤖 Generated with Claude Code

…e can run a job on a reasoner

factory.agentfield_triggers now carries the source catalog (labels, config
fields) and each trigger's entry source, webhook address and creation time.
factory.agentfield_add_trigger makes a trigger aimed at the node's intake and
says what to set up; a source the catalog lacks or a missing secret variable
is refused in words, and no refusal quotes the config. Feature
factory.agentfield_triggers.

A routing rule's then may name run_on (node.reasoner): a matched job runs on
that reasoner with no repository, as a job filed with run_on does. The
reasoner is checked against the control plane when the rules are saved on
this machine's factory. when.sources agentfield:* matches every AgentField
source. Feature factory.route_run_on.
@santoshkumarradha
santoshkumarradha merged commit b726d4b into factory/general-intake Nov 9, 2026
1 check passed
@santoshkumarradha
santoshkumarradha deleted the factory/af-triggers-routing branch November 9, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant