Skip to content

fix(verify): check harness logins before any install or GitHub write (#146) - #149

Merged
mergify[bot] merged 3 commits into
mainfrom
fix/146-verify-login-preflight
Oct 11, 2026
Merged

mergify[bot] merged 3 commits into
mainfrom
fix/146-verify-login-preflight

Conversation

@ericlitman

@ericlitman ericlitman commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Closes #146

Summary

 verify(pr)
   read PR, classify changed files, select features
+  if any harness is required
+    driver.preflight()          # parent doctor, required harnesses only
+      capability checks         # moved here from prepare()
+      claude auth status        # "loggedIn": true, or LoginRequired
+      codex login status        # probe CODEX_HOME with linked auth.json, exit 0, or LoginRequired
   try
     prepare()                   # installs
-      doctor()
     exercise()                  # native sessions
     publish comment + live-gate
   catch
     publish failure comment + live-gate=failure

A failed login now stops verify.sh run before the try block, so the run publishes nothing. The CLI prints the harness name and the fix on stderr. verify.sh doctor records the same login checks in doctor.json. doctor --candidate is unchanged.

Evidence

  • Before: on PR release: sync Cursor pstack 0.15.17 as Open Pstack 1.6.0 #145, an expired Claude login reached the first claude -p session. The verifier then posted a failed evidence comment and set live-gate=failure, although no feature had run.
  • After: the new verify.test.ts case runs the real MacDriver. Its stubbed claude auth status prints {"loggedIn": false} and exits 1, which is what Claude Code 2.1.289 does when logged out. Here is how that was observed:
    CLAUDE_CONFIG_DIR=<empty dir> claude auth status   -> "loggedIn": false, exit 1
    
    The test asserts that verify() rejects with the Claude fix message, that no comment or status was published, and that no git clone or codex plugin install command ran.
  • Live negative run on this head (3b965f2), real CLIs:
    CLAUDE_CONFIG_DIR=<empty dir> verify.sh run --pr 149 --feature claude:project-skill --feature codex:project-skill --self-test --output <fresh>
    stderr: Claude login check failed: `claude auth status` did not report "loggedIn": true; run `claude auth login` from a shell on this Mac, not over SSH
    exit=1; doctor.json result=blocked; PR 149 comments: 0; live-gate statuses on 3b965f2: 0
    
  • Live positive doctor, real logins: verify.sh doctor exit 0; claude login: logged in; the Codex check passed (exit 0) through the probe home; the probe .codex was removed; the account email appears 0 times in doctor.json.
  • Live gate: see the live-gate comment for this head.

Merge Danger

Door: two-way. The change is verifier tooling only, so a revert restores the old order.

Blast Radius: verifier

The change affects only .claude/skills/verify-open-pstack/, which does not ship in the plugin. If a login check misfires, it blocks a live-gate run before it publishes anything. It cannot publish a wrong live-gate.

Acceptance criteria

  • "Before any candidate install, harness session, or GitHub write, verify.sh run checks the login of each harness that has a named feature, --self-test included."
    • verify.ts calls driver.preflight when requiredHarnesses(receipt) is non-empty, before the publishing try.
    • GitHub reads (PR and changed files) still come first, because classification decides which harnesses to check. The design pass on verify.sh run: check harness logins before any install or GitHub write #146 records that this is "no GitHub write".
    • Verified by verify.test.ts: "a logged-out Claude stops the real driver before any install or GitHub write", and the ordering assertion preflight < prepare.
  • "The check runs with the same environment the candidate sessions get." Both checks use isolatedEnv(probe-home), which keeps the real HOME, USER and LOGNAME and the normal operator config. The doctor test asserts HOME.
  • "A failed check exits nonzero with a message that names the harness and the fix … It publishes no comment and no status." LoginRequired is printed to stderr by cli.ts. doctor.test.ts covers four failures: logged out, loggedIn:false with exit 0, malformed output, and a Codex nonzero exit.
  • "verify.sh doctor reports the same login checks in doctor.json. Candidate-mode doctor stays as it is."
    • Parent mode records claude login and codex login.
    • The test asserts that the account email does not appear in doctor.json.
    • "candidate doctor is capabilities-only" keeps its assertion that candidate mode makes no auth, login or status calls.
  • "The checks read only the login state the CLIs report." The code calls only claude auth status and codex login status. linkCodexAuth creates a symlink and never reads the file. The doctor test asserts that the operator's auth.json bytes are unchanged and that the probe .codex is removed.
  • "A unit test proves a logged-out Claude stops run before any GitHub call. The live gate runs project-skill in both harnesses (--self-test)." The test is above. The live gate runs --feature claude:project-skill --feature codex:project-skill --self-test from this head's checkout, so the publisher revision equals the candidate SHA.

Gate results

On e231949, which fixes the Linux CI failure of the new test and records codex login: logged in (codex login status prints on stderr): the same checks, plus the verifier suite replayed with process.platform forced to linux, all exited 0 (112 pass, 0 fail each). Earlier, on 3b965f2: install, Bun tests, strict typecheck, manifest parse, static invariants (PSTACK_STATIC_ONLY=1 bash tests/skill-collision-repro.sh), claude plugin validate plugins/pstack, and the verifier's own bun run test and bun run typecheck all exited 0. The verifier suite ran 112 pass, 0 fail.

Not verified

  • The real codex login status with a logged-out Codex. It was not run against the operator account, because that would mean logging out. With an empty CODEX_HOME it prints "Not logged in" and exits 1, and the check treats any nonzero exit as a failure.
  • A rare failure in harness.test.ts ("prepare pins local Git candidate"). Across all runs on this branch it failed about 1% of the time, with two symptoms: a sessions mismatch, and prepare throwing before state/claude exists, which the test's finally then masks. A 150-run loop had 1 real failure (run 113). Its other failure, run 36, was the loop reading a mid-edit tree. main had 0 failures in 80 runs, which is too few to show the flake is new. I found no code path from this change to that test.

🤖 Generated with Claude Code

@mergify

mergify Bot commented Oct 11, 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, Unfret, and live-gate pass on the head.

  • -draft
  • check-success=Unfret
  • 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

…record the Codex login result (#146)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[High impact] Adds harness login verification before any installation or GitHub writes.

Fix the new real-driver test's platform setup before merging so the verifier suite still passes on Linux.

Findings

  1. P1 New test fails on Linux ▶

Summary

This PR checks required harness logins before installing the candidate or writing to GitHub.

  • The verifier checks required harness logins before it installs candidates.

Acknowledged by ericlitman: the rare session assertion failure remains under investigation; further repeated-suite checks were in progress.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read PR and changed files] --> B[Select required harnesses]
  B --> C{Any harness required?}
  C -->|Yes| D[Check capabilities and logins]
  D -->|Fail| E[Print fix and stop without GitHub writes]
  D -->|Pass| F[Recheck PR and install candidate]
  F --> G[Run named features]
  G --> H[Clean up and check evidence]
  H --> I[Publish comment and live-gate]
  C -->|No| H
Loading

Reviews (1) · Last reviewed commit: "fix(verify): check harness logins before..." · Reviewed by Greptile

Comment on lines +79 to +80
f.options.driver = new MacDriver(run, async () => { throw new Error('no session expected'); });
await expect(verify(f.options)).rejects.toThrow('Claude login check failed: `claude auth status` did not report "loggedIn": true; run `claude auth login` from a shell on this Mac, not over SSH');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 New test fails on Linux

MacDriver.preflight() passes the real process.platform to doctor(), which rejects Linux before running the mocked Claude login command. This test therefore gets “Live gate requires an operator Mac” instead of the expected login error, breaking bun run test on Linux. Set and restore process.platform for this test, as the existing driver tests do, or inject the platform.

@unfret-eal

unfret-eal Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

✅ No blocking findings

Walkthrough

This PR makes the verifier check that the Claude and Codex harnesses are logged in before it installs anything, runs any session, or writes to GitHub. Previously an expired login only surfaced at the first live session, which then posted a misleading failure comment and set `live-gate=failure`. Now `verify.sh run` calls a new `driver.preflight()` (parent doctor, limited to the required harnesses) outside the publishing `try` block. A failed `claude auth status` or `codex login status` throws `LoginRequired`, prints the fix on stderr, and publishes nothing. `verify.sh doctor` records the same login results in `doctor.json`, and candidate-mode doctor stays capabilities-only. The PR adds tests for the ordering, the four login-failure shapes, and the real `MacDriver` stopping on a logged-out Claude. The author reports live runs on the head; the blank Codex login record and the real logged-out Codex path are listed as not verified.

Area What changes
Run ordering `verify()` calls `driver.preflight()` after classification and before the publishing `try`, whenever any harness is required. The doctor call moves out of `MacDriver.prepare()` into `preflight()`, and the `Driver` interface gains `preflight`.
Doctor login checks Parent doctor parses `claude auth status` for `loggedIn: true`. For Codex, it runs `codex login status` with a probe `CODEX_HOME` whose `auth.json` is symlinked to the operator's file, then removes the probe. Failures throw `LoginRequired` with a harness-specific fix and record `blocked` in `doctor.json`.
CLI and docs `cli.ts` prints the `LoginRequired` message to stderr. SKILL.md describes the login checks and the no-publish-on-failure behavior.
Tests The PR adds doctor tests for the pass and failure cases, including email redaction and auth.json bytes left unchanged. It adds a verify test that drives the real `MacDriver` with a stubbed logged-out Claude, plus a preflight-before-prepare ordering assertion. Existing fixtures are updated for the new driver method.
Advisories (1)
  • 🔵 Low · Interrupt during login probe is reported as a login failure · .claude/skills/verify-open-pstack/scripts/doctor.ts:31-38
    Line 31 uses `catch {}`, which swallows every rejection from `claude auth status`. That includes the rejection when SIGINT or SIGTERM arrives and cli.ts `interruptCommands` kills the child. `loggedIn` then stays undefined and a `LoginRequired` is thrown. The Codex block on line 38 has the same problem: its bare `catch` turns an aborted `codex login status` (or any other error) into `LoginRequired`. Trigger: the operator or the agent harness interrupts `verify.sh run` or `verify.sh doctor` while a status probe is running. Result: cli.ts prints "Claude login check failed … run `claude auth login` from a shell on this Mac" (or the Codex fix) to stderr. failure.json and doctor.json record that as the reason, although the login is valid and the run was simply interrupted. The exit code stays 130/143, which limits the impact.
    Not blocking because: Cancellation is mislabeled in stderr and private failure reports, but signal exit codes remain 130/143 and preflight stops before installation or publication. The defect changes diagnostic guidance, not the gate outcome.
Details
Lane / stage Model Effort Outcome Duration
broad-gpt-5.6-sol-xhigh / review openai/gpt-5.6-sol → gpt-5.6-sol · primary xhigh succeeded 1 min 52 s
broad-opus-5.5-max / review anthropic/claude-opus-5-5 → claude-opus-5-5 · primary max succeeded 6 min 27 s
focal-gpt-5.6-sol-xhigh copy / review openai/gpt-6.1-sol → gpt-6.1-sol · primary xhigh succeeded 6 min 55 s
focal-gpt-5.6-sol-xhigh copy 2 / review openai/gpt-6.1-sol → gpt-6.1-sol · primary xhigh succeeded 4 min 52 s
judge / judge openai/gpt-6-astra → gpt-6-astra · primary high succeeded 15 s

First review of this pull request.
4 reviewers finished.
Commit e231949.
Check run.
Run: GET /unfret/run/panel:e2319490d1fa95544afedfd75aee7d26a0bff9f7:7HfEWzXDVpE:AJR_MdsW3vw.

@unfret review · @unfret status · @unfret help

@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.

✅ No blocking findings
Check

@ericlitman

Copy link
Copy Markdown
Owner Author

Live evidence: Open Pstack

  • Candidate SHA: e2319490d1fa95544afedfd75aee7d26a0bff9f7
  • Base SHA: 63bc64370ac52498212a3ab774c90f6fabbf7e87
  • Result: PASSED — named features verified
  • Self-test: completed in both harnesses
  • Publisher revision: e2319490d1fa95544afedfd75aee7d26a0bff9f7
  • Evidence-set SHA-256: 43b00ada2d1f8801fa6b765caeebf5fe154953191b713cb3f008362723a9bf6d
  • Installation (claude): CLI 2.1.289 (Claude Code), plugin 1.6.1, candidate e2319490d1fa95544afedfd75aee7d26a0bff9f7, tree f09cd33efe59460bb638f2c59edad321ee185f824b1c989592d13110bed0ae8d.
  • Installation (codex): CLI codex-cli 0.159.0, plugin 1.6.1, candidate e2319490d1fa95544afedfd75aee7d26a0bff9f7, tree f09cd33efe59460bb638f2c59edad321ee185f824b1c989592d13110bed0ae8d.
  • 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 103ed6e58771546f07f87f6086b01b410136a4be1ea3a302dceb869daa18542c; artifact-set SHA-256 c31d1086568245685feb158ccc45cde6595df0109c2ed3d86cc6d4a9492e9303.
  • 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 6f66e6d887e33929046877da2fe110c512c508e5d1866aa121a52a55d2a9fcc2; artifact-set SHA-256 f96bdfcf342d1d3911479370588526ce79635f11ac6d1ba1ed1b239626212a2f.
  • Policy: every new head requires a fresh run; this verifier does not change PR state, queue, or merge.

@mergify

mergify Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-11 19:57 UTC · Rule: default · triggered by merge protections
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-11 19:59 UTC · at 0e2a3ffed00f93b27afbcd9f3852197a1fb3d63f · merge

This pull request spent 2 minutes in the queue, including 1 minute 48 seconds running CI.

Required conditions to merge

@mergify mergify Bot added the queued label Oct 11, 2026
@ericlitman

Copy link
Copy Markdown
Owner Author

Live evidence: Open Pstack

  • Candidate SHA: bafef275db958acdd60107b6c4e21b4b50f0d9fd
  • Base SHA: 1bd40eaae7554aa4d9935044536e4a0188a15c06
  • Result: PASSED — named features verified
  • Self-test: completed in both harnesses
  • Publisher revision: bafef275db958acdd60107b6c4e21b4b50f0d9fd
  • Evidence-set SHA-256: 4fe005876a8c1969d4231505b5743e2f132314565559ccc55d7b2662b900ae8c
  • Installation (claude): CLI 2.1.289 (Claude Code), plugin 1.6.1, candidate bafef275db958acdd60107b6c4e21b4b50f0d9fd, tree 4e6aa25ce884caddb001d451e899e86c8f4f13a4cdb50c2a055971c964d0657b.
  • Installation (codex): CLI codex-cli 0.159.0, plugin 1.6.1, candidate bafef275db958acdd60107b6c4e21b4b50f0d9fd, tree 4e6aa25ce884caddb001d451e899e86c8f4f13a4cdb50c2a055971c964d0657b.
  • 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 f235b13020c8adedcf4fba83f252584a7b84fe5b81160c2e5724958c023e0fe3; artifact-set SHA-256 059833e5a50fb9d83a50e379a3ca8b0bb17dc80132c8b3605f14463c84a67392.
  • 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 6347cc7103692f28410de7573402a39a527b593ad10f3d1daae2c4c33dd11197; artifact-set SHA-256 ea20fde57d17a765b71f7110fb04aa91b8e98df452a25d3694b1af5a77ed0db9.
  • Policy: every new head requires a fresh run; this verifier does not change PR state, queue, or merge.

@mergify
mergify Bot merged commit 0e2a3ff into main Oct 11, 2026
5 checks passed
@mergify mergify Bot removed the queued label Oct 11, 2026
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.

verify.sh run: check harness logins before any install or GitHub write

1 participant