Skip to content

fix(watch-pr): keep runtime deps outside plugin cache and settle on repos with no CI - #314

Merged
mergify[bot] merged 7 commits into
mainfrom
fix/293-watch-pr-cache-and-no-ci
Dec 1, 2026
Merged

mergify[bot] merged 7 commits into
mainfrom
fix/293-watch-pr-cache-and-no-ci

Conversation

@ericlitman

Copy link
Copy Markdown
Owner

Closes #293
Closes #296

Started from davidrobertson's PR #294 (preserving original commits 80a734e and 27d7dd1).

Summary

 plugins/pstack/skills/poteto-mode/scripts/
 ├── bootstrap.ts
 │   - bun install --frozen-lockfile inside plugin directory (created node_modules/.bin/tsc symlink)
 │   + bun install --frozen-lockfile --production into hashed user cache (XDG_CACHE_HOME / LOCALAPPDATA / ~/.cache)
 │   + atomic staging + Bun.plugin commander loader in-process (no re-spawn, no plugin mutation)
 └── watch-pr/
     ├── types.ts, github.ts: distinguish null GraphQL statusCheckRollup ({ kind: "no-rollup" }) from unreadable contexts
     ├── policy.ts: --status-only settles immediately as no-checks; watch modes confirm once after one backoff
     └── render.ts: show "✅ no checks" when ci.source === "no-checks"
 .claude/skills/verify-open-pstack/
 └── features/recipes.ts, scripts/core.ts: add shipped-tools:watch-pr (runs installed watch-pr --help, verifies plugin unmutated + production-only cache, then runs startupHook in the same Codex install)

Evidence

Merge Danger

Door: two-way. Reverting restores the prior bootstrap.ts, watch-pr rollup handling, and verifier recipes. Existing plugin installations polluted by the old bootstrap recover on upgrade to a fresh versioned plugin cache directory or reinstall.

Blast Radius: narrow. Touches watch-pr bootstrap and check-rollup classification plus the new shipped-tools:watch-pr verifier feature.

Acceptance criteria

  • fix(pstack): keep runtime dependency installs out of plugin directory #293 (keep runtime dependencies out of plugin directory): watch-pr installs production dependencies in a per-user cache outside the plugin, loads commander in-process, leaves no node_modules in the plugin tree, and Codex startup hook still loads — verified in bootstrap.test.ts and codex:shipped-tools:watch-pr.
  • watch-pr treats a repo with no CI as a retryable error and never settles #296 (watch-pr settles on repos with no CI): Null GraphQL statusCheckRollup maps to { source: "no-checks", checks: [] }; --status-only exits 0 immediately (✅ no checks); watch modes do one confirming re-read before settling; real query failures stay retryable — verified in github.test.ts, policy.test.ts, and local CLI proof on octocat/Hello-World#11832.

Gate results

Run on head c473ae1c023cc633742a942f772ae9f0e4508e33:

Planned live gate (4 sessions, run from candidate head on pro14):

  • --self-test --feature codex:shipped-tools:watch-pr

Not verified

  • watch-pr treats a repo with no CI as a retryable error and never settles #296 authenticated GitHub GraphQL read inside the headless live gate: the verifier isolates GH_CONFIG_DIR with no GitHub credentials; verified via local CLI run against open PR octocat/Hello-World#11832 plus fake-gh and policy.test.ts unit tests.
  • Native Windows cache path (%LOCALAPPDATA%): verified by unit tests, not run on a Windows host.

@mergify

mergify Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 2 merge protections satisfied — ready to merge.

Show 2 satisfied protections

🟢 Queue ready pull requests

Automatically queue non-draft pull requests targeting main after verify and live-gate pass on the head and every review thread is resolved.

  • #review-threads-unresolved = 0
  • -draft
  • check-success=live-gate
  • check-success=verify

🟢 🚦 Auto-queue

When all merge protections are satisfied and these conditions match, this pull request will be queued automatically.

  • -files~=^\.github/
  • base = main

@ericlitman

Copy link
Copy Markdown
Owner Author

