Repository navigation
fix(output): make ref pins shell-literal for agent allow-rules - #5097
Conversation
Agents paste the ref pin this CLI prints straight into a command line their host gates with an allow-rule. The old separator (`@e4~s434592`) is not a plain literal word: `~` is an EXTENDED_GLOB hazard in zsh and the matchers reject an unquoted word holding it, so a refused match ran the command sandboxed, where it cannot reach the daemon. The pin is now `@e4-s434592`. `REF_PIN_SEPARATOR`, `formatPinnedRef`, `splitRefGenerationSuffix` and `splitRecordedRefGenerationSuffix` own the form in the kernel. The retired `~s` spelling is accepted only where saved replay scripts and recorded refs are read.
Size Report
Startup median (7 runs, lower is better):
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Review completed against the latest diff
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 2 new findings on 38b3082. The verdict and the full list are in the summary comment.
|
At 38b3082, a second pinned ref in the retired form, as in These open threads still apply: second-ref guard, deleted warning tests, ADR grammar statement and duplicated ref pattern (not blocking). 11 lower-priority threads also still apply. This thread does not apply and can be resolved, because the current sample mapping and ref pattern already handle the Not blocking: take or leave these two notes: replay could strip the retired form from every ref argument, comma-sequence members included, once at the parse boundary, since Could All 22 checks pass at 38b3082. Not verified here: local runs of the tests and Before merge, the second-ref guard needs the fix and its regression test, and the warning-routing tests need to be restored. |
…arry it The second-key guard on press and click matched only the current separator, so `press @E13 @E14~s3` pressed one key and folded the other into a fallback label. The kernel now classifies a ref token (`isRefToken`) and names the fix for a retired pin (`retiredRefPinRefusal`); the touch-target, ref-positional and gesture entry points use them instead of restating the grammar.
Publication dropped a token such as `@-s3` before comparing it with the capture, so a malformed projection entry vanished and the rest still published. It now stays in the set and fails the projection check.
…pinned-ref spellings output-common.test.ts had lost the appendWarningLinesText, routeResponseWarnings and collapseWarningText cases, including the #2682 stderr-routing and jsonData-preservation ones. The two modules that must spell the kernel's pin grammar themselves (output-common.ts and output/error.ts) now each carry a test that binds their spelling to the kernel writer, and the ambiguity-candidate prefix no longer duplicates the grammar a second time in code. Tests build pins with formatPinnedRef, negative assertions match both separators, and the help-conformance pseudo-ref check reads a pin through the kernel parser.
|
Pushed bc2d80d. The second-key guard now classifies through the kernel owner ( |
…udgets A pattern that matched a ref-shaped token re-scanned its own digit run, so a long pinned token cost quadratic time on command input. The classifier now reuses the split readers and one anchored plain-ref test, with a long-token case that must finish fast. The retired-pin hint stays module-private, and the space-separated second-key refusal moves out of parseTouchTarget, clearing the Fallow unused-export and cognitive-complexity findings the guards report.
|
Head is now 33c638d. Both review points are in: the second-key guard classifies through the kernel owner ( Also fixed on the failing gate: the ref-token classifier no longer carries a pattern that re-scanned its own digit run (CodeQL polynomial-regex alert), now linear with a long adversarial-token test, and the two Fallow findings it reported (unused export, |
This comment has been minimized.
This comment has been minimized.
|
The code at 33c638d is ready. Not blocking, take it or leave it: the CANDIDATE_REF_PREFIX comment still names The two problems from the earlier review are fixed: a second ref in the retired form is refused again, with a regression test, and the warning tests are back. These threads no longer apply and can be resolved:
The second-argument guard of The Runner Build (tvOS + visionOS + watchOS) job failed, likely for an unrelated reason: its build steps passed, the failure came in the post-build teardown steps, and this PR changes no Swift, Xcode project, runner or workflow files. The other unit and check jobs pass. Not verified here: local test runs and the log of the failed job. Before merge, rerun that job and confirm that it passes. |
… comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
Follow-up tracking for the #5097 port to The port needs all four boundaries:
Validate the built/installed public API against the |
Summary
A ref pin this CLI prints is text an agent pastes straight into a shell command, and hosts such as Codex gate those commands with allow-rules whose matchers refuse an unquoted word holding a shell metacharacter.
~is one, and anEXTENDED_GLOBhazard in zsh. A refused match runs the pasted command in a sandbox that cannot reach the daemon or the device.The pin is now a plain literal word:
@e4-s434592.REF_PIN_SEPARATOR,formatPinnedRef,splitRefGenerationSuffixandsplitRecordedRefGenerationSuffixinpackages/kernel/src/snapshot.tsown the form; every producer routes through them. The retired~sspelling is accepted as input only where saved replay scripts and recorded refs are read; live CLI input rejects it. Help text, the skill, website docs, ADR 0014 (amended in place) andCONTEXT.mduse the new spelling.Scope expansion: two readers that split the pin by hand now use the kernel reader, so a token that is only a marker yields no ref body.
Before / after
formatPinnedRef('@e4', 434592)— base@e4~s434592, head@e4-s434592.splitRefGenerationSuffix('@e4~s3')— base{ base: '@e4', generation: 3 }, headnull.splitRecordedRefGenerationSuffix('@e4~s3')— head unchanged from base, so pre-change.adscripts still replay.Validation
Head
389c116f86.pnpm install --frozen-lockfile && pnpm build,typecheck,format,lintandcheck:replay-compatpass. Fullvitest --project unit-core: 2144 files, 20975 tests pass. The eager-closure budget test passes: the CLI facade closure stays at 19 modules. No device lane needed — no dispatch, capture or native-execution change.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.