Repository navigation
feat(agents): start an agent job from a failed apply and on a schedule (#5357) - #5377
Merged
Merged
Conversation
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.
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"andon: "schedule"join the existing triggers (AGENT_FACT_TRIGGERSinpackages/core/src/ci-agent.ts). Each is a workflow of its own. GitHub and Forgejo start it byworkflow_dispatchor 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 needsCHANT_AGENT_FACTS=apply-failedand the relay key. Three places record it:agentFactsoptioncomponents pr-applychant agent apply-failed --op <name> --from <log>in a product's own apply jobThe 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
taskcomes 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,runandlandrefuse 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.prepareandlandalso refuse a job whose commit is off the default branch. The branch name comes from the event, or from theorigin/HEADthe generated checkout notes.For products
productApplyFailedAgent,productScheduleAgentandopWavesAgentFactsEnvare in@intentius/chant/ci-product, gated byAGENT_FACT_TRIGGERS_FLOOR. New vocabulary rows:agent.apply-failed,agent.schedule,agent.schedule.cronandagent.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.tstakes 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.