Live evidence: Open Pstack

  • Candidate SHA: c473ae1c023cc633742a942f772ae9f0e4508e33
  • Base SHA: faf512125b11f4a30f55c4eaf8a709a890668406
  • Result: FAILED — verification did not complete; rerun required
  • Self-test: required in both harnesses
  • Planned sessions: 4 (limit 12)
  • Publisher revision: c473ae1c023cc633742a942f772ae9f0e4508e33
  • Evidence-set SHA-256: b5501881411d3fd41a93b63ded4bf3b25ae0fef9a25d29b9e5048c4f7861453b
  • Policy: every new head requires a fresh run; this verifier does not change PR state, queue, or merge.

@ericlitman

Copy link
Copy Markdown
Owner Author

Live evidence: Open Pstack

  • Candidate SHA: 25fe7d469a3af47730f406ba01321c3926502f3b
  • Base SHA: faf512125b11f4a30f55c4eaf8a709a890668406
  • Result: FAILED — verification did not complete; rerun required
  • Self-test: required in both harnesses
  • Planned sessions: 4 (limit 12)
  • Publisher revision: 25fe7d469a3af47730f406ba01321c3926502f3b
  • Evidence-set SHA-256: 3d406eca28f6428464df5478467a76d4209e0b910fa83a3fd0879c36b3d5698b
  • Policy: every new head requires a fresh run; this verifier does not change PR state, queue, or merge.

@unfret-eal

unfret-eal Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

🛑 11 blocking findings

🔴 Critical · A workspace .env can redirect watch-pr to untrusted executable code

🔴 High · The watch-pr gate can pass without loading the installed skill

🔴 High · A shared cache can supply executable code to watch-pr

🔴 High · Missing required checks can be reported as merge-ready

🔴 High · The live gate certifies a production-only cache even with dev dependencies present

🟡 Medium · A push between reads can confirm the wrong head

🟡 Medium · The live recipe certifies an unchanged plugin after checking one path

🟡 Medium · A null rollup on a later page erases checks already read

🟡 Medium · A successful no-check read spends the query-error budget

🟡 Medium · A pending rollup seen during the same poll is ignored

🟡 Medium · Correctly shell-quoted install paths can fail the live gate

Walkthrough

This PR fixes two watch-pr problems. First, the dependency bootstrap no longer runs `bun install` inside the installed plugin, which used to leave a `node_modules/.bin/tsc` symlink that broke Codex hook trust. It now installs production-only dependencies into a per-user cache keyed by a hash of `package.json` and `bun.lock`, publishes that cache by atomic rename, and loads Commander in-process through a Bun plugin instead of re-spawning. Second, a head whose GraphQL `statusCheckRollup` is null is now read as "no checks" instead of a retryable query failure. `--status-only` settles right away with `✅ no checks`, and watch modes do one confirming re-read before reporting ready. The PR also adds a `shipped-tools:watch-pr` verifier recipe, routing for it, unit tests for the bootstrap and no-rollup paths, and upstream divergence notes. Review findings raise concerns about trusting cache and `.env` sources for executable code, merge-readiness when required checks are missing, edge cases in the confirmation logic, and how strong the new live-gate assertions are.

Area What changes Review notes
Dependency bootstrap `bootstrap.ts` installs `--production` dependencies into a hashed cache under `XDG_CACHE_HOME`, `LOCALAPPDATA`, or `~/.cache` using a staging directory and atomic rename. It reports an incomplete published cache without deleting it, and registers Commander through `Bun.plugin` instead of re-executing. Adds tests for cold, concurrent, and invalidated caches, relative or absent `XDG_CACHE_HOME`, and failed installs. A shared cache can supply executable code to watch-pr
A workspace .env can redirect watch-pr to untrusted executable code
No-CI rollup handling `RollupPage` and `CheckRead` gain `no-rollup` and `no-checks` variants. `resolveChecks` returns no checks when it sees a null rollup. The policy layer throws one `ChecksUnavailable` per PR head to force a confirming re-read, and `render` shows `✅ no checks`. Adds fake-gh and policy tests. Missing required checks can be reported as merge-ready
A push between reads can confirm the wrong head
A null rollup on a later page erases checks already read
A successful no-check read spends the query-error budget
A pending rollup seen during the same poll is ignored
Verifier recipe and routing Changes to bootstrap, watch-pr, `package.json`, and `bun.lock` now route to a new `shipped-tools:watch-pr` feature. That feature clears the tool cache, has the installed poteto-mode run `watch-pr --help`, checks plugin and cache state, and then runs the startup hook. The PR also updates the docs, the classifier tests, and adds a recipe-matching test. The watch-pr gate can pass without loading the installed skill
The live recipe certifies an unchanged plugin after checking one path
The live gate certifies a production-only cache even with dev dependencies present
Correctly shell-quoted install paths can fail the live gate
Advisories (1)
  • 🔵 Low · An absolute cache setting can still put dependencies inside the plugin · plugins/pstack/skills/poteto-mode/scripts/bootstrap.ts:25-32
    `dependencyCacheRoot` accepts any absolute `XDG_CACHE_HOME` without checking whether it is inside the plugin. With a per-checkout cache such as `$PWD/.cache` while running from the plugin root, the cold install still writes a dependency tree into the plugin. That violates #293's stated requirement to keep runtime dependency writes outside the plugin.
    Not blocking because: Only occurs if the user explicitly sets XDG_CACHE_HOME inside the plugin directory; normal user cache configurations stay outside the plugin.
