Enforce agent CLI execution routing #572

Merged
weichen merged 24 commits from feature/agent-cli-enforcement into main 2026-10-15 21:15:46 +00:00
Owner

Why

Make implementation, repair, and testing use the configured Cursor, Antigravity, and PI CLI routes, with strict fresh-session review separation and no silent host fallback.

What

  • enforce one enabled Cursor/agy/PI profile per normal role and cap retries at three
  • allow one emergency Codex CLI attempt only after safe exhaustion
  • require real terminal records, fail-stop unknown external effects, and exact transport admission
  • document local HMAC as SELF integrity evidence, not GATE
  • use the stable Cursor entrypoint in the project configuration

Evidence

  • task card: .task/feature-agent-cli-enforcement.md
  • independent PI: 110 focused tests passed (1 skip); 472 governance tests passed (19 skips)
  • tool-written SELF: make test-governance passed at the final code candidate
  • independent Codex review: final delta had no actionable regression

Impact

Governance and agent-execution tooling only; no product code, submodule pin, migration, or deployment change.

## Why Make implementation, repair, and testing use the configured Cursor, Antigravity, and PI CLI routes, with strict fresh-session review separation and no silent host fallback. ## What - enforce one enabled Cursor/agy/PI profile per normal role and cap retries at three - allow one emergency Codex CLI attempt only after safe exhaustion - require real terminal records, fail-stop unknown external effects, and exact transport admission - document local HMAC as SELF integrity evidence, not GATE - use the stable Cursor entrypoint in the project configuration ## Evidence - task card: .task/feature-agent-cli-enforcement.md - independent PI: 110 focused tests passed (1 skip); 472 governance tests passed (19 skips) - tool-written SELF: make test-governance passed at the final code candidate - independent Codex review: final delta had no actionable regression ## Impact Governance and agent-execution tooling only; no product code, submodule pin, migration, or deployment change.
weichen added 23 commits 2026-10-15 21:06:08 +00:00
Why: establish the authorized task workspace and its initial baseline.

Evidence: preserved precheck receipt in .task/feature-agent-cli-enforcement.md; R0=04acb027f6678d9a7a1fbdd3cdacb105d8fbd3ee.

Impact: task metadata only; the feature workspace starts at 04acb027f6.

Refs: .task/feature-agent-cli-enforcement.md
Why: Routing needs an explicit per-profile attempt limit and a named Codex emergency profile before controller enforcement can be implemented.

Evidence: The new parser test failed on unknown keys before implementation; all 15 config test executions now pass and git diff --check is clean.

Impact: Adds backward-compatible optional configuration fields only; routing behavior is unchanged in this commit.

Refs: feature/agent-cli-enforcement
Why: The routing controller must retry each safe failed profile three times before advancing.

Evidence: The focused test fails with observed order retryme,thenok instead of three retryme attempts, proving current behavior lacks retries.

Impact: Adds a RED controller contract test only; production behavior is unchanged.

Refs: feature/agent-cli-enforcement
Why: Each non-Codex execution profile must receive three safe attempts before routing advances.

Evidence: The focused RED test observed one retryme launch before implementation; the controller and history suites now pass 31 executions.

Impact: Retries only unavailable and failed-clean outcomes; existing fail-stop statuses remain immediate.

Refs: feature/agent-cli-enforcement
Why: Codex CLI must run only after every regular profile exhausts its three safe attempts.

Evidence: The focused test records three regular failed-clean attempts and fails because no emergency Codex attempt is launched.

Impact: Adds a RED controller contract test and test helper support only.

Refs: feature/agent-cli-enforcement
Why: Codex CLI is permitted only after every normal execution profile exhausts three safe attempts, with no host implementation fallback.

Evidence: The emergency RED test lacked the fourth Codex attempt before implementation; 32 controller/history executions now pass.

Impact: Adds one emergency attempt for implementation, repair, and test roles while preserving fail-stop statuses and review isolation.

Refs: feature/agent-cli-enforcement
Why: Normal execution roles must exclude Codex while a single enabled Codex adapter remains available for emergency routing and review.

Evidence: Parser invalid-case tests were RED before validation; all 17 config tests and agent_exec validate now pass.

Impact: Enables three attempts per normal profile, stable Cursor routing, and a validated emergency Codex profile.

Refs: feature/agent-cli-enforcement
Why: Parser hardening requires the emergency fixture to use the real Codex adapter contract instead of a custom adapter.

Evidence: Agent-exec and config suites pass 58 executions with one opt-in probe skipped; validate and diff-check pass.

Impact: Test fixture only; production validation remains strict.

Refs: feature/agent-cli-enforcement
Why: Implementation changes must be mechanically tied to a successful CLI transport instead of relying on agents to follow prose.

Evidence: Admission tests went RED without apply/admit; 10 admission, 41 agent-exec, and 62 task tests now pass with exact staged-content matching.

