Repository navigation
Verify native patch policy with fixed local context (T19) - #263
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 #262
Sage task T19
This adds native evidence for Sage's existing patch checks. A disposable local fixture runs three actual CLI 0.160.0 apply_patch routes with fixed simulated responses: ordinary edit while off, protected-path edit while off, and a chief edit while on. Production policy and installed defaults are unchanged.
The ordinary edit writes exact contents and records a policy pass. The protected edit returns the exact packaged-policy denial with a matching session/turn/call receipt. The chief edit returns the production role denial before the fixture evaluator. Both denied cases leave no file. The protected target is outside the workspace, so native sandbox rules may also restrict it; missing files alone are not used as proof.
The opt-in fixture calls the packaged patchEditDecision with its own fixed local directory and protected root. This is not a general trusted execution-context producer. Issues #243 and #239 remain unfinished. All three native trials confirmed unchanged logbooks and complete process/profile cleanup.
Verification on 17086a7
npm run build:built 317 files.npm run check:all checks pass.tests 34; pass 34; fail 0.node scripts/probe-codex-patch.mjs, with no flag,--protected-target, and--chief: each passed once. Each made two fixed response requests and verified the actual native tool output, hook identity and file result. Cleanup: complete true, ownedHandlesClosed true, temporaryRootRemoved true.git diff --check: passed.tests 19; pass 19; fail 0.tests 34; pass 34; fail 0, plus all three native routes passed again on this exact head with complete cleanup.npm test:tests 1644; pass 1644; fail 0; cancelled 0; skipped 0(347.99 seconds). Exact-head CI run 39001423629 passed with the same 1,644 tests, zero failures, cancellations or skips.Tests used fake ps, pgrep and kill first on PATH. Initial fixture-only checks exposed a noncanonical temporary root and an omitted explicit chief boolean; these setup failures were corrected and retained separately. The lead caught missing evaluator composition before native execution. The generated-MCP test now invokes the real policy instead of merely checking a validator.
Evidence limits
Detached main cf557ea ran the 16 new diagnostic tests with only their helper and opt-in test fixture supplied:
tests 16; pass 16; fail 0. No production or generated modules were copied or changed.This is diagnostic coverage of existing behavior, not a production regression repair. The native responses are simulated, and the execution directory/root are fixed by the fixture. It does not prove real-model application, remote execution, arbitrary filesystem races, installed automatic Sage, or other native versions. Issue #88 remains open. Claude-owned work is untouched.