Since the last review
  • New: The watch-pr gate can pass without loading the installed skill
  • New: A push between reads can confirm the wrong head
  • New: A shared cache can supply executable code to watch-pr
  • New: Missing required checks can be reported as merge-ready
  • New: The live recipe certifies an unchanged plugin after checking one path
  • New: A null rollup on a later page erases checks already read
  • New: A successful no-check read spends the query-error budget
  • New: A workspace .env can redirect watch-pr to untrusted executable code
  • New: The live gate certifies a production-only cache even with dev dependencies present
  • New: A pending rollup seen during the same poll is ignored
  • New: Correctly shell-quoted install paths can fail the live gate
Repair prompt

Read the Unfret check run for ericlitman/open-pstack#314 at head 98a89f81943c8a17e519af3fec3a8e59ea499ce9 (run panel:98a89f81943c8a17e519af3fec3a8e59ea499ce9:sbLtHmXdEvL:pIRHH0VxhPc, check). Use the check's App id and GET /repos/ericlitman/open-pstack/check-runs/142695951405; its output.text contains the structured result. Compare it with the current code and head, verify that each listed mandatory finding still applies, repair only those that do, honor the repository constraints, and validate the changes. Leave advisories and accepted risks alone. A manually resolved thread is not a waiver.

Details
Lane / stage Model Effort Outcome Duration
broad-gpt-5.6-sol-xhigh / review openai/gpt-6.2-sol → gpt-6.2-sol · primary xhigh succeeded 5 min 45 s
focal-gpt-5.6-sol-xhigh copy / review openai/gpt-6.2-sol → gpt-6.2-sol · primary xhigh succeeded 11 min 16 s
focal-gpt-5.6-sol-xhigh copy 2 / review openai/gpt-6.2-sol → gpt-6.2-sol · primary xhigh succeeded 11 min 29 s
judge / judge gemini-4-neon-low → gemini-4-neon · primary low succeeded 1 min 22 s

First review of this pull request.
3 reviewers finished.
Commit 98a89f8.
Check run.
Run: GET /unfret/run/panel:98a89f81943c8a17e519af3fec3a8e59ea499ce9:sbLtHmXdEvL:pIRHH0VxhPc.

@unfret review · @unfret status · @unfret help

@ericlitman

Copy link
Copy Markdown
Owner Author

