Skip to content

factory: the factory is an AgentField node; AgentField triggers are its intake - #2487

Merged
santoshkumarradha merged 4 commits into
factory/general-intakefrom
factory/gi-agentfield
Nov 7, 2026
Merged

santoshkumarradha merged 4 commits into
factory/general-intakefrom
factory/gi-agentfield

Conversation

@santoshkumarradha

Copy link
Copy Markdown
Member

The factory registers as a node on an AgentField control plane, and every AgentField trigger aimed at codeaf-factory.intake becomes a factory job through the inbox. Spec: docs/design/factory-general/DESIGN.md §AgentField.

What it adds

  • Wire (hello factory.agentfield): factory.agentfield_connect, _status, _disconnect, _triggers, _sources, _trigger_add. Documented in PROTOCOL.md.
  • Reasoners (each with a JSON Schema):
    • intake (accepts_webhook): files the event as a job;
    • message: reaches a job's manager; a stranger's text becomes activity context only;
    • status: answers the job's facts.
  • Node endpoints: /health, /status and /discover, on the node's own listener.
  • Lease: a new instance_id on every start; the lease renews every lease/3; a 404 on renewal re-registers; the node sends offline on stop.
  • Translators (internal/factory/agentfield/translate.go): pure and fixture-tested. One each for linear, sentry and slack, and one for generic_bearer, generic_hmac, cron and a direct execute.
    • The source is agentfield:<source>.
    • external_id is the source's own id, then the event's, then the idempotency key.
    • Trust is capped by the connection's ceiling (collaborator by default).
    • GitHub stays native: a github event only nudges the factory's own GitHub read for a watched repo, and never files a job.
  • Completion: the intake answers 202 and keeps the execution id in a side table, agentfield-executions.json. It then reports running with progress, then succeeded with {job, state, pr_url, steps_done, steps_total, …}, or failed with the job's own words.
  • Docs: the manual page factory-agentfield.md with 13 probes, and a change entry with invalidates:.

Transport and auth

AgentField's trigger dispatcher sends no credential to the node. Only the execute path carries internal_token. So the node registers <base_url>/n/<64-hex secret> and answers 404 anywhere outside that path, using a constant-time check. That is the strongest option the control plane supports today.

The CP API key and the secret are kept the way the GitHub token is: app keys first, otherwise the profile. They are redacted and never answered back.

The client is hand-written rather than importing the SDK. The SDK's agent package is a whole runtime: its own server, DID, memory and AI clients.

Live e2e on mac-studio

TestFactoryAgentFieldNodeE2E ran against a real AgentField control plane built from origin/main c48139680a, using SQLite. Models were deepseek/deepseek-v4.1-flash only, on a fresh home. It passed in 88s at a cost of $0.025.

Assertion Evidence
Node registered codeaf-factory, reasoners intake/message/status, lifecycle ready, base_url …/n/…
Event stored in AgentField event exec_20261106_202509_b2znog0t, status dispatched
Job filed job 61, agentfield:generic-bearer:afnode-1794014709, route "AgentField small changes"
Ran write/test/proof on deepseek-v4.1-flash all three steps ran on deepseek/deepseek-v4.1-flash
PR opened santoshkumarradha/factory-demo#163
Execution succeeded with result.pr_url exec_20261106_202509_ahdmpctk → succeeded, pr_url = #163
A cron tick files nothing tick dispatched; node: "filed nothing: a cron tick that carries no entry"; job count unchanged

Cleanup closed #163 with the comment "agentfield node e2e, closing" and deleted its branch. It also deleted the triggers and disconnected the node.

Checks

make test-laws, go test ./internal/manual/ and make pr-ready pass; the change entry's PR number is set in the follow-up commit. The unit tests cover the translators, the registration payload, the lease, the 404 without the secret, the GitHub nudge, the completion callback, dedup, a refused entry (422), and message/status.

Deferred

  • DID / verifiable-credential signing: not done.
  • AgentField reasoner as a pipeline step: a pipeline step cannot call one.
  • DAG child executions: a job's steps are not child executions.
  • Team factory: codeaf factory serve does not run the node.
  • Merge note for gi-trigger-api: that lane has not landed, so progress uses the inbox.Notify Replier plus a 20s tick that doubles as the keepAlive. message and status are minimal. Swap both to the started/question/done bus events when the lane merges.

🤖 Generated with Claude Code

…ts intake

internal/factory/agentfield registers the factory on an AgentField control
plane as codeaf-factory with intake, message and status reasoners, renews its
lease as a fresh instance per start, and serves them under a secret path in
its base_url (the trigger dispatcher sends no credential). One translator per
source (linear, sentry, slack, generic, cron) turns a dispatched event into an
inbox.Entry under agentfield:<source>, trust capped by the ceiling; a github
event only wakes the native GitHub read. intake answers 202 and reports the
job's progress and completion (pr_url) on the execution.

Wire: factory.agentfield_connect/_status/_disconnect/_triggers/_sources/
_trigger_add, hello factory.agentfield. Manual page factory-agentfield.
@santoshkumarradha
santoshkumarradha merged commit 50dd8d2 into factory/general-intake Nov 7, 2026
1 check passed
@santoshkumarradha
santoshkumarradha deleted the factory/gi-agentfield branch November 7, 2026 01:27
santoshkumarradha added a commit that referenced this pull request Nov 7, 2026
…age and status reasoners are the Trigger API's doors

The node registers as inbox sink "agentfield" and reports each moment to
the job's open executions; the 20-second tick is gone. An execution quiet
for keepAlive is told again with the lease, so a long job never looks
stale and a dropped job still completes. The message and status reasoners
call trigger.Message and trigger.Status; Node.Send and its job_send wiring
are removed. #2487's change entry now names its pull request.
santoshkumarradha added a commit that referenced this pull request Nov 7, 2026
…inks, signed webhooks per source (#2485)

* factory: the Trigger API — a token per source, messages and status from outside, signed webhooks, Go and TypeScript clients

* factory: Trigger API reshaped — one event bus with sinks, webhooks per source, message and status doors for AgentField; no source tokens, no SDKs

* factory: shorten the Trigger API change title

* factory: the Trigger API change entry names its pull request

* factory: the AgentField node is a sink on the event bus, and its message and status reasoners are the Trigger API's doors

The node registers as inbox sink "agentfield" and reports each moment to
the job's open executions; the 20-second tick is gone. An execution quiet
for keepAlive is told again with the lease, so a long job never looks
stale and a dropped job still completes. The message and status reasoners
call trigger.Message and trigger.Status; Node.Send and its job_send wiring
are removed. #2487's change entry now names its pull request.
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