Skip to content

feat(agents): start an agent job from a failed apply and on a schedule (#5357) - #5377

Merged
lex00 merged 1 commit into
mainfrom
feat/agent-apply-failed-schedule
Nov 20, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/agent-apply-failed-schedule

Conversation

@lex00

@lex00 lex00 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Closes #5357

A failed apply and a schedule now start agent jobs on the intake alerts use (#5329): each start is a fact, and facts for one member received close together join one run that names them on its record.

Triggers

on: "apply-failed" and on: "schedule" join the existing triggers (AGENT_FACT_TRIGGERS in packages/core/src/ci-agent.ts). Each is a workflow of its own. GitHub and Forgejo start it by workflow_dispatch or its schedule; GitLab starts it by a pipeline schedule or a default-branch pipeline run by hand. The agent answers with a pull request that waits for a person.

A failed apply records one signed fact per failed member under _alerts/apply-failed.jsonl. The job needs CHANT_AGENT_FACTS=apply-failed and the relay key. Three places record it:

  • chant's wave jobs, through the waves pipeline's agentFacts option
  • components pr-apply
  • chant agent apply-failed --op <name> --from <log> in a product's own apply job

The engine's error is kept as data: up to 8,000 characters per member and 20,000 in the prompt. The triage comment posts as before.

A scheduled run is its own fact, keyed by its CI run id. A retry inside the join window joins the run already made. The task comes from the workflow on the default branch, and the agent holds no relay key.

Settings from the default branch

The generated command lines carry --digest sha256:... of the settings. chant agent prepare, run and land refuse variables that do not match it. On GitLab a pipeline variable can replace a job variable, and the digest sits on the script line where a variable has no reach. prepare and land also refuse a job whose commit is off the default branch. The branch name comes from the event, or from the origin/HEAD the generated checkout notes.

For products

productApplyFailedAgent, productScheduleAgent and opWavesAgentFactsEnv are in @intentius/chant/ci-product, gated by AGENT_FACT_TRIGGERS_FLOOR. New vocabulary rows: agent.apply-failed, agent.schedule, agent.schedule.cron and agent.schedule.task. The window and key rows now list both triggers. The agent jobs guide has a section for each trigger and one for the settings check.

Both triggers are off until a product asks for them. Agents still never apply, approve or merge.

Tests

packages/core/src/ci-agent-triggers.test.ts takes both triggers through decision and landing with the never-apply checks and the trigger on the run record. It records a failed apply on a temporary ledger. In a temporary repository a pull request widens the agent's caps, and the test shows the base's caps apply. The GitHub, GitLab and Forgejo generator tests cover the new workflows and the digest.

@lex00
lex00 enabled auto-merge November 20, 2026 10:14
@lex00
lex00 added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 878df88 Nov 20, 2026
10 checks passed
@lex00
lex00 deleted the feat/agent-apply-failed-schedule branch November 20, 2026 10:30
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.

agents: start an agent job from a failed apply, and on a schedule

1 participant