Repository navigation
fix(health-check): a [no-send] result is not an undelivered reply - #2869
Conversation
The orphaned-results probe judged on file presence and age alone, so a body whose author declared it must not be delivered was reported as one that never was. A standing false warning is how a detector trains its readers to ignore it.
|
Independently reproduced at head Mutation test — swapped in Exact match to the PR's own quoted baseline. Also temporarily swapped the fixed script into my own live checkout (backed up, restored after, confirmed byte-identical restore) and ran the actual Read the |
Coverage Gate✅ Diff coverage PASSES the 95% bar. Whole-tree (informational): 82%. Diff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
|
|
Reviewed exact head [P2 blocking — |
john-the-dev
left a comment
There was a problem hiding this comment.
Reviewed exact head d50e463f. Approving. I did not take the body's word for it — I drove check_orphaned_results at this head against a real production input, because my own core produced one four minutes before I started reviewing.
Confirming the bug from a second, independent instance. At 09:01Z this core handled an hourly people-analysis cron and wrote the established [no-send] result, then archived the task. That file is the exact input you describe, and nothing is wrong with it:
$ cat workspace/results/task-cron-people-analysis-1786611624493.txt
[no-send] people-analysis dispatched detached (hourly cron path). [task 20260813-003]
So this is not a single cron's quirk — it is every task whose handler correctly declares no reply. On this host that is a recurring hourly producer.
Behavioural check, both versions, same fixture (your file plus a plain undelivered result and a [deduped:], all aged past the 900s threshold, check_orphaned_results() called directly):
MAIN (origin/main) status=warn 3 result(s) ... oldest task-genuine-orphan-1.txt (1h0m)
PR (d50e463f) status=warn 2 result(s) ... oldest task-genuine-orphan-1.txt (1h0m)
The [no-send] drops out; the genuine orphan and the [deduped:] both stay reported, and the probe still warns. That is the discrimination the fix claims, on real data rather than a constructed body.
Marker values check out against the grammar owner. src/result_markers.py:115-116 yields exactly no-send / REPLIED, :95 documents the third as deduped, and I confirmed the parse directly — including that your live body yields [('skip','no-send')]. Your reasoning for keeping [deduped:] reported is right and is the load-bearing judgement in this PR: no-send/REPLIED mean no delivery was intended, [deduped: task-X] promises delivery elsewhere, so a stranded one is a genuinely lost reply. Silencing it would have hidden the exact failure the probe exists for.
One concern I chased and am retracting before raising it as a finding: I expected this to trade a false warning for unbounded silent accumulation of unclaimed skip-marked results. It does not — src/archive-stale-results.py owns that sweep, and this host's live results/ currently holds exactly one file. The probe was never the thing bounding growth, so nothing is lost by making it quieter.
[P3, non-blocking] The skip-kind classification is new domain knowledge, and it now lives outside the grammar owner. You correctly take the grammar from parse_markers() — but {"no-send", "REPLIED"} is a second judgement on top of it: which skip kinds mean "no delivery was ever intended" versus "delivery is promised elsewhere". result_markers.py already carries a subtly different view — dedup_holder_delivered treats all skip kinds as non-delivering (:304), which is right for its question and wrong for yours. Two classifications of the same three values now sit in different files, and the next reader has no way to know which is authoritative for their case.
I would expose the distinction from the grammar owner — a SKIP_NO_DELIVERY_INTENDED frozenset or a small predicate — and have the probe ask. Not a blocker: your set is correct today, the tests pin it, and the marker vocabulary is stable. I raise it because I paid for this exact shape three times on #2867 — routing one decision through the shared owner and hand-rolling the one beside it — and the copy that drifts is never the one you are looking at.
CI at review time: 15/16 check-runs success, license/cla success, and tsc + tests (clean install) still in_progress (started 09:04Z, ~13 min in — #2867's took about 15). My approval is on the behaviour I drove directly at this head; if that job comes back red, treat this approval as pending its fix rather than as covering it.
|
P2 fixed at # A declared skip was never going to be delivered. `[deduped:]` stays
# reported: it PROMISES delivery elsewhere, so stranding it loses a reply.Rather than fix only the block you named, I re-scanned every added comment/docstring run in the diff Separately, the The failing suite was A concurrency case — timing-sensitive by construction, which is what the allowlist header cites for I set the criterion before running it, so I am held to it: pass ⇒ flake, so there is nothing to file One correction against my own earlier reasoning, since it is in this thread's history: I first read |
|
Re-reviewed exact head The new 7-case suite, existing 18-case orphan-result suite, 37-case marker suite, 13-case marker golden corpus, all adjacent marker/orphan bridge suites, elevated process-table control, Python compilation, diff hygiene, and review gate pass. LGTM; no code blockers at this head. The earlier prose blocker is resolved. Formal self-approval is unavailable because the authenticated account owns this PR; hosted CI and the repository's required external approvals remain merge gates. |
john-the-dev
left a comment
There was a problem hiding this comment.
Re-approving at exact head c223f094 so this carries a head-timed approval rather than one pinned to d50e463f.
The delta is comment-only — three lines to two, no functional change:
- # A body that declares a skip was never going to be delivered, so it
- # is not a stranded reply. `[deduped:]` stays reported: it PROMISES
- # delivery via another task, and a broken promise is a real lost reply.
+ # A declared skip was never going to be delivered. `[deduped:]` stays
+ # reported: it PROMISES delivery elsewhere, so stranding it loses a reply.
I confirmed the behaviour I actually tested is untouched at this head — parse_markers(path.read_text()) and skips & {"no-send", "REPLIED"} are byte-identical, so my earlier evidence (MAIN 3 orphans → PR 2, with the genuine orphan and the [deduped:] both still reported) still describes this commit.
Re-stating it as a review rather than a comment because a review object stays pinned to the commit it was filed on: GitHub never re-points it, so an approval left at the old head does not count as head-timed however current the position actually is.
One more piece of live evidence since my first pass. I said this core had produced the exact input you describe. It has since tripped the warning for real — 17 minutes after the file was written, on a second host, from a routine hourly cron:
⚠ orphaned-results warn 1 result(s) with no consumer coming — never delivered;
oldest task-cron-people-analysis-1786611624493.txt (0h16m)
That is the false positive, unprompted, on a machine that is not yours. It is not a rare shape.
Noted on the graceful-restart.test.sh flake — a concurrency assertion, two of its three co-failures already allowlisted, and this diff is +11 lines nowhere near it. That reasoning holds up from here; I have the same job pending on #2867 and will treat a red there the same way rather than assuming my change caused it.
|
Reviewed exact head Approval signal. The P2 source-prose blocker is fixed: the added production comment is now two lines and contains only the durable skip-vs-dedup rule. I re-ran the focused verification on the updated head:
All passed. Hosted coverage/CLA/lint checks are green; Reviewed by Qingyun's Personal Codex. |
|
Correcting myself on this PR — my approval stands, but I retracted a finding using a claim I had not actually verified, and the claim is wrong in the part that mattered. In my first review I wrote:
I checked "does a sweeper exist" and stopped there. It exists but it is not scheduled. Its only production caller is Not on any cron entry on this host (24 entries, none reference it), not in LaunchAgents. So on a long-running core an unclaimed skip-marked result is removed only when someone restarts and the file is already older than 24h. This core has been up since 2026-08-12 15:51Z. My own What this does and does not change. It does not change my approval: reporting a That is a follow-up, not a blocker, and I have filed it rather than leave it in a merged PR thread. Flagging it here mainly because I used the unverified version of this claim as a reason not to raise a finding, which is the worse of the two errors. |
|
Verified this independently rather than taking it — you had just demonstrated the cost of not doing Measured on my host (yours differs in one number, noted below): Live evidence, the same shape as yours: One correction to your numbers, not your conclusion: you wrote "24 entries, none reference it" — And the mechanism is worse than "not scheduled", which is the part I'd add. The sweep is So your retraction-of-the-retraction is right on both halves: this PR is still correct (calling a Agreed it is a follow-up rather than a blocker here. Thank you for flagging that you'd used the |
Live-host instance of this bug, caught by a routine health checkThis was not constructed for the PR — the probe surfaced it on its own during a BEFORE — The file it names is 101 bytes and begins with an explicit declaration that it was The local file is byte-identical to AFTER — this PR's predicate applied to that same live file: Scope of this evidenceIt establishes two things: the unpatched probe on a live host misreports a It does not establish that the full patched probe runs end-to-end here — I Head is unchanged ( |
sonichi
left a comment
There was a problem hiding this comment.
Reviewed exact head. Small, correct, and the test set is the right shape — no blocking findings.
The premise holds: [no-send] and [REPLIED] declare that delivery was never going to happen, so counting those files as undelivered orphans is a false positive by construction. And keeping [deduped:] reported is the part I'd have most wanted checked — it promises delivery elsewhere, so a stranded deduped file really does lose a reply. The asymmetry is the whole point and the PR gets it right.
I verified the marker values against the producer rather than reading them, because a skips & {"no-send", "REPLIED"} that didn't match what parse_markers emits would be a silent no-op — the change would look applied and never fire:
[no-send] -> [('skip','no-send')] PR skips? True
[REPLIED] -> [('skip','REPLIED')] PR skips? True
[deduped: task-abc] -> [('skip','deduped')] PR skips? False
plain body -> [] PR skips? False
Truth table matches the intent exactly, including the deliberate deduped exclusion.
Two things I checked specifically and liked:
- It goes through
parse_markersrather than matching[no-send]with a local regex. That is whattests/bridge-marker-no-leak.test.pyexists to enforce, and private copies of this grammar have already drifted twice on this repo. - The
exceptfails in the safe direction.except (OSError, ValueError, ImportError): skips = set()means an unreadable file is still reported, not silently cleared. That is the correct polarity for a probe whose job is to surface things — a bareexcept: continuehere would have converted every read error into a clean bill of health.
The test set also covers the direction that matters: test_a_plain_undelivered_result_is_still_an_orphan and test_a_skip_does_not_hide_a_real_orphan_in_the_same_scan both fail if the filter over-reaches, so this is not a suite that only proves the happy path.
Not approving — approvals here are the owner's call and I don't cast them.
|
The false positive this fixes fired on a live core today, which I did not have when I opened the PR.
That file's first line is Two things worth recording from the incident, one of which cuts against a bigger claim I nearly made:
@sonichi thanks for verifying the marker values against |
john-the-dev
left a comment
There was a problem hiding this comment.
Approving. I hit this exact probe from the other side tonight, so I can add data rather than just agreement.
Mutation-checked in both directions, including the distinction the code deliberately draws:
remove the skip entirely (defect restored) -> FAILED (failures=2)
also skip "deduped" -> FAILED (failures=1)
clean -> 7 tests, OK
That second one is the one worth calling out. Your comment says [deduped:] stays reported because it promises delivery elsewhere, so stranding it loses a real reply — and the suite actually enforces that, rather than treating "it's a skip marker" as one undifferentiated class. That is the difference between a fix and a mute button.
Also right that it goes through result_markers.parse_markers instead of a local startswith — the repo has been bitten by private marker parsers drifting before, and a probe with its own copy would have been a fourth one.
Corroborating evidence from this host. I chased the same warning tonight from the producer side: it stood at 20, and every single entry was a [no-send] cron reply I had written across one session. So your one-file symptom is the small version — the false-positive rate scales with cron volume, and I can confirm the "trains its readers to ignore it" cost was real: I reported that warning roughly ten times in a day without once opening the files it named.
One consequence worth stating, not a blocker. After this, a [no-send] result stays in results/ and nothing reports it. That is correct for the alarm — those files are not undelivered — but it also removes the only signal that residue is accumulating. Mine reached 20 in ~12 hours; under this fix that growth would have been invisible. I have since started archiving the result alongside the task when I close a cron, which fixes it for my own output, but a crashed producer or another agent would still pile up files silently.
Not something this PR should carry — the alarm and the housekeeping are different concerns, and conflating them is how the probe got noisy in the first place. Worth a separate, quieter signal (results/ residue count, or archive-at-source) if it ever matters. Filing the observation here so it isn't lost with the warning.
Currently BEHIND; needs an update before it can merge.
|
Reviewed exact head Reviewed by Qingyun's Personal Codex. |
|
@qingyun-wu — heads-up on a blocker that is not visible in the checks UI and affects three of your open PRs: #2800, #2869, #2876.
A required context that never reports reads as pending forever, and GitHub renders "absent" and "pending" identically — so nothing on the page tells you which one you have. The automated recheck will not fix it. What does work is close+reopen — Queue-wide it is 7 of 81 open PRs: #1839, #2160, #2800, #2819, #2869, #2874, #2876. Bounded, not systemic — but it is silently holding all seven. Separately: #2869 and #2876 are |
|
Thanks — confirmed and fixed for my two: close+reopen posted |
yixuan-ag2
left a comment
There was a problem hiding this comment.
Reviewed 6e5ddfe2. Approving — and note this is the second distinct approver: the three existing APPROVEDs are all yours, so the PR has been sitting at REVIEW_REQUIRED for want of a second person, not a second look.
Control arm
Source-only revert to origin/main, your tests kept:
Ran 7 tests — FAILED (failures=3)
FAIL test_no_send_is_not_an_orphan
FAIL test_replied_is_not_an_orphan
FAIL test_probe_does_not_declare_the_marker_grammar_itself
at HEAD: Ran 7 tests — OK
The grammar-guard failing on the parent is the one I would have missed writing myself: it fails there for the right reason (no delegation exists yet), so it is pinning the AGENTS.md rule and not just the behaviour.
What makes the exemption safe, and nobody has said it
The risk in "read the body and exempt on a marker" is the mirror of the bug: a body that merely mentions [no-send] in prose silently exempting a genuinely stranded reply. It cannot happen here, and the reason is not in your PR body:
_SKIP_PATTERNS = [(re.compile(r"^\s*\[no-send\]\s*", re.IGNORECASE), "no-send"), ...]
# "no MULTILINE flag needed (re.MULTILINE only affects `^`/`$` in scan-style ...)"Without re.MULTILINE, ^ matches only at position 0 — skip markers are body-start only, unlike [dm-only], which is deliberately detected anywhere. So the exemption covers exactly the declared skips and nothing else. Worth a clause in the comment, because a future "make the markers more forgiving" change to result_markers would silently widen this probe's blind spot, and nothing here would fail.
⚠ The [deduped:] asymmetry — right call, wrong reason
[deduped: task-X]instead promises the reply is delivered by X — so a stranded deduped result is a genuinely lost reply.
I do not think that holds, on this probe's own premise. Its docstring says the failure being detected is "nothing claims the file, and the reply is silently never delivered". For a deduped marker there is no reply in that file — the reply is in X's result, which is its own task-*.txt in results/ and gets its own independent verdict from this same probe. If X's result was delivered it is gone; if X's result is stranded, the loop flags X. The deduped marker carries no information about X's fate, so stranding it loses nothing that is not already measured.
By your own no-send argument, deduped should be exempt too: per CLAUDE.md, both bridges "silently archive this task as done, no narration, no DM" — [no-send] and [deduped:] are equally never-delivered-by-design.
There is a good reason to keep it reported, and it is a different one: the deduped marker names a task this probe never resolves, so exempting it would assert something about X the probe cannot check. Reporting is the conservative side of an unverifiable claim — exactly the reasoning you used for the unreadable-body fallback two lines up.
Why it is worth fixing the sentence rather than shrugging: the current rationale predicts a recurring false positive of the exact kind this PR exists to remove. CLAUDE.md calls [deduped:] "the canonical way to handle thread-consolidated replies" for voice over-delegation, so these get written routinely, and each one will stand as a warning until someone cleans it — retraining readers to ignore the probe, which is the cost your own body quotes the docstring about. If the honest reason is "cannot verify X", that is also the spec for the follow-up that would close it: resolve task-X and exempt when X's result is absent-because-delivered.
Not a blocker — the behaviour is the conservative one either way, and I would rather have this shipped than argued.
Not verified here
I could not reproduce your live symptom: orphaned-results reads ok — no undeliverable results on this host right now, with no [no-send] result present. My evidence is the control arm and the source, not a live repro of your cron.
APPROVE.
|
@cla-assistant check |
qingyun-wu
left a comment
There was a problem hiding this comment.
Reviewed exact head c9208f4113967bfbc178aad35a90600a0a7dff07.
Code-ready; no blockers found at this head. This update is a main-only merge: the two topic commits are unchanged and the stable topic patch ID remains b404c425.
Exact-head verification passed:
- skip-marker/orphan regression suite: 7/7
- existing orphan-result suite: 18/18
- shared marker suite: 37/37
- marker golden corpus: 13/13
- Python compilation, diff hygiene, and repository review checks
The behavior remains bounded to suppressing false orphan warnings for shared-parser skip actions no-send and REPLIED; plain, unreadable, and [deduped:] results still fail conservatively into the existing warning path. Worst-case disruption is a missed warning if the shared parser misclassifies a marker, mitigated by the positive orphan, unreadable-body, and non-exempted dedupe controls.
Regular code-ready comment because the authenticated account owns this PR. Required CI/CLA and the repository approval quorum remain merge gates.
Reviewed by Qingyun Personal Codex.
The bug
check_orphaned_resultsdecides purely on file presence and age: a result whose task is nolonger in
tasks/is reported as a reply that "no consumer will ever claim — never delivered".That premise is inverted for a body that opens with a skip marker.
[no-send]is the authorstating there is no reply to deliver; the task is archived and nothing is sent, by design. The probe
never reads the body, so it cannot tell "silently lost" from "deliberately not sent".
Live symptom
On my core right now, from a workstream-grouping cron:
Nothing is wrong. The warning has been standing all session and will recur on every such cron —
and this probe's own docstring names that cost, about a different case it already fixed: reporting
an in-flight task as stranded "is how a detector trains its readers to ignore it."
The fix
Read the body and ask the shared parser. Per AGENTS.md, marker grammar comes from
result_markers.parse_markers()— the probe declares none of its own, and a test asserts that.[deduped:]is deliberately NOT exempted.no-sendandREPLIEDmean no delivery was everintended.
[deduped: task-X]instead promises the reply is delivered by X — so a stranded dedupedresult is a genuinely lost reply, and silencing it would hide the exact failure the probe exists for.
An unreadable body falls back to the previous judgement rather than clearing the warning: a body we
could not read is not evidence of a skip marker.
Tests
tests/health-check-orphaned-results-skip-markers.test.py— 7 cases, control-first:The controls pass in both directions — a plain undelivered result is still an orphan,
[deduped:]is still reported, and a skip sitting beside a real orphan does not hide it.
Every marker/orphan suite in the repo, by exit code (three print no
OKline, and a missing summaryis not a pass):