fix(cli): honor verify unknown exit status - #649
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
PR SummaryLow Risk Overview
Adds unit tests for the renderer’s default vs override exit codes and an integration-style Reviewed by Cursor Bugbot for commit 9e4d1c5. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Codex review: needs real behavior proof before merge. Reviewed August 27, 2026, 11:26 PM ET / August 28, 2026, 03:26 UTC. ClawSweeper reviewWhat this changesThe PR makes Merge readiness⛔ Blocked until stronger real behavior proof is added - 3 items remain Keep open for normal maintainer review: the patch restores the documented Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe CLI flowchart LR
A[Verify CLI request] --> B[State verification tool]
B --> C{Tool error?}
C -->|Yes| D[Standard error output]
D --> E[Exit status 2]
C -->|No| F[Evaluate predicates]
F --> G[Exit 0, 1, or 2]
Decision needed
Why: This intentionally changes the observable status received by existing automation, even though it restores the documented ternary contract. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the narrow contract restoration after the required Swift checks pass, preserving the documented distinction between unevaluated state and an evaluated unsatisfied predicate. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source establishes the error-1 path, and the supplied signed baseline-versus-candidate CLI runs report the same failure changing from exit 1 to exit 2 in text and JSON modes. Is this the best way to solve the issue? Yes. A defaulted renderer parameter confines the exit-status override to AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 715caa24bbe1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
97419aa to
9e4d1c5
Compare
|
Merged in f46c055901c4 after verification of exact PR head The shared renderer still defaults to exit 1. Verification performed:
The full local CLI/provider/automation suites were intentionally not run against operator state; hosted macOS CI supplied the broader checks. The earlier bot's Linux/missing-submodule attempt did not exercise native behavior and is not counted as proof. No release or artifact publication was performed. |
Summary
Restore
verify's documented exit status 2 when its underlying state tool fails before it can evaluate predicates. The shared MCP CLI renderer keeps exit 1 by default; onlyverifyopts into exit 2. Evaluated satisfied/unsatisfied/unknown results retain their existing 0/1/2 handling.This PR is now independent of the unmerged browser/application-inventory stack and targets
main. Only the original verify fix, focused test hardening, documentation, and the two user-facing changelog entries are included.Root cause
VerifyCommandrendered an erroredverify_stateresponse throughMCPToolCommandOutput.output, which threw exit 1 before the command could apply its unknown=2 contract. This path dates to the original verify feature. A defaulted renderer parameter fixes the command boundary without changing other callers.The regression fixture deliberately avoids the real service container: it uses mocks, in-memory snapshots, an explicit temporary mutation store, and trapped configuration/provider access. It does not rely on HOME overrides to protect operator credentials.
Verification
pnpm run build:clipassed on both current main and the candidate.swift test --package-path Apps/CLI --no-parallel -Xswiftc -DPEEKABOO_SKIP_AUTOMATION --filter 'VerifyCommandTests|MCPToolCommandOutputTests'passed: 11 tests / 15 parameter cases. Optional automation tests were disabled, and live/automation flags were unset.pnpm run lint:docs, andgit diff --checkpassed.Live CLI proof
Built baseline and candidate binaries were copied to isolated proof paths, signed with the installed app's matching Developer ID, and signature-verified before execution. With
PROOF_BINselecting each signed build, these real subprocess commands were run:"$PROOF_BIN" verify --app Fixture --window-exists --stable-samples 0 --no-remote"$PROOF_BIN" verify --app Fixture --window-exists --stable-samples 0 --no-remote --jsonBoth formats return the same state-tool validation failure. Main exits 1; the candidate exits 2. JSON remains a standard error envelope with
success: false,data.isError: true, andVALIDATION_ERROR.A signed, nonactivating native fixture was also observed by exact PID/window ID. Both builds conservatively reported
unknown/exit 2 because unrelated running-process metadata was incomplete. Native satisfied/unsatisfied outcomes were not proved on this host. The existing installed GUI Bridge did not meet current runtime requirements; no user app was upgraded/restarted and no unrelated process was changed to bypass these limitations. The fixture preserved foreground application and cursor position at creation.The full local CLI/provider/automation suites were not run because of the documented shared-state initialization hazard; fresh hosted macOS CI is required before merge. No browser feature changes, release, or publication are part of this PR.