Originally created by: lodar
DIVE-1922 reached status=done while its delivery PR was OPEN, unmerged and RED on its own new unit test. Both DIVE-1830 bindings were empty, and DIVE-1835's mandatory auto-detect — written for exactly that hole — did not fire either.
Ground-truthed as agent-dev before changing anything, not inferred from the signature. _gate_gh_token only tried the host's gh-authed claude account when id -un == root. Agents close tasks as themselves — plain 5dive task done, no sudo — and no agent-* account is gh-authed. So resolution returned empty, gh pr list printed gh auth login to stderr and nothing to stdout, || echo "" swallowed it, and the fail-OPEN gate read "no token" as "no open PR".
DIVE-1922 was not a one-off slip. No agent close has ever been gated.
claude for non-root callers too — after the caller's own login, because a caller's own credential must win over borrowing another account's.no-gh-token / gh-absent / query-failed) and writes a task.merge-gate-unverified audit row. This is the ticket's own theme: DIVE-1922's deliverable was instrumentation whose absence rendered identically to its healthy state, and a gate reporting "no hit" for both an outage and a clean repo is the same shape.--result and the body are parsed, and an OPEN reference refuses the close. Narrow on purpose: OPEN only, so a "superseded by PR [#150]" mention of an abandoned PR never makes a task unclosable (DIVE-1835's rule), and an unresolvable ref is a loud note rather than a block, so an offline box stays closable.#N is deliberately NOT a PR reference. The first cut matched any #N; run against the real board it read "arms-length payer [#4]" and a column number "#25" as PRs. Requiring the word PR (or a full pull url) keeps the DIVE-1922 shape and drops the collisions. Bare numbers resolve against the CLI repo only, and both the refusal and the unverified note NAME that repo, so a cross-repo PR #N (api/app numbers collide with old CLI ones) is diagnosable instead of mysterious.--force-merge-gate escapes it, audited, so a flaky post-merge run cannot make a landed task permanently unclosable.5dive task merge-audit — read-only sweep of DONE tasks whose own record names a PR that never merged. It refuses to run without a resolvable token, because a sweep that reports every PR as unverified is not an audit.Newest 250 closes: 0 OPEN, 0 merged-red. 2 CLOSED and 16 unverified, all cross-repo api/app references. DIVE-1922 was the only genuine instance, and it has since been re-closed with a proper delivery_ref.
With the resolver fixed, task_merge_gate_gh_resolve_unit.sh reached the host's actual gh login — real sudo resets PATH past the stub — and printed a live oauth token into its own argv log, while its empty-token fail-safe assertions passed on a token the fleet does not have. Both harnesses now stub sudo fail-closed for the whole run. A test that needs the host is not a test.
21 new assertions in tests/task_merge_gate_result_pr_unit.sh, including the DIVE-1922 shape reproduced from its real result text, prose-safety cases that must still close, and the non-root token path. Pre-existing gate suites green. tests/task_park_gate_guard_unit.sh fails identically on clean origin/main (rc=6) and is untouched here.
🤖 Generated with Claude Code
Ticket changed by: lodar