Repository navigation
fix: resolve a gated loop's bare PR number from its own session log - #17490
Conversation
2510e25 to
6dd7fdd
Compare
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS
Not justified as shipped
What this change shipsInventory (8 items) — 7 justifiedIntent: a loop told "Babysit PR 14361" actually watches that pull request instead of firing blind on its timer. This is a FIX (#14488, design ruling linked, a test that fails on base).
[FIRST-PRINCIPLES-REVIEWED] 7303e95 Description read[DESCRIPTION-READ] e01d68bab01a7aa73ea0140f9db772cd4710865dee85e40d490165f778bb1545 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The repository for a bare Watch
[DESIGN-REVIEWED] 7303e95 Description read[DESCRIPTION-READ] e2e7b5e2b5247b79959c56ac3a06896aeca70faafb46cb25adbf2f1684ba7b75 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
6dd7fdd to
8dbcd05
Compare
|
Disposition of the review findings on GPT 6.1 BLOCKING, and the matching Opus 5.5 advisory:
Design Review CONCERNS: a bare-number subject has no host pin. Kept on purpose; I'm recording it here as an accepted risk. The stored monitor target is a canonical First Principles: PASS. Its note is the same host-pin point, covered above. |
8dbcd05 to
7303e95
Compare
|
GPT 6.1 BLOCKING at
|
Problem / Motivation
Goal: A gated loop that names its pull request as a bare
PR <number>gets a probe, as long as its own session has already named that pull request's repository, instead of firing blind on its timer forever.A
monitor_startloop whose instruction saysBabysit PR 14361(no URL, and no URL injudge.targets) builds no monitor.probes.targets.inferselects a subject only from a full URL, and_PR_BARErequires a#, soPR 14361is not even seen. Loop W5 on the live gateway fired 7 of 7 ticks on the plain timer with zero evidence items: no check state and no comment body ever reached the wake judge.Why it matters
The loop looks armed and gated but observes nothing. Every interval spends a turn whether or not anything changed, and the wake judge that exists to read reviewer comments never gets any. Agents write
PR <number>routinely even with the babysit skill's full-URL rule in front of them, and a hand-writtenmonitor_starthas no skill at all.Not a goal
owner/name#Nshorthand is resolved, including the existing ambiguity rules.judge.targetsentries; only the instruction is resolved.PR 14361; blocked on <URL for #7>, where hash-lessPR 14361is invisible to the ambiguity guard and the loop gates on fix(sandbox): bypass toolbox shim to fix nested sandbox failure on macOS 26 #7. It is pinned by a test asserting the current answer.What changed (motivation → approach → change)
Symptom → cause → change:
/pull/<number>URL, orowner/name#<number>, with that exact number. If the transcript names none, or names two repositories, guess nothing and keep today's timer.probes/targets.py(the one grammar):bare_pull_request_numberfinds exactly onePR <n>/PR #<n>/pull request <n>in a text that names no URL and no shorthand.resolve_barescans context strings for that number in exactly one repository (case-folded); anissues/link never matches. No host is pinned (host_key="default") because the instruction named none, which is also what lets a stored monitor reproduce the arm's answer.infergains an optionalcontextcallable, called at most once and only for a bare-number text. Every existing caller passes none and gets the same answer as before.autonudge_service/subject.py:infer_subjectresolves the instruction through_resolve_instruction. On arm and retarget it reads the bound session's transcript through the guardedderive_messages(dashboard:<slot>for a dashboard loop, the key itself for a channel loop; a withheld transcript leaves the loop ungated). A stored loop (loop_subject, used by the gate, the post-poll rebinding and the terminal settlement) passesmonitor_target=and resolves against its own monitor's target instead, so a tick reads no transcript on the event loop, the binding cannot drift as the log grows, and no module-level cache is needed.autonudge_judge.parse_targets(..., watched=): the judge's collector cannot re-read the transcript, so for this one shape (no brief list, and the instruction's bare number equals the gh-pr monitor's number) it admits the monitor's own subject. Without this the probe would read the PR but the judge tick would still return "no usable target". Both callers (judge_tick.py,slack/gateway.py) passwatched_pr_subject(loop).docs/system-specs/modules/babysit-pr-watch.mdnow describe the bare-number rule. The skill still tells the agent to write the URL.Backwards compatibility
Compatible: every new parameter is optional and defaults to the old behaviour, and a text that infers today infers the same subject. The only behaviour change is that a bare-number loop whose own transcript names exactly one repository for that number now gets a monitor instead of none.
Removes nothing: the change only adds a resolution source and an optional keyword. No validator is tightened, and no key, kind, record or function is removed or renamed.
Tests
test/test_probe_targets.py(+12): hash-less, hash andpull requestspellings resolve from a URL in the log; no context still means no subject; a shorthand-only log resolves unpinned; URL + differently-cased shorthand for one repo is one repo; two repos refuse; other numbers or anissues/link refuse; two bare numbers refuse without reading the log; a text that decides by itself (URL, shorthand, ambiguity, no PR) never reads the log; an unreadable log refuses rather than raising; the pre-existingPR 14361; blocked on <URL #7>residual is pinned at its current answer.test/test_autonudge_bare_pr_number.py(new, 13):infer_monitorarms a gh-pr monitor from the session log under thedashboard:key, and a channel loop reads its own key; no match / two repos / a withheld transcript leave the loop ungated; no slot or a URL message never reads the log; a stored loop resolves the arm's exact subject from its monitor without reading the log, even after the log changes, and a monitor for another number resolves nothing; the judge collects the monitor subject only for a matching bare number;watched_pr_subjectignores a non-PR monitor; one test against the realConversationLogunder a tempKIROCREW_HOME.origin/main@ 9bf943b, the behavioural testtest_the_real_conversation_log_is_read_under_the_dashboard_keyfails withassert (None is not None), meaning no monitor is armed. The rest fail on the missing API.inferignores context (10 red), transcript key without thedashboard:prefix (3), collector ignoreswatched(1), first repository wins (2), stored loop reads the log instead of its monitor (2),#required (10), two bare numbers allowed (1), URL-in-text not excluded (1),issues/links admitted (1), unguardedread_messages(5), case-sensitive slugs (1).timeout 900 python3 -m pytest -n0 test/test_probe_targets.py test/test_autonudge_bare_pr_number.py -x -q→ 42 passed. The contract suites that CI caught on the first head (test_autonudge_refactor_contract.py,test_transcript_derivation_seam.py,test_review_repair_routing_skill.py) pass locally: 450 passed together with the two files above.Manual verification
N/A: unit coverage exercises the real
ConversationLogread path and the arming/tick/judge functions. No live gateway loop was armed. Read cost was measured on this host: an 84 MB transcript took 0.58 s cold, which is why ticks resolve from the stored monitor and never read the transcript.Related Issues
Closes #14488. Follow-up to #14470 / #14480.
Pattern harvest
Not generalizable: the gap is specific to the bare-number spelling that the URL-only subject grammar deliberately never selected. The fix reuses that one grammar instead of introducing a new rule elsewhere.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.