Impact: Adds validated transport fast-forwarding and rejects unproven implementation commits while exempting task cards and approved plan/spec paths.

Refs: feature/agent-cli-enforcement
Why: Agents must use configured CLIs for implementation and testing, while remaining free to inspect, plan, test, and iterate within bounded scope.

Evidence: Task-card contract tests and the full 430-test governance discovery pass with 19 existing skips; diff-check passes.

Impact: Defines three safe attempts per normal CLI, one emergency Codex attempt, fail-stop terminals, and mandatory apply/admit integration.

Refs: feature/agent-cli-enforcement
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=bc5a1194984433c4098f1961f5280b3d9ee20995.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
Why: bind the task validation checkpoint to the integration baseline.

Evidence: SELF recursive component checks; sync_base=bc5a1194984433c4098f1961f5280b3d9ee20995; before_record=f0bcbe018dd07bd03371dae856f76bc1c2907fb1.

Impact: task metadata only.

Refs: .task/feature-agent-cli-enforcement.md
Why: Safe routing must not retry unproven cleanup, ignore worker fail-stop terminals, or lose out-of-scope rename sources.

Evidence: New tests were RED for each Review finding; 44 controller and admission tests now pass with diff-check clean.

Impact: Tightens safety classification and path inventory only; routing order and provenance contract remain unchanged.

Refs: independent Codex review of feature/agent-cli-enforcement
Why: Success-shaped receipts and caller-writable history must not authorize apply/admit without controller-originated provenance.

Evidence: Fabricated, unsigned, tampered-history, and moved-ref tests were RED before HMAC binding; 52 controller/history/admission tests now pass.

Impact: Stores a local 0600 attestation key, signs successful history including transport commit SHA, and verifies it before apply/admit.

Refs: independent Codex review of feature/agent-cli-enforcement
Why: The approved contract requires exactly three safe attempts for Cursor, agy, and PI, then one Codex emergency attempt, never host implementation authority.

Evidence: Routing/config tests were RED for never, max attempts, forbidden adapters, and legacy host fallback; 133 related tests now pass with one opt-in probe skipped.

Impact: Normal emergency-mode roles reject all non-Cursor/agy/PI adapters, project fallback is never, and Codex remains available through emergency/review paths.

Refs: independent Codex review of feature/agent-cli-enforcement
Why: Preserve the approved scope, actual CLI attempts, independent testing, and first-review remediation status.

Evidence: Task card names the exact sync/review objects and distinguishes direct CLI sessions from standard receipts.

Impact: Task metadata only; implementation behavior is unchanged.

Refs: feature/agent-cli-enforcement
Why: Emergency Codex fallback must not run before Cursor, Antigravity, and PI have each been exhausted.

Evidence: Cursor transport 5e6c93f765c232783a7dccb05544e26c386fb031; 29 config tests, focused emergency controller test, and 449 governance tests passed with 19 skips.

Impact: Emergency-mode implementation, repair, and test roles now require exactly one enabled profile for each normal adapter while preserving configured order.

Refs: .task/feature-agent-cli-enforcement.md
Why: The task card must identify the exact candidate, implementation agents, independent tests, and review closure before PR delivery.

Evidence: PI reported 110 focused tests and 472 governance tests passing at d3c28d5; independent Codex delta review found no actionable regression.

Impact: Task metadata only; product and governance behavior are unchanged.

Refs: .task/feature-agent-cli-enforcement.md
Why: Delivery policy requires the exact command output and tested object to be written by the evidence tool.

Evidence: make evidence recorded make test-governance at e288f001 with exit 0; 472 tests passed and 19 were skipped.

Impact: Task evidence only.

Refs: .task/feature-agent-cli-enforcement.md
Record final synchronization evidence
ci / svc-realcombo (pull_request) Successful in 1m54s
ci / test (pull_request) Successful in 5m48s
ci / test-pg (pull_request) Successful in 7m53s
cae058549e
Why: The PR candidate must carry a tool-written final task-sync receipt against the authoritative target.

Evidence: make evidence recorded make task-sync at 2fcb4c72 with sync base bc5a1194 and changed=0.

Impact: Task evidence only.

Refs: .task/feature-agent-cli-enforcement.md
weichen added 1 commit 2026-10-15 21:06:34 +00:00
Link the agent CLI delivery PR
ci / svc-realcombo (pull_request) Successful in 1m52s
ci / test (pull_request) Successful in 5m45s
ci / test-pg (pull_request) Successful in 7m56s
8228043998
Why: The task card and PR must reference the same primary delivery record.

Evidence: Gitea created PR #572 for feature/agent-cli-enforcement.

Impact: Task metadata only.

Refs: https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/572
weichen merged commit e8d3e61a38 into main 2026-10-15 21:15:46 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Dev#572