feat(automation): implement explicit agent source-repair commands - #2174
feat(automation): implement explicit agent source-repair commands#2174seonghobae wants to merge 27 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Current-head RCA/fix evidence for the hosted quality RED:
Separate review note: GitHub's repository-permission endpoint deliberately maps the |
|
Consolidation finding: three independent source-mutation implementations (#2173, #2174, #2175) share protected Before #2174 can become Ready, inspect and explicitly adopt or reject with evidence the unique semantic deltas from the siblings rather than closing them mechanically:
Do not close #2173/#2175 merely because #2174 is the preferred owner. Closure is valid only after every unique source/test/contract/evidence delta is either integrated into #2174 or explicitly proven redundant/invalid. Keep all three Draft until hosted exact-head checks and independent review establish which lineage is safe to consolidate. |
Preserve current protected main and source-repair candidate histories with an ordinary non-force merge before semantic consolidation.
|
Ordinary current-main reconciliation completed without force/rebase: temporary integration PR #2180 merged protected Canonical consolidation remains incomplete. Before Ready/merge, retain or explicitly reject with executable evidence the useful sibling contracts: #2175's mutation-only Fresh exact-head hosted checks were triggered by the reconciliation and are authoritative; predecessor checks do not transfer. |
|
@opencode-agent review Please review exact head |
|
@noema-agent review Review exact head |
|
@opencode-agent review Please review exact head |
|
@noema-agent review Independent review requested for exact head |
|
Sibling-delta disposition on current canonical lane:
Coverage finding also became actionable on #2174: the quality workflow claims statement/branch 100% for both new production modules while the earlier focused tests did not exercise the scheduler/runtime surface. Current descendants add hostile runtime and scheduler isolation suites; exact-head hosted coverage remains authoritative once a runner starts. |
|
@opencode-agent review Current exact head is |
Purpose
Implement a real explicit source-mutation path without weakening review-agent semantics.
@opencode-agent,@noema-agent, and@strix-agentremain review-only; mutation uses the dedicated@cwl-source-fixcommand and a separate central control-plane lane. A review mention is never counted as repair progress.Architecture
This PR adds:
scripts/ci/agent_source_repair.py: dedicated command parsing, live writer-permission revalidation, same-repository/non-protected-head enforcement, protected-base consumer policy, no-retroactive-command boundary, exact comment-body SHA-256 binding, complete paginated PR Files receipt validation, control-plane path exclusion, sealed edit scope, dispatch and acknowledgement receipt.scripts/ci/agent_source_repair_sweep.py: bounded organization sweep reusing the existing repository/comment discovery primitives..github/workflows/agent-source-repair.yml: a separate scheduled dispatcher plus per-repository/PR serialized write worker. The worker uses onlycontextual-orchestrator/orchestrator/free, reuses the central CO sidecar and workspace-scope verifier, runs OpenCode without shell/web/credential access, revalidates authority and edit scope immediately before a normal non-force push, and never approves or merges.docs/automation/explicit-agent-source-repair.md: opt-in, command and trust-boundary specification.No change is made to
agent_mention_router.py,pr_review_fix_scheduler.py, Noema, Strix, provider discovery or merge policy. Appendingfixorrepairto a review-agent mention does not authorize source mutation.Protected consumer opt-in
Source repair is disabled unless the exact protected base contains
.github/cwl-agent-source-repair.json:{ "version": 1, "enabled": true, "not_before": "<rollout-time UTC timestamp>" }The
not_beforevalue prevents central deployment from executing historical source-fix comments. Missing, disabled, malformed, unknown-version or extra-field policy fails closed.Mutation boundary
Admission requires all of the following at dispatch and again in the worker: dedicated first-line
@cwl-source-fixcommand, human author, livewriteoradminpermission, unchanged exact comment body, open PR, exact base/head identity, same-repository head, non-protected head branch, protected-base opt-in, and a complete PR Files receipt matching livechanged_files.The organization sweep prefilters bot/untrusted-association comments before it fetches the live PR object or enters source-command validation. This prevents an outsider comment from consuming live PR validation resources or turning an unrelated PR-fetch failure into source-repair scheduler failure. Trusted candidates still receive the complete live authority checks above.
The agent may modify only safe current-PR paths from that receipt.
.github/,scripts/ci/,.git/, removed files and malformed/traversal paths are excluded. Workspace verification,git diff --check, changed-Python compilation, changed-YAML/YML parsing, final authority/scope revalidation, and exact live-head comparison all precede a normal commit/push. Force-push, self-approval, merge and branch-protection changes are absent.RED → repair evidence
Initial RED
eadca7f4a4eb8331db75fe5bd56d87dd29252b55proved that addingfix/repairlanguage to the current review-only mention did not create a source writer.After ordinary reconciliation to protected
main@828eaaefb0cc97bba4da63eb9270447476d26710, REDa03d372a0bc77bd0b951151df1e99a63a41835d4required changed YAML/YML syntax validation before publication; GREEN158511750c76d8ef729c1d8f34c0781bd21c6e21added the runner-side Ruby/Psych parse and599b01208cdc0b5f5f93a134672862a9c8b065f6made the operational documentation code-current.A second semantic RED
00fcf48b8f99c635df7efe274eba05c171318046locked the intended boundary that review-agent handles stay review-only and only a dedicated mutation command can authorize writes. GREEN1f8687dcc0e3a04cd9cc3b22ce55456454b3c43dimplemented@cwl-source-fixas that command;39426d9fd07e3a9a8a5936b164c80b6069727763updated the operational contract.Later sweep hardening added trusted-human prefiltering. Exact
651d9bb9f1b373da58f2fb89a072ab7312412765still had both quality workflows fail at their repository-suite/coverage stage. Independent source inspection found one remaining resource-admission defect: even when every recent comment was untrusted, the sweep fetched the live PR before skipping those comments.fa01c54e02fde2687573c8086cd7409d4be6be1bmoves live-PR fetch behind a non-empty trusted-comment set.95105a4833d0638a785c5e199bf151956207ff11strengthens the regression so an outsider-only candidate fails the test if any live-PR request is attempted, while also proving source-command parsing is never reached.This fixes the verified outsider-resource boundary; it does not claim the earlier hosted quality failure is fully settled until fresh exact-head workflows finish.
Current gate
Current exact head:
95105a4833d0638a785c5e199bf151956207ff11, basemain@828eaaefb0cc97bba4da63eb9270447476d26710, Open / Draft / mergeable.Fresh Agent Source Repair Quality, Agent Mention Router Quality, Security/SAST/Python Security and CodeQL workflows were created for this exact head and are currently queued. Queued work is non-passing. Keep Draft until terminal exact-head hosted checks, independent review, owned production docstring/test/edge-case coverage at 100%, normal protected integration, and a post-integration BandScope opt-in live model-to-commit canary. No consumer is enabled by this PR alone.