You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix Grok read-only cancellation and preserve runner failure evidence #78
A Grok read-only review on Open Pstack 1.4.1 ended with a tool permission cancellation, but the runner reported malformed-output and erased the provider model/session/usage evidence.
The CLI completed two model calls using grok-4.6-build, then a headless plan-mode permission request for a compound git diff command was cancelled. The CLI exited 0 with a failure result. parseGrok throws a generic error for that valid terminal result; executeLane treats it as malformed output. Its evidence keeps the first 4,000 characters of stderr followed by stdout, so startup warnings hide the actual failure.
A deterministic CLI replay with a valid cancelled terminal event and more than 4,000 stderr characters reproduces wrapper exit 65, status malformed-output, reportedModel null, and loss of the cancellation reason.
The live review retry completed with grok-4.6-build using only read_file,grep,list_dir while retaining plan mode and the read-only sandbox.
Proposed fix:
Use file-only tools for Grok read-only lanes; retain shell in isolated-write lanes.
Distinguish provider failure/cancellation from malformed output and preserve reason/model/session/usage.
Save separate complete stdout/stderr artifacts safely and identify them in the receipt.
Add regression coverage for warning-heavy cancellation, malformed output, and artifact collisions.
Related to #34, but this does not change isolated-write permission policy or use bypassPermissions.
Live worktree launcher proof in a throwaway Git repo: Grok 4.7 high reader used read_file, returned cobalt, and recorded exit 0 / complete with grok-4.7-build. Grok 4.7 high writer used write, search_replace, git add, and git commit, with allow decisions in events.jsonl; commit 52350acc1c2da111bb1360c42256109a28d713fc contains both requested files. Codex GPT-6 Sol high isolated writer created and read back a new file, exit 0 / complete. Bun tests: 162 passed, 0 failed. Strict typecheck, static invariants, and plugin validation passed.
The installed plugin was not changed. This branch addresses the read-only tool policy and live lane proof; the broader output-artifact work in this issue remains open. No PR was opened.
Operator live test for MASTRA-751 (mobilyze-llc/factory#92, deployed 269bdfe): this comment on a Delivery card in Plan review should create no Factory triage proposal or run. No action needed.
These defects are still present on main, and the plan's design for them can stay:
parseGrok throws a generic grok reported an error result for a valid terminal failure (parse-output.ts:103). The runner then classifies the run as malformed-output/65 and loses the model, session and usage.
A nonzero child exit skips parsing.
Keep Phases 3 and 4: the typed provider-result error, cancelled/130 and child-failed/70, metadata retention, and collision-safe stdout/stderr sidecars. Keep Phase 5's acceptance evidence.
Build conditions for the revised plan
Base the branch on current main.
Do not change Grok permission mode, sandbox or tool lists.
Add no new receipt status and no schema bump unless the plan lists it under Open questions for the maintainer.
Add no implicit timeout and no weaker-model fallback.
Live gate: install the exact candidate and reproduce a Grok terminal failure, or a cancellation where one is still reachable, from both a Claude Code parent and a Codex parent. The receipt must show the right status, the exact reason and the provider model.
The plan records which part of the evidence finding trailingEvidence already covers.
The scope matches the issue's own proposal: typed provider terminal failures (130 or 70), parsing before an ordinary nonzero exit, metadata and exact-reason retention, and complete stdout/stderr sidecars.
The receipt change is additive only: no new status and no schema bump.
Phase 1 rebuilt the baseline on main. Four focused reproductions fail and 159 tests pass, which replaces the stale 36/11 figure.
The live gate needs a real Grok terminal failure from both parents, and a blocked environment is reported, not simulated.
Sidecar redaction. The Risks line "redact public evidence" adds no redaction code to the runner. Sidecars and receipts are local files with private permissions. Anything published, such as PR evidence, quotes only what the operator chooses.
Checks. Before opening the PR, run the acceptance commands in a Bun-enabled environment and report each exit status. If the build host lacks Bun, fix the host. Don't skip the checks.
Implemented the revised #78 plan approved at plan-review revision 10. Factory remains in Build at revision 13 after PR linkage; no merge or stage transition was performed.
Branch: factory/issue-78, based on current main at be66d68.
Valid provider cancellations return cancelled/130; other well-formed provider failures return child-failed/70, including ordinary nonzero child exits. Invalid/incomplete terminal output remains malformed-output/65. Provider reason, model/session/usage/cost, and child exit code are retained. Launcher cancellation and timeout precedence and strict successful-model verification are preserved.
Complete raw streams are saved in exclusively reserved 0600<receipt>.stdout and <receipt>.stderr sidecars, with collision rejection, rollback, partial-write handling, descriptor cleanup, and storage-error termination. Receipts remain schema version 1 with nullable stream-path fields. Grok permissions/sandbox/tool lists are unchanged; #117 owns that policy.
Actual verification at pushed HEAD
Bun 1.4.0, from plugins/pstack/skills/poteto-mode/scripts:
bun install --frozen-lockfile: exit 0.
bun test runner/commands.test.ts runner/parse-output.test.ts runner/run.test.ts: 62 pass, 0 fail, 341 assertions.
bun run test: 179 pass, 0 fail, 835 assertions across 11 files.
bun run typecheck: exit 0.
Repository root:
Bun JSON parsing of .claude-plugin/marketplace.json, .agents/plugins/marketplace.json, plugins/pstack/.claude-plugin/plugin.json, and plugins/pstack/.codex-plugin/plugin.json: exit 0.
Local automated logs: /tmp/issue78-green.log, /tmp/issue78-manifests.log, /tmp/issue78-static.log. They are local artifacts, not public evidence links.
Assumptions and remaining evidence
Added nullable receipt fields are additive within the approved schema-version-1 contract; no new status or schema bump was introduced.
Exact-candidate installed live Grok failure checks from both Claude Code and Codex are not run: none of claude, codex, or grok is available in this sandbox. Fake CLI tests are not live evidence. Before merge, an authenticated operator must install this exact head in both parents, reproduce a terminal failure/cancellation, verify receipt status/exact reason/provider model and private sidecars, and publish a successful exact-head live-gate status linking operator-selected evidence. Every new head needs fresh live evidence.
Open questions: none about implementation; the installed live gate is the remaining operator-environment blocker. PR remains draft, with no merge/release/rollout request.
Activity
smashru commentedon Sep 24, 2026
Reader tool-policy candidate: https://github.com/smashru/open-pstack/tree/fix/grok-lanes-headless at
88dd41d, stacked on the #84 branch. The final diff removesrun_terminal_cmdfrom Grok read-only tools. It leaves terminal and file edit tools available to isolated writers.Live worktree launcher proof in a throwaway Git repo: Grok 4.7 high reader used
read_file, returnedcobalt, and recorded exit 0 / complete withgrok-4.7-build. Grok 4.7 high writer usedwrite,search_replace,git add, andgit commit, with allow decisions inevents.jsonl; commit52350acc1c2da111bb1360c42256109a28d713fccontains both requested files. Codex GPT-6 Sol high isolated writer created and read back a new file, exit 0 / complete. Bun tests: 162 passed, 0 failed. Strict typecheck, static invariants, and plugin validation passed.The installed plugin was not changed. This branch addresses the read-only tool policy and live lane proof; the broader output-artifact work in this issue remains open. No PR was opened.
ericlitman commentedon Oct 1, 2026
Prior art: #79, #81, and smashru's branch noted above. Planned as one PR with #34.
ericlitman commentedon Oct 2, 2026
Operator live test for MASTRA-751 (mobilyze-llc/factory#92, deployed 269bdfe): this comment on a Delivery card in Plan review should create no Factory triage proposal or run. No action needed.
ericlitman commentedon Oct 4, 2026
Factory plan verdict: revise
aebdac57, plan-review revision 7.60c5bd2fand34049ccf, posted 2026-09-23 against release commitde67e6b.gpt-5.6-sol, from the plan session's message metadata.Why revise
The plan predates PR #116, which merged on 2026-10-03. Two checklist gates fail on current
main(be66d68).read-onlytoread_file,grep,list_dir."--permission-mode auto, so a blocked call goes back to the model instead of cancelling the turn.run_terminal_cmdstays in the read-only tool list (commands.ts:53-55, comment atcommands.ts:131-133).grokToolsand--permission-modeunchanged. Put the tool-list question under Out of scope with a pointer to Monitor Grok lanes in auto permission mode after #116 and decide keep, tighten or loosen #117. Also replace the Out-of-scope line about "issue Grok isolated-write lanes cancel headless edit permissions #34's isolated-write permission policy": Grok isolated-write lanes cancel headless edit permissions #34 is closed and fix(runner): run headless Grok lanes in auto permission mode and keep the terminal error in receipts #116 owns that policy now.parse-output.ts:87-106andrun.ts:768-845,23,51-52onde67e6b.mainnow keeps the tail of malformed-output evidence (trailingEvidence,run.ts:55,847). That change covers part of Finding 3.main. State which part of Finding 3 is still open aftertrailingEvidence. Use fix(runner): preserve Grok cancellation evidence and restrict read-only tools #79 only as prior art. Recompute the Phase 1 pre-fix baseline (the stated "36 pass, 11 fail") onmain.What still holds
These defects are still present on
main, and the plan's design for them can stay:parseGrokthrows a genericgrok reported an error resultfor a valid terminal failure (parse-output.ts:103). The runner then classifies the run asmalformed-output/65 and loses the model, session and usage.Keep Phases 3 and 4: the typed provider-result error, cancelled/130 and child-failed/70, metadata retention, and collision-safe stdout/stderr sidecars. Keep Phase 5's acceptance evidence.
Build conditions for the revised plan
main.ericlitman commentedon Oct 4, 2026
Factory plan verdict: approve
aebdac57, plan-review revision 10.gpt-6.1-sol, from the plan session's message metadata.Why approve
Every gate passes, and Open questions is
None.commands.tsstays unchanged. Monitor Grok lanes in auto permission mode after #116 and decide keep, tighten or loosen #117 owns that policy.be66d68, and fix(runner): preserve Grok cancellation evidence and restrict read-only tools #79 is prior art only.trailingEvidencealready covers.main. Four focused reproductions fail and 159 tests pass, which replaces the stale 36/11 figure.Build conditions
runner/run.test.ts, and it is replacing the launcher with a POSIXshscript plus a TS entry file.docs: explain retained provider failure evidence (#78)
mast-factory commentedon Oct 4, 2026
Build handoff
Implemented the revised #78 plan approved at plan-review revision 10. Factory remains in Build at revision 13 after PR linkage; no merge or stage transition was performed.
factory/issue-78, based on currentmainatbe66d68.21e134ffd993ab4f1952382dd1c2717e51b3c3cf.main).72019f4: failing regression checkpoint.bdd51f6: typed Grok failures and retained metadata.19d6d5b: collision-safe complete private stream artifacts and regression coverage.21e134f: provider-dispatch contract documentation.Implemented contract
Valid provider cancellations return
cancelled/130; other well-formed provider failures returnchild-failed/70, including ordinary nonzero child exits. Invalid/incomplete terminal output remainsmalformed-output/65. Provider reason, model/session/usage/cost, and child exit code are retained. Launcher cancellation and timeout precedence and strict successful-model verification are preserved.Complete raw streams are saved in exclusively reserved
0600<receipt>.stdoutand<receipt>.stderrsidecars, with collision rejection, rollback, partial-write handling, descriptor cleanup, and storage-error termination. Receipts remain schema version 1 with nullable stream-path fields. Grok permissions/sandbox/tool lists are unchanged; #117 owns that policy.Actual verification at pushed HEAD
Bun 1.4.0, from
plugins/pstack/skills/poteto-mode/scripts:bun install --frozen-lockfile: exit 0.bun test runner/commands.test.ts runner/parse-output.test.ts runner/run.test.ts: 62 pass, 0 fail, 341 assertions.bun run test: 179 pass, 0 fail, 835 assertions across 11 files.bun run typecheck: exit 0.Repository root:
.claude-plugin/marketplace.json,.agents/plugins/marketplace.json,plugins/pstack/.claude-plugin/plugin.json, andplugins/pstack/.codex-plugin/plugin.json: exit 0.PSTACK_STATIC_ONLY=1 bash tests/skill-collision-repro.sh: exit 0.git diff --check origin/main...HEAD: exit 0.commands.ts/commands.test.ts: empty.Local automated logs:
/tmp/issue78-green.log,/tmp/issue78-manifests.log,/tmp/issue78-static.log. They are local artifacts, not public evidence links.Assumptions and remaining evidence
0be4b216a5c037642cc44b6313a8b01a056967a4. PR Preserve Grok terminal failures and complete runner evidence [#78] #126 explicitly records the sharedrun.test.tscoordination: whichever lands second must rebase in place and rerun acceptance without rewriting Prevent project startup configuration from overriding runner authentication [#25] #113's tests.claude,codex, orgrokis available in this sandbox. Fake CLI tests are not live evidence. Before merge, an authenticated operator must install this exact head in both parents, reproduce a terminal failure/cancellation, verify receipt status/exact reason/provider model and private sidecars, and publish a successful exact-headlive-gatestatus linking operator-selected evidence. Every new head needs fresh live evidence.Findings
None
fix: preserve nonzero Grok dropout classification (#78)
Merge pull request #126 from ericlitman/factory/issue-78
test: pin remaining Grok terminal evidence defects (ericlitman#78)
fix: retain Grok terminal failure classification and metadata (ericli…
fix: preserve complete private runner streams on failures (ericlitman#78
Merge upstream main after 1.5.0 into the local build
Name nested Seatbelt for Kimi and keep runner tests hermetic
merge: sync upstream Open Pstack 1.6.0 (Cursor pstack 0.15.17) as 1.6…