Originally created by: lodar
Closes DIVE-1963. Follow-up to DIVE-1955, unblocked by DIVE-1965 (done + rolled).
_gate_task_repo_slug had three fallbacks and the third was any github URL sitting anywhere in the body. That reads a URL the body mentions as a declaration of where this task's work lives.
DIVE-1955's own close is the specimen: its body quotes the constant the ticket is about, _PUSH_DEFAULT_REPO="https://github.com/5dive-ai/5dive.git", so the gate bound every bare #N to the CLI repo and never searched api or frontend at all. The ticket about an implicit repo standing in for a missing one triggered a narrower version of itself, sourced from prose instead of from a constant.
The ticket recommended (b): "if the ref is not found in the inferred repo, fall back to the all-repo sweep". That fixes only the miss half, and the miss is the safe half. An unfound ref becomes an honest UNVERIFIED note.
The other half is the dangerous one. When the inferred repo does have a #N, the old path handed back a confident verdict about a pull request nobody claimed, which is the "wrong, not blind" failure DIVE-1955 exists to delete, and (b) leaves it fully intact.
Deleting the inference cannot lose coverage: with no declared repo a bare #N goes through the DIVE-1955 existence-count sweep across every known repo, a strict superset of the single repo the inference picked. So it closes both halves at once.
It is also the rule DIVE-1965 already settled one layer up: a binding comes from a structured, intentional signal, never from "a URL appeared in the text." Prose is evidence of discussion, not of declaration. Declared bindings (a delivery_ref URL, a Repo: line) are unchanged and still narrow.
The superset is over the configured repo set, not over all of GitHub. _gate_repo_slugs is the world, and it is FIVE_GATE_REPOS when that is exported; unset, it is the three real repos. The suite now pins that default with the variable cleared rather than leaving the claim asserted in prose. A box exporting a narrower list narrows the sweep with it, and there the deleted inference could have named a repo outside the configured world, but a binding that reaches outside the set the operator configured is its own defect, not coverage worth keeping.
"resolve to no PR in any known repo" was printed after searching exactly one. _gate_search_scope branches on the same two inputs _gate_resolve_qualified branches on, in the same order, so the sentence and the lookup cannot drift, and the message now names the repo(s) actually searched per ref: a ref carrying its own pull URL is looked up there and nowhere else, a bare #N in a declaring task likewise, and only a bare #N with no declaration gets the full sweep. Same correction in the merge-audit footnote.
Unit. New tests/task_merge_gate_inferred_repo_unit.sh, 14 cases, green, and 9 of them go RED against pre-fix src/cmd_task.sh (the suite was run against git show origin/main:src/cmd_task.sh), so no assertion is vacuous. It pins both halves, including the case a (b)-style fix would not have caught, plus a mutation guard that the same collision, DECLARED, still binds and closes clean so the headline case is not passing on something other than the missing declaration, and that a declared repo still narrows.
Siblings unchanged green: multirepo 36, delivered-vs-cited 31, result_pr 29, gh_resolve 7, autodetect 14, ancestry 26, task_deliver 11, policy_refusals 17, task_core 35.
Real board, read-only. Over the newest 250 done rows, 242 bindings are unchanged and 8 came from the deleted prose fallback. Two of those eight (DIVE-1870, DIVE-1898) had been bound to anthropics/claude-code, a repo outside our configured world entirely.
Running merge-audit's own per-task loop over DIVE-1955's live row, against real GitHub, pre-fix and post-fix:
PRE-FIX task_repo=[5dive-ai/5dive] POST-FIX task_repo=[<none, sweeps all known repos>]
PR #6 5dive-ai/5dive MERGED-green PR #6 5dive-ai/5dive, lodar/5dive-api ambiguous
PR #10 - unverified PR #10 lodar/5dive-api, lodar/5dive-frontend ambiguous
PR #17 - unverified PR #17 lodar/5dive-api, lodar/5dive-frontend ambiguous
PR #16 - unverified PR #16 lodar/5dive-api, lodar/5dive-frontend ambiguous
PR #25 5dive-ai/5dive CLOSED PR #25 5dive-ai/5dive, lodar/…-api, lodar/…-frontend ambiguous
Both halves of the defect, on the ticket's own specimen. #10/#17/#16 were never missing, they were never looked for, and they exist in the two repos the inference skipped. [#6] and [#25] are the other half: a confident CLI verdict about pull requests this task never claimed, now an honest non-answer. ambiguous is a loud warn plus an audit row that blocks nothing and blesses nothing, so nothing becomes unclosable, and on the done path DIVE-1965 skips cited refs before this is reached.
DIVE-1672 (delivered lodar/5dive-frontend#16) and DIVE-2191 (5dive-ai/5dive#256), two rows crossing two repos, resolve identically pre- and post-fix, both correctly to their own repo and both MERGED+green: they declare via delivery_ref, so the deleted fallback was never reached and the declared path is provably undisturbed.
🤖 Generated with Claude Code
Ticket changed by: lodar