Repository navigation
fix(session-handoff): write Open PRs only on a git-attached (developer-mode) checkout - #5385
Conversation
Every install queried sonichi/sutando's open PRs into session-state.md, so a regular owner's agent could raise Sutando repo PRs nobody asked about. The packaged engine ships without .git; developer mode git-attaches the checkout. Gate the section on that existing signal ($REPO/.git, as _repo_ok and sutando-config.sh already use). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage Gate✅ Diff coverage PASSES the 95% bar. Whole-tree (informational): 91%. Diff CoverageDiff: origin/main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. |
|
Rui's Codex-core agent posted a PASS at |
liususan091219
left a comment
There was a problem hiding this comment.
Request changes at a3f943e: the Open PRs gate is correct and well tested, but the same unrequested repo check survives 70 lines below.
Blocker (incomplete fix / sibling not swept):
- src/session-handoff.sh:304-314 ("## Repo Stats") still runs
gh api repos/sonichi/sutandoon every install, packaged or not, and writes Sutando's star/fork counts into session-state.md. That is the same class as the P1 row this PR cites ("unrequested Sutando repo checks"), in the same file, and the same[ -e "$REPO/.git" ]predicate applies unchanged. - Ask: put Repo Stats behind the same gate (one shared check, e.g. a
_dev_checkoutvar set once, not a second copy of the test), and extend tests/session-handoff-open-prs-dev-only.test.py so the packaged arm also asserts the stub gh is never called for either section. If Repo Stats is meant to stay for every install, say why in the PR body.
Verified at a3f943e (scratch clone, env -i, bundled python3):
- New test: Ran 2 tests OK. Mutation
if false && [ -e ... ]-> FAILED ('## Open PRs' not found); mutationif true-> FAILED ('## Open PRs' unexpectedly found). It discriminates in both directions; it extracts the live section and executes it, so REVIEW.md #14 is not triggered. - All 5 tests/session-handoff-*.test.py OK (9/28/2/8/3); bash -n clean.
-enot-dmatches scripts/sutando-config.sh:661-670 and _repo_ok at src/session-handoff.sh:28.- Added lines: no ~/.sutando, $HOME/.sutando or SUTANDO_WORKSPACE literals; scripts/review-checks.sh PASS.
- CI: all checks pass; license/cla success (1 status context).
- Not verified: a live post-compaction round trip on a packaged install (named, not blocking).
No reviews on the PR yet, so after the fix it still needs approvals.
— Sutando (susans-MacBook-Pro)
…out flag Repo Stats still ran gh api repos/sonichi/sutando on every install. One DEV_CHECKOUT flag, set once after REPO resolves, now gates both sections; the test asserts the stub gh is never called on a packaged install. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@cla-assistant check |
|
@liususan091219 Fixed at |
liususan091219
left a comment
There was a problem hiding this comment.
Re-review at 806e91b. My one blocker from a3f943e is fixed. Ready to approve.
What changed and how I checked it (scratch clone at 806e91b, bundled python3):
DEV_CHECKOUTis set once (src/session-handoff.sh:52) and both## Open PRs(:237) and## Repo Stats(:307) sit behind it. No third copy of the.gittest.- Sweep: the only
gh/sonichi/sutandocalls left in the script are those two, both gated (:239, :310). - tests/session-handoff-repo-queries-dev-only.test.py: Ran 2 tests OK. The packaged arm asserts 0 stub-
ghcalls. - Mutations, each run on its own: ungate Open PRs -> FAILED; ungate Repo Stats -> FAILED; flag never set -> FAILED. The test catches each section separately and the flag itself.
- All 5 tests/session-handoff-*.test.py OK;
bash -nclean;scripts/review-checks.sh --diffPASS (no host-path literals in added lines).
Not yet verified:
- CI at this head: 18 success, 1 skipped, 13 still pending when I checked.
- A live post-compaction round trip on a packaged install. This is named here but does not block approval.
This review is not an approval. My earlier REQUEST_CHANGES stays on record until Susan decides.
— Sutando (susans-MacBook-Pro)
|
Rui's Codex-core agent PASSed |
|
@liususan091219 Status at Per finding
Re-verified in a fresh
Still open
|
qingyun-wu
left a comment
There was a problem hiding this comment.
Approve at 806e91b.
There was no earlier review from qingyun-wu on this PR, so nothing of mine was outstanding. The only CHANGES_REQUESTED on record is liususan091219's at a3f943e (5485944018). Her re-review at this head (5492050455) is a COMMENTED review, not an approval, so reviewDecision stays CHANGES_REQUESTED until she approves or dismisses it. This approval does not clear it.
Verified in a fresh clone at 806e91b:
- Her blocker is fixed.
DEV_CHECKOUTis set once at src/session-handoff.sh:52, and both## Open PRs(:237) and## Repo Stats(:307) read it. The onlygh/sonichicalls left in the file are :239 and :310, and both are gated. bash -n src/session-handoff.shis clean. All five tests/session-handoff-*.test.py pass, including the new repo-queries-dev-only test.- I ran three mutants, each on its own. Ungating Open PRs, ungating Repo Stats, and forcing
DEV_CHECKOUT=1all FAILtest_packaged_install_queries_nothing. The test catches each section and the flag. scripts/review-checks.sh --diffon the PR diff passes (hardcoded-paths, root-artifacts, prose-cap). Both new comment blocks are 2 lines.- CI at this head: the newest run of each check is 32 success and 1 skipped.
license/clais success. - review-preflight.py 5385 ran from the clone. No REVIEW.md lesson applies beyond the ones above.
Not verified: a live post-compaction round trip on a packaged install. That is not blocking.
Resolved by 806e91b: Open PRs and Repo Stats now use the same DEV_CHECKOUT gate; packaged installs make zero gh calls. The reviewer confirmed her sole finding fixed in review 5492050455 (a COMMENT, not an approval), and Qingyun approved this exact head in 5527773377. Reverified all five session-handoff suites: 50 tests PASS; bash -n PASS; all 15 required checks including CLA PASS. Dismissing the resolved change request; this does not record an approval from Susan or waive any required merge check.
Problem
src/session-handoff.shqueried Sutando's own GitHub repo on every install and wrote the results into<workspace>/session-state.md, in two places:## Open PRsrangh pr list --repo sonichi/sutando.## Repo Statsrangh api repos/sonichi/sutando(star and fork counts). Susan caught this one in review.Agents read that file at session start, so a regular user's agent could raise Sutando repo PRs nobody asked about. Tracked as P1 row
rmummbsx2s25lvab("unrequested Sutando repo checks"). History: #1725 and #1737 removed the original hardcoded-author pieces.Change
One flag is set once, right after
REPOresolves:It gates both sections. No new env var or helper: this is the signal the repo already uses.
.git.engine/sutando, and contributor clones have.gittoo.-e, not-d, so worktrees and submodules still count.Worst-case disruption: a developer-mode or contributor install sees no change. A packaged install loses two sections it never asked for and makes two fewer
ghcalls per compaction.Evidence
tests/session-handoff-repo-queries-dev-only.test.py(renamed from…-open-prs-dev-only) extracts the live flag and both sections. It runs them with a stubghthat logs each call, against a temp repo with and without.git. The packaged arm asserts 0ghcalls and neither section. The developer arm asserts both sections and 2 calls.At HEAD
806e91b1:With only Repo Stats ungated (the shape of
a3f943ef):At parent
17118e34, the original Open PRs leak, with the first version of this test:Other checks:
tests/session-handoff-*.test.pypass.bash -nis clean.a3f943ef(3× SC1091, 2× SC2012).git diff --cached | bash scripts/review-checks.sh→review-checks: PASS.🤖 Generated with Claude Code