GeezerVison is showing github.com — Backstop reminders: the orphan scan logs a refused batch once per run, also past a day by scuttletoby · Pull Request #755 · scuttletoby/t3code
Conversation
What and why
The three minor points from the #751 review (#751 (comment)).
- The orphan scan logs a refused batch once per run, also past a day. Backstop reminders: log each refused batch once per run, whoever holds it #751 gave the reminder and the orphan scan the same refusal record (
makeRefusalLog), which forgets a logged id after REMINDER_MAX_AGE_MS. That is exact for the reminder: a batch's tasks ended before its refusal, so a day later they are no longer remindable and the id cannot come back. It is not exact for the orphan scan. An orphan batch's ids do not depend on time, and untilSlot checks its parent again for as long as the slot gate refuses. A refused batch that comes before a batch waiting for a slot is sent to deliver again on every pass, so after a day it was logged again, once a day.
- Root fix:
makeRefusalLog(forgetAfterMs) takes when an id can no longer come back. The reminder keeps the one-day default. The orphan scan passes null: its ids are kept for the process, so the pruned id is never pruned while it can still come back.
- Why not "recompute the window per scan" (the other option in the issue): the window (
sinceMs) only tells listLinkedThreads where to stop paging; it filters nothing, and untilSlot re-checks with the list it already has. A moving window would not stop the refused batch from coming back, so it would not fix the repeat.
- Memory: the orphan scan runs once per start (
run), so the record holds at most the refused orphan batches of that run.
- Orphan-scan test for a receipt another thread holds. Same case as the reminder's test: three passes log once, a restart logs once more, nothing is sent.
- README: the line Backstop reminders: log each refused batch once per run, whoever holds it #751 left at 167 characters in the delegated result reminder paragraph is re-wrapped, with the rest of that paragraph after it (one more line there was 108 characters). Text unchanged (checked word for word).
Tests
- On the old code (origin/main's
delegatedResults.ts and DelegatedOrphanScan.ts, run with the new tests): 2 of the 3 new tests fail.
DelegatedOrphanScan.test.ts "a refused message before one that waits for a slot is logged once, also past a day": the refusal is logged twice (once at the first check, again after a day of slot waiting). This is the bug.
delegatedResults.test.ts "keeps a refusal for the whole process when told never to forget": on main the id is forgotten after a day.
DelegatedOrphanScan.test.ts "a receipt another thread holds warns once per run, not on every pass" passes on main: point 2 is a missing test, not a bug. It goes red when the orphan scan's guard is removed (below).
- Remove-one-line checks (each alone, tests run, restored):
makeRefusalLog(null) → makeRefusalLog() in the orphan scan: 1 fails (the past-a-day test).
- the
if (forgetAfterMs !== null) guard in makeRefusalLog (prune always): 5 fail, including the new unit test, the past-a-day test and the other-thread test.
- the orphan scan's
if (newRefusal(...)) guard → if (true): 4 fail, including the new other-thread and past-a-day tests.
- The state question:
- Runs again: a refused batch, or another thread's receipt, checked again (also for 26 hours of slot waiting) gives no new warning.
- Stopped half-way: unchanged from Backstop reminders: log each refused batch once per run, whoever holds it #751; the refused receipt is logged once on the first check after the restart (existing test still passes).
- After a restart: a batch still refused is logged once more (the new other-thread test checks it, and the unit test checks a fresh record).
- Old, empty or missing state: nothing is stored, so there is nothing to migrate; a new process starts with an empty record.
- The past-a-day test also checks the end: once a slot frees, the waiting batch is sent once, the refused one stays refused and is not logged again, and the run ends.
pnpm --filter ./apps/server exec vp test run src/fork/delegatedResults src/waits/WaitDelivery: 117 pass.
vp run check:changed: format, lint, knip, graphql, typecheck and tests pass.
node .github/scripts/fork-seam-check.cjs --config-ref origin/main origin/main HEAD: passes. All changed files are fork-owned (apps/server/src/fork/, docs/fork/), so no seam PR is needed.
Left as is
General vs project
All general: logging rules for any T3 user with server.waitFor on. No project facts or settings were added. The README's wording ("logged once per server run") was already right for the orphan scan; now the code matches it.
Closes #753
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…, also past a day
The orphan scan forgot a logged refusal after a day, like the reminder.
Its batch ids do not age and a slot wait checks its parent again for as
long as the slot stays taken, so a refused batch ahead of one waiting
for a slot was logged again each day. It now keeps its ids for the run.
Also adds the orphan-scan test for a receipt another thread holds, and
re-wraps the README paragraph #751 left with one long line.
Closes #753
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review of #755 (head cb249b8): SAFE
Verdict: SAFE to merge. I found nothing blocking or major. The orphan scan now logs a refused batch once per run, including when a slot wait lasts more than a day. The reminder still forgets a logged id after a day. A refused batch cannot go unlogged in a run, and it is not logged twice in a run.
What I checked
- Read Backstop reminder minors from the #751 review #753, the Backstop reminders: log each refused batch once per run, whoever holds it #751 review it links, Backstop reminders: log each refused batch once per run, whoever holds it #751, Backstop reminders: skip only an unreadable old message, guard the over-ten split, warn once per refused batch #745, the whole diff,
makeRefusalLog and both of its callers, DelegatedOrphanScan (checkParent, listByParent, untilSlot, run, layerWith), listLinkedThreads, orphanBatches / orphanBatchIds and DelegatedResultsStore.sentIds.
- Tests on the head (in a separate worktree):
src/fork/delegatedResults + src/waits/WaitDelivery, 117/117 pass.
- Remove-one-line checks (each alone, then restored). All went red, with the same counts as the PR body:
makeRefusalLog(null) → makeRefusalLog() (DelegatedOrphanScan.ts:125): 1 fails (the past-a-day test).
if (forgetAfterMs !== null) → if (true) (delegatedResults.ts:123): 5 fail.
- orphan guard
if (newRefusal(...)) → if (true) (DelegatedOrphanScan.ts:187): 4 fail.
- My own extra check: default
= REMINDER_MAX_AGE_MS → = null (delegatedResults.ts:120): 1 fails (the reminder's "forgets it after a day" test). So the reminder's one-day forget is still covered.
- README: the words are the same before and after (diffed word by word). No line in the changed paragraph is over 100 characters now.
- CI on cb249b8: 22 pass, 12 skipped. When I read it, 3 were still running: Test Server 6, Workflow lint, Secret scan.
The root-cause claim
It is right. sinceMs is used only in listLinkedThreads's stop test (linkedThreads.ts:75-77: "stop after a page whose oldest thread was last updated before this"). It drops no thread. Also, untilSlot calls checkParent with the linked list it already holds (DelegatedOrphanScan.ts:325) and lists again only after sent/none. So a window recomputed on each scan would never reach the slot-wait loop where the repeat happens. Keeping the ids is the fix that targets that loop.
The state question
- Runs again: an orphan batch's ids depend only on the parent and the orphan keys, never on time. With
null, a logged id stays logged for as long as the instance lives, so every later pass returns false. This holds for the parent's own refused receipt and for a receipt another thread holds (same commandId). The new test checks 3 passes plus 26 hours of slot waiting.
- Logged more than once per run? No. The orphan scan never removes an id. The reminder has a separate record and a different id prefix. A regrouped batch (after a relist, or after a send changes
told) has a new commandId, so it counts as a new message and is logged once. That matches the existing rule that a new batch warns again.
- Unlogged? An id gets into the record only on the call that returns
true, and the warning follows right after it. The only gap is the one already accepted in Backstop reminders: log each refused batch once per run, whoever holds it #751: the fiber is interrupted between newRefusal and logWarning. That can happen only on shutdown, and the next start logs the batch again.
- Stopped half-way, restart, old or empty state: nothing is stored. A new process (a new
make) starts with an empty record and logs a batch that is still refused once more. The new other-thread test checks this (toHaveLength(2)), and so does the unit test with a new makeRefusalLog(null). There is nothing to migrate.
- Memory: this is bounded.
make runs once per layer build (layerWith → forkParked(run()), once per process, and never on a held server). scan and checkParent are not exposed outside tests. run scans at most attempts times. Each untilSlot lists again at most once. Within one list, batches change only when sentIds grows (monotonic, a finite number of orphans). So the record holds at most the refused orphan messages of that run, usually zero to a few strings. Skipping the prune for null also skips the walk of the whole Map.
- Reminder unchanged:
DelegatedResultReminder.ts:91 still calls makeRefusalLog(), so it gets the one-day default. The > boundary and its test are the same as before.
Blocking
None.
Major
None.
Minor (not blocking)
delegatedResults.ts:120-131: with null, the stored timestamp is never read. A Set would show that more clearly, but one shared helper is simpler. This is a cosmetic point only.
DelegatedOrphanScan.ts:122-124, the comment says "at most the refused batches of that run": that is right, but a regrouped batch (new keys after a relist) counts as another entry. Optional: add "(a regrouped batch is a new one)".
🤖 Generated with Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 21, 2026
scuttletoby
added a commit
that referenced
this pull request
Nov 21, 2026
…, also past a day (#755)
The orphan scan forgot a logged refusal after a day, like the reminder.
Its batch ids do not age and a slot wait checks its parent again for as
long as the slot stays taken, so a refused batch ahead of one waiting
for a slot was logged again each day. It now keeps its ids for the run.
Also adds the orphan-scan test for a receipt another thread holds, and
re-wraps the README paragraph #751 left with one long line.
Closes #753
Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby
added a commit
that referenced
this pull request
Nov 21, 2026
…, also past a day (#755)
The orphan scan forgot a logged refusal after a day, like the reminder.
Its batch ids do not age and a slot wait checks its parent again for as
long as the slot stays taken, so a refused batch ahead of one waiting
for a slot was logged again each day. It now keeps its ids for the run.
Also adds the orphan-scan test for a receipt another thread holds, and
re-wraps the README paragraph #751 left with one long line.
Closes #753
Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby
added a commit
that referenced
this pull request
Nov 21, 2026
…, also past a day (#755)
The orphan scan forgot a logged refusal after a day, like the reminder.
Its batch ids do not age and a slot wait checks its parent again for as
long as the slot stays taken, so a refused batch ahead of one waiting
for a slot was logged again each day. It now keeps its ids for the run.
Also adds the orphan-scan test for a receipt another thread holds, and
re-wraps the README paragraph #751 left with one long line.
Closes #753
Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby
added a commit
that referenced
this pull request
Nov 28, 2026
…, also past a day (#755)
The orphan scan forgot a logged refusal after a day, like the reminder.
Its batch ids do not age and a slot wait checks its parent again for as
long as the slot stays taken, so a refused batch ahead of one waiting
for a slot was logged again each day. It now keeps its ids for the run.
Also adds the orphan-scan test for a receipt another thread holds, and
re-wraps the README paragraph #751 left with one long line.
Closes #753
Co-authored-by: Claude Opus 5.5 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|