Repository navigation
feat(wrap): one-call gather with live named PRs and a needs-you check - #1257
Merged
Merged
Conversation
wrap session gains three gather flags so /kit:wrap runs one gather call: - --prs owner/name#n,... reads every PR the transcript names in one batched GraphQL call (state, merged, mergedAt, merge commit, head branch), so the report never states a cached PR state. - --summary prints the gather as one fact per line, so the command never re-reads the JSON with jq. --text on the gather means the same. - --mark-dir folds step 0's per-repo writer check and mark into the gather. commands/wrap.md now runs one session recall --replies digest, one gather, then the report; it names the calls the gather replaces, finds handed-off PRs with one live search, re-gathers only after a write, and walks the digest for owner actions before Needs you may say NOTHING. ## How I verified it bash tests/test-wrap-session.sh -> test-wrap-session: all 122 passed Negative control: the new cases on master's wrap-session.sh -> 11 passed, 44 FAILED of 55
The first replay of the one-call wrap cut wall time and tokens about 3x but left a median of 15.5 lead calls: the lead still mined the transcript for repo paths and the start epoch. wrap session --transcript <jsonl> now reads the lead and subagent transcripts in the script: the start epoch (first timestamp, the writer threshold unless --since is given), every GitHub PR URL (added to the batched --prs read), and the main checkout of every repo the session worked in. Named PRs also carry their merge commit's check state. commands/wrap.md passes --transcript, lists the reads it replaces (git log, wrap apply dry runs, gh run list, --help, repo hunting), and gives the one flick-7b call form. ## How I verified it bash tests/test-wrap-session.sh -> test-wrap-session: all 131 passed
A repo the gather finds only through transcript text is read with core.fsmonitor and core.hooksPath neutralized through git's env config, which outranks every repo config file, and only when the current user owns the checkout. A planted fsmonitor hook fires on a plain gather (control) and never on a --transcript gather. ## How I verified it bash tests/test-wrap-session.sh -> test-wrap-session: all 133 passed
…gather Replay round 2 cut lead calls to a median of 6.5 but lost quality: reports credited the session with PRs it only quoted, and found fewer distill candidates without the miner. The transcript read now tags each PR: acted when a PR-writing command (gh pr create, merge, ready, close; wrap land, ship, merge) or its output names it, mentioned otherwise. Shipped credits only acted PRs and the ones the miner confirms. commands/wrap.md dispatches the read-only miner in the same turn as the gather, and the needs-you walk drops an action a later reply shows done. ## How I verified it bash tests/test-wrap-session.sh -> test-wrap-session: all 134 passed
- Mark the four new PR merge-state lines merged-ok (report facts, never a deletion proof) and pin the count at 9 in test-shared-lookups. - commands/wrap.md names `session recall --tail` again for an id prefix, which the recall suite requires. - test-wrap-session.sh: SC2319 fixed across the file (`[ x ] && echo 0 || echo 1`), so the pr-shape shellcheck passes on the touched suite. ## How I verified it bash tests/test-wrap-session.sh -> test-wrap-session: all 134 passed bash tests/test-shared-lookups.sh -> test-shared-lookups: all 15 passed bash tests/test-session-recall.sh -> PASS: session-recall shellcheck -S warning tests/test-wrap-session.sh -> exit 0
Replay round 3 found the lead polling a background miner (sleep loops, output-file globs, agent listings), one run ending on a note after the report, a handed-off PR shown MERGED in prose and OPEN in the table, an invented owner decision for a choice a worker made, and leads reading the lint's source. The miner now runs with run_in_background false; a handed-off PR keeps the one state its live search printed; a choice the session made is not an owner action; the lint's source is never read.
A repo that --transcript adds because the session only read it gets no pull, tidy, board flip or activity line. A self-wrap has no digest or miner, so its needs-you walk reads its own replies. Wording only, after the scored replay round; not re-scored.
Step 7b now makes one `precedent find --surface inventory --json` call with every candidate's key words in a single query (the CLI takes one description), then matches each candidate to its hits. This caps the lookups that made 3 to 7 lead calls per wrap in the replay. Not re-scored: the six replay sessions are spent as a test set.
…s, mark-dir guard Review fixes on the one-call gather: - The cd / git -C scan indexed a string, so jq errored and no such target was ever gathered (and the rest of that line's paths were lost). It now takes each capture's first group. - Transcripts are parsed line by line; a line that is not a JSON object is counted in transcript.skipped_lines (and the summary) instead of stopping the read and dropping every later repo and acted PR. - gh pr merge|ready|close with no URL and no --repo resolves against the origin of the repo it ran in (its last cd, else the record's cwd); with no number, against the record's git branch. Both go to the live --prs read. - --mark-dir refuses an empty path (step 0 would skip silently), $HOME, and any path inside a git work tree (marks would show as dirty files there). ## How I verified it bash tests/test-wrap-session.sh -> test-wrap-session: all 149 passed bash tests/test-shared-lookups.sh -> test-shared-lookups: all 15 passed
`Needs you: NOTHING` in a `## Wrap:` report now has to read `NOTHING (walked: digest <n> replies, miner <m> actions)` (a self-wrap: `NOTHING (walked: own replies <n>)`); report-lint.sh refuses a bare or count-free NOTHING there. Follow-through and harvest-sweep reports are unchanged. commands/wrap.md, the guide and the quickstart show the walked form; the lint fixtures that are wrap reports carry it. ## How I verified it bash tests/test-wrap-report-lint.sh -> test-wrap-report-lint: all 164 passed bash tests/test-harvest-sweep.sh -> All harvest sweep tests passed.
…s cwd A relative target (`cd sub && gh pr merge 5`) was tested against the wrap process's own cwd, so a merge could be credited to an unrelated repo while the session's PR was missed. Relative cd, git -C and file-path targets are now joined onto the transcript record's cwd, only a cd before the gh pr call counts, and a merge whose directory lands in no git repo with a GitHub origin is listed in transcript.unresolved_merges, never credited. ## How I verified it bash tests/test-wrap-session.sh -> test-wrap-session: all 152 passed on 16bcaf5's wrap-session.sh -> 148 passed, 4 FAILED of 152
A holdout found wrap reports long and dense, with wrong counts, PR purposes and actors. This fixes both by category; no holdout or replay session was read or re-run. - commands/wrap.md: a one-line **Result:** card first, a 40 non-blank-line budget, one fact per bullet, no fact told twice. Every count, PR number, PR purpose and actor comes from the gather or a verbatim digest line; the miner's claims are leads to check, and an unchecked detail stays out. - report-lint.sh: a `## Wrap:` report over 40 non-blank lines fails. - wrap session: named PRs carry mergedBy; recent merged PRs carry author and mergedBy; the summary prints author= and merged_by= for both. ## How I verified it bash tests/test-wrap-session.sh -> test-wrap-session: all 158 passed bash tests/test-wrap-report-lint.sh -> test-wrap-report-lint: all 168 passed on 796ac42's scripts -> 5 and 2 of the new cases fail
…fold Review round 3 fixes; the command's report rules are unchanged. - report-lint.sh: the line budget and the walked-NOTHING rule now hold for every report except `## Follow-through:` and `## Harvest sweep:`, so a drifted heading (`## wrap:`, `## Wrap <slug>`, an extra heading above it, or none) no longer switches them off. - report-lint.sh: a bullet or lettered item outside a fence holds at most 3 sentences, so one packed line cannot dodge the budget. - wrap session: cd targets fold in order (`cd /repoB && cd sub` lands in repoB/sub), for URL-less merges and for repo discovery, where a git -C target resolves against the folded directory. ## How I verified it bash tests/test-wrap-session.sh -> test-wrap-session: all 159 passed bash tests/test-wrap-report-lint.sh -> test-wrap-report-lint: all 180 passed on a3a02f0's scripts -> 1 and 11 of the new cases fail
The per-bullet sentence count counted the `a. ` marker and abbreviations, so the Needs-you template `a. <what>. <why>. <command>.` failed every report with an owner item. A bullet or lettered item outside a code fence is now capped at 400 characters; the template with a real 321-character command fits. commands/wrap.md names the second report's heading as `## Follow-through: <session slug>`, the shape the lint exempts (heading text only; the report rules are unchanged). ## How I verified it bash tests/test-wrap-report-lint.sh -> test-wrap-report-lint: all 184 passed on 9328d65's report-lint.sh -> 180 passed, 4 FAILED of 184
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Verdict: Lead calls miss the target by 0.5 (median 10.5, target at most 10). The pre-registered replay rule PASSES: NEW is at least OLD on 5 of 6 sessions, no row 1, 2 or 5 drops 2 points, and median calls and wall time are lower.
Proof:
tests/test-wrap-session.shpasses 134/134, and its negative control (master'swrap-session.sh) turns 53 cases red. CI is green. Replay numbers are indocs/verification/wrap-cut-call.md; raw results are in private ops-toolkit PR #6521.Risk: Judge noise is large. The same OLD report scored 11, 9 and 7 for P2 across rounds, three of the five passes are a tie or a one-point win, and I tuned the command over 4 rounds on these 6 sessions. Against the merged OLD scores, 5 of 6 still holds with no 2-point drop. Commit
6c9a0cfc(self-wrap and read-only-repo wording) came after the scored round and was not re-scored.Needs Han: Nothing to decide. Step 7b now runs
precedent findonce per wrap (commit37b3ac23, per the coordinator's decision). Before the cap, step 7b made 3 to 7 lead calls per wrap and every other lead call had a median of 6.5, so a wrap should land near 7 or 8 lead calls. That is an estimate: the cap is not re-scored, because the six replay sessions are spent as a test set.Shape: One
session recall --repliesdigest, then onewrap session --summary --transcriptgather with a foreground miner beside it, then the report.The replay results are in this body and the proof file. The raw scores, metrics, digests and harness deltas are in a results-only ops-toolkit PR, #6521 (private).
Review fixes (
ccdad400,afb621c7)A fresh read-only review found one HIGH and five MEDIUM issues. All six are fixed, each with a test that fails on
37b3ac23(16 cases intest-wrap-session, 3 intest-wrap-report-lint):HIGH: the transcript's
cd/git -Crepo discovery now works. The jq scan indexed a string and errored before.A truncated transcript line is counted in
skipped_linesinstead of silently dropping the rest of the read.Needs you: NOTHINGin a wrap report must name the walk,NOTHING (walked: digest <n> replies, miner <m> actions), and the lint refuses a bare one.A URL-less
gh pr mergeresolves by number against its cwd's origin, or by its branch, and then gets the live read.--mark-dirrefuses an empty path,$HOME, and any path inside a git work tree.Re-review fix (
796ac429): a relativecdorgit -Ctarget resolves against the transcript record's cwd, never the wrap's own. A merge whose directory lands in no repo is listed inunresolved_mergesand is never credited. Four cases fail on16bcaf5b.Holdout fixes (
a3a02f04): a holdout on 4 fresh sessions lost on skimmability and on wrong specifics (NEW at least OLD on 1 of 4; lead calls 7.5). The report now starts with a one-line**Result:**card, fits a 40 non-blank-line budget the lint enforces, and puts one fact in each bullet. Every count, PR number, purpose and actor must come from the gather or a verbatim digest line; miner claims are leads only. The gather now reads each PR'smergedBy, plus the author of recent merges. The new tests fail on796ac429(5 in the session suite, 2 in the lint suite). No holdout or replay session was opened for these fixes.Review round 3 (
9328d65f):NOTHINGrule now hold for every report except follow-through and harvest-sweep reports, so a drifted heading no longer switches them off.cdtargets resolve in order.a3a02f04(1 in the session suite, 11 in the lint suite). The command's report rules are unchanged.Review round 4 (
2829c60e):a.marker and abbreviations counted as sentences.## Follow-through: <session slug>. The report rules are unchanged.9328d65f(4 in the lint suite).None of these fixes was re-scored on the replay. The LOW findings (leading-zero refs, the per-PR error match, document-level GraphQL errors, glob-expanded refs, the usage text in held files, and the extra test rows) are not fixed here.
What
wrap session --prs owner/name#n,...: every named PR read live in one batched GraphQL call (state, merged, mergedAt, merge commit and its checks, head branch). This fixes B4's stale PR state.--transcript <jsonl>: the script reads the transcript and its subagent transcripts for the repos the session worked in, its PR URLs (taggedactedormentioned), and the start epoch, so the lead never mines them. Repos found this way run withcore.fsmonitorandcore.hooksPathneutralized, and only when the current user owns them.--summary(also--text): one fact per line, so the report never re-reads JSON withjq.--mark-dir: step 0's per-repo writer check and mark run inside the gather.commands/wrap.md: one gather, the calls it replaces named, handed-off PRs found with one live search, and a needs-you walk over the digest and the miner's list beforeNOTHING. This fixes P3.Tokens
452,847 output tokens of the 700k cap: 410,743 over 24 NEW runs in 4 rounds, plus 42,104 for 18 judges. Every rate-limit event was
allowed; seven-day usage went from 0.46 to 0.48.Scores (scored round, commit
43a3cecb)Rows: needs_you, landing_facts, planned_writes, learnings, errors, skimmability.
Calls per session, before and after
Lead calls (the previous NEW,
266c9ec4, came from the merged replay).precedent findRounds
323baebb--prs,--summary,--mark-dir2d845291--transcript; miner made optional11d87a9143a3cecbRound 2 showed the trade: dropping the miner cut calls to 6.5 but lost distill candidates and credited quoted PRs to the session.
Method
I ran the merged ops-toolkit harness (
origin/main1e72f1ea) from a scratch copy with the OLD streams, reports and A/B key. Only the NEW arm changed: the kit root points at agit archivesnapshot of the tested commit, and a NEW-only driver keeps the same stops. Facts sheets were rebuilt live, and all six sessions were re-judged blind with the same opus judge prompt and key. I took repo digests before and after every round. They moved only from concurrent host sessions and this branch's own commits. A stream audit found no write command.Proof
docs/verification/wrap-cut-call.mdNot done
lib/wrap/wrap.shusage anddocs/reference/wrap.mddo not name the new flags yet, because another session holds them.lib/gate/push-refs.shrefuses a PR-create call when the--titleholds parentheses, so this PR was opened with a plain title and renamed. I filed it as push-refs: a quoted PR title with parentheses blocks the PR-create call #1258 instead of fixing it, because the fix narrows a fail-closed ship-gate guard and needs a maintainer call.Bookkeeping
no-board-row: worker task from the wrap goal handoff spec, item 227