Live evidence: Open Pstack

  • Candidate SHA: 98a89f81943c8a17e519af3fec3a8e59ea499ce9
  • Base SHA: faf512125b11f4a30f55c4eaf8a709a890668406
  • Result: PASSED — named features verified
  • Self-test: completed in both harnesses
  • Planned sessions: 4 (limit 12)
  • Publisher revision: 98a89f81943c8a17e519af3fec3a8e59ea499ce9
  • Evidence-set SHA-256: b6448000241a5ca7a8cb36ac1c6f5e123383740eaeb2b27ff39b8eb85fdfd453
  • Installation (claude): CLI 2.1.332 (Claude Code), plugin 1.21.0, candidate 98a89f81943c8a17e519af3fec3a8e59ea499ce9, tree 6e2bb1856c1f155175f3c9b279488c99686785d11cadc9ce076ab18077d9f46a.
  • Installation (codex): CLI codex-cli 0.172.0, plugin 1.21.0, candidate 98a89f81943c8a17e519af3fec3a8e59ea499ce9, tree 6e2bb1856c1f155175f3c9b279488c99686785d11cadc9ce076ab18077d9f46a.
  • Observation (claude / project-skill): surface claude -p stream-json with the candidate plugin-dir; action recipe project-skill: doctor; result passed: doctor:exit-0 doctor:skill-loaded doctor:doctor-ran doctor:doctor-canonical-pass; 4 assertions machine-checked; transcript SHA-256 fad4ca9c7a33ecfcf5d2a6dac4ee55559c0874caec9c6ba93550d7d3cb1501bb; artifact-set SHA-256 d71865910f3f89b02511ebc7b8427071eef98b4f1530d6cffb289d4620fbf31c.
  • Observation (codex / shipped-tools:watch-pr): surface codex exec --json with the run-owned candidate installation; action recipe shipped-tools:watch-pr: watch-pr, startup; result passed 7 assertions; ids retained privately; 7 assertions machine-checked; transcript SHA-256 44e4262aabe371832794ec87d96e65190d1a03a12649d924fbc1c5060ed388b2; artifact-set SHA-256 29788a52ee46e78526d321dc360c9d4b5eb5355e688b77b91f858ec21bf53440.
  • Observation (codex / project-skill): surface codex exec --json with the run-owned candidate installation; action recipe project-skill: doctor; result passed: doctor:exit-0 doctor:skill-loaded doctor:doctor-ran doctor:doctor-canonical-pass; 4 assertions machine-checked; transcript SHA-256 542cdce89b7b063ea73ec2b73c4a41ab7398b8786784f7ab6ce5fdc2645f0203; artifact-set SHA-256 50f6c21714729732368996b39dbff0b9f1a011045a402bab8be77abe8ab78a57.
  • Policy: every new head requires a fresh run; this verifier does not change PR state, queue, or merge.

@mergify

mergify Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into main as a362079 at 14:04 UTC

Less than a minute in the queue, with no time running CI.

So far

  • ✅ Entered the queue Tue 1 Dec, 14:03 · rule default · triggered by merge protections
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged 14:04 · a362079 · merge
8 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule Protect main
  • #review-threads-unresolved = 0 · required by Merge Protections rule Queue ready pull requests
  • -draft · required by Merge Protections rule Queue ready pull requests
  • check-success=live-gate · required by Merge Protections rule Queue ready pull requests
  • check-success=verify · required by Merge Protections rule Queue ready pull requests
  • any of · required by GitHub repository ruleset rule Protect main:
    • check-success = @github-actions/verify
    • check-neutral = @github-actions/verify
    • check-skipped = @github-actions/verify
  • any of · required by GitHub repository ruleset rule Protect main:
    • check-success = live-gate
    • check-neutral = live-gate
    • check-skipped = live-gate
  • any of · required by GitHub repository ruleset rule Review gate:
    • check-success = @mergify/Mergify Merge Protections
    • check-neutral = @mergify/Mergify Merge Protections
    • check-skipped = @mergify/Mergify Merge Protections

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Dec 1, 2026
@mergify
mergify Bot merged commit a362079 into main Dec 1, 2026
5 of 6 checks passed
@mergify mergify Bot removed the queued label Dec 1, 2026

@unfret-eal unfret-eal Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 11 blocking findings
🔴 Critical · A workspace .env can redirect watch-pr to untrusted executable code
🔴 High · The watch-pr gate can pass without loading the installed skill
🔴 High · A shared cache can supply executable code to watch-pr
🔴 High · Missing required checks can be reported as merge-ready
🔴 High · The live gate certifies a production-only cache even with dev dependencies present
🟡 Medium · A push between reads can confirm the wrong head
🟡 Medium · The live recipe certifies an unchanged plugin after checking one path
🟡 Medium · A null rollup on a later page erases checks already read
🟡 Medium · A successful no-check read spends the query-error budget
🟡 Medium · A pending rollup seen during the same poll is ignored
🟡 Medium · Correctly shell-quoted install paths can fail the live gate
Check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

watch-pr treats a repo with no CI as a retryable error and never settles fix(pstack): keep runtime dependency installs out of plugin directory

2 participants