fix(recovery): add Auto Guard gentle mode, npx verification, and user…
… override / Auto Guard 增加柔和模式、npx 识别和用户撤销
- Add AutoGuardLevel config (gentle/normal/strict) with gentle mode that only blocks deterministic high-risk ops (rm/sudo/chmod) after 5 retries and never escalates to Episode stop. Fixes #6844 #6876.
- Add npx to bashSegmentIsVerification (vitest/playwright/jest/eslint etc.) and commandFieldsKnownSafeMutation so test/build commands are not misclassified as destructive. Fixes #6834.
- Add RecoveryActionOverride so users can clear an episode stop and reset failure counts without switching modes. Fixes #6886.
- Remove tsx/ts-node from npx verification list (execution engines, not test runners).
Closes: #6834 #6876 #6844 #6886
Summary
-
Verification
-
Cache impact
Cache-impact: TODO Cache-guard: TODO System-prompt-review: N/A
For cache-sensitive changes, fill these lines before requesting review:
Cache-impact:none,low,medium, orhigh, plus the reason.Cache-guard: the focused guard test/command added or run, or why an existing guard covers the change.System-prompt-review: required reviewer/approval note when provider-visible system prompt, memory prefix, output style, or skill index behavior changes.
Part of this landed and part of it did not, so leaving it open — with an account of which is which, since a PR that is one-third merged and silent is worse than one that was never looked at.
Landed. 1522bac58 states it adapts the known-runner direction from here, and internal/evidence/evidence.go now classifies Mocha, AVA, ESLint, Prettier check mode and no-emit npx tsc as verification rather than mutation. Test and lint commands no longer trip the guard. That was the piece with a clear right answer, and it is in.
Not landed. AutoGuardLevel and RecoveryActionOverride do not exist in the tree. This PR is still the only proposal for either.
Those two are the harder half, and it is worth being explicit about why they did not get carried along: a gentle mode changes when the agent is allowed to keep going after repeated failure, and an override lets a user clear a stop the guard decided on. Both move a safety boundary rather than classify a command, so they need a decision about the boundary itself, not just a review of the diff.
What would help most is separating them. The npx work is gone from this branch's usefulness now, and AutoGuardLevel and RecoveryActionOverride are independent of each other — three things in one PR means the easy one gets taken and the other two wait on a conversation that never gets scheduled, which is exactly what happened here.
Thanks for it, and sorry it sat. The classification work is running in production.
Thank you @myipanta. #8053 records and credits all three directions from this PR. The useful npx-verification idea is already present on main-v2 in a narrower allowlist implementation from 1522bac58. The level and override design is not copied because current Auto Guard is now a fixed built-in boundary and the old branch lacks complete UI, persistence, and security-boundary coverage for that architecture.