Repository navigation
factory: Trigger API — message and status doors, one event bus with sinks, signed webhooks per source - #2485
Merged
Conversation
…om outside, signed webhooks, Go and TypeScript clients
# Conflicts: # docs/design/factory-general/DESIGN.md
…r source, message and status doors for AgentField; no source tokens, no SDKs
…tory/gi-trigger-api
…tory/gi-trigger-api # Conflicts: # internal/manual/chat_test.go
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wave 2's Trigger API, reshaped for AgentField: one event bus out with pluggable sinks, a message door and a status door, and signed per-source webhooks from a durable outbox. No per-source tokens and no SDKs (AgentField's SDKs and DID auth cover that). Every HTTP call takes the operator token.
POST /api/intake/{source}/{id}/messages {author?, text}→{job, accepted, outcome, line}trigger.Message(ctx, st, trigger.Said, now)→inbox.Message→factory.ReadComments(the GitHub comment path)GET /api/intake/{source}/{id}→{job, state, steps_done, steps_total, route?, pr_url?, question?, updated}trigger.Status(st, source, id),trigger.StatusOfJob(st, job)→api.IntakeStatusOf(read offapi.FromItem)GET/POST/DELETE /v1/webhooks·codeaf factory webhook add SOURCE URL/list/remove SOURCEtrigger.Webhooks(secret printed once; kept 0600 intrigger-webhooks.json)message/statusreasonerstrigger.Message/trigger.Status/trigger.StatusOfJob; the node isinbox.RegisterSink("agentfield", …)This PR also moves #2487's AgentField node onto the bus:
Signature:
X-Codeaf-Signature: t=<unix>,sha256=HMAC(secret, "<t>.<body>"), plusX-Codeaf-Delivery(the same id on every retry) andX-Codeaf-Event. Retries start at 2s and double up to 1h, for 72h, until a 2xx. The outbox survives a restart.Evidence
internal/factory/trigger:TestTheOutboxRetriesUntilA2xxAndSurvivesARestart,TestARemovedWebhooksDeliveriesAreDroppedAndOldOnesGivenUp,TestTheSignatureRefusesATamperedOrStaleBody(a golden vector),TestAWebhookKeepsItsSecretPrivateAndIsReplacedWhole,TestTheSinkQueuesOnlyForASourceWithAWebhookAndAMergeIsAlsoDone,TestTheMessageAndStatusDoorsAnswerWithoutHTTPinternal/factory/inbox:TestEverySinkHearsEachMomentBesideTheReplier,TestMomentsAreTheChangesOfAnInboxJob,TestAMessageIsReadAsACommentAtTheLowerTrust,TestAMessageKeepsTheLastFewAndRefusesWhatItCannotTakeinternal/factory/run:TestAMessageFromOutsideIsInTheNextStepsBriefinternal/factory/api:TestIntakeStatusIsTheJobWiresFactsinternal/factory/serve:TestTheTriggerAPIFilesMessagesReadsAndHearsBack, an httptest end-to-end: set the webhook, file, message, read status, receive signedjob.filed,job.messageandjob.pr_opened, and see the teammate refusalsinternal/factory/jira:TestReplierCommentsEachMomentalso coversquestionand ignores the new kindscmd/codeaf:TestFactoryWebhookAddsListsAndRemovesinternal/factory/agentfield:TestMessageAndStatusReasoners(now through the doors: a comment on the job, a stranger's job read as context, 404 and 422),TestAStoppedJobFailsItsExecutionWithTheJobsWords(now from a bus moment),TestTheIntakeAnswers202AndThePullRequestCompletesTheExecution(the unit-level copy of the e2e), and the newTestAQuietExecutionIsToldAgainWithTheLeasemake test-lawsandgo test ./internal/manual/pass.make pr-ready BASE=origin/factory/general-intakepasses (see the PR thread).Merge Danger
Door: two-way. The new files live in the floor folder (
trigger-webhooks.json,trigger-outbox/) and are ignored by older builds.Blast Radius: factory-intake
GitHub is untouched (no change to the poller or its comments). Behaviour changes for jobs filed from outside:
question, notstuck, and Jira still comments it;inbox.Addnow notifiesfiled;messagereasoner no longer sends the text into the manager conversation as a person's message: it is a comment, handled once, like a GitHub comment (text limit 8000, not 32000), and its answer and thestatusanswer change shape (registered schemas updated);docs/changes/unreleased/2487-factory-agentfield-node.mdhadpr: 0, which failedchangelog-check; it now says 2487.Deferred: no desktop wire methods for webhooks (only CLI and HTTP).
job.messagecarries the manager's reading of the message, not a later free-form reply.🤖 Generated with Claude Code