Repository navigation
fix(server): archiving a parent no longer kills a child's pending check-back - #1056
Merged
Merged
Conversation
…ck-back A child thread that answered its parent and set a check-back (one that lives only in its Claude session) counted as settled, so archiving the parent archived the child too and stopped its session. The check-back died with it, and unarchiving brought back the thread but not the check-back. The rule the idle reaper uses to keep such a runtime now lives in @threadlines/shared/checkBacks (runtimeCheckBackOwed, holdsRuntimeCheckBack). The archive cascade (childArchivePlan) separates a child that holds one instead of archiving it, and the auto-archive sweeper leaves its parent alone, as it does a parent with a working child. Durable check-backs and ones long past their time don't count. childHasLiveWork is unchanged: its other callers (wrap, thread_wrap, stop targets, moves, alerts, late replies) mean "working now", and a check-back doesn't keep a thread out of Wrapped.
… no clock Review follow-ups to the archive cascade fix: - Auto-archive and "Archive inactive threads now" could still archive the child (or any thread) holding the check-back directly. The rule now lives in isAutoArchiveProtectedThread, which both paths use. - The cascade read the decider's clock to judge a check-back's grace window, so one command could decide differently around a boundary. holdsRuntimeCheckBack is now time-free: any check-back not saved to outlive the runtime counts. The idle reaper is back to its own rule. - So a stale entry can't block auto-archive for good, thread.archive clears the runtime-only check-backs of every thread it archives, with a "Check-back ended" note. The runtime's report of them comes after the archive and was never recorded for an archived thread. - A linked child stopped for an archived parent's open request still loses its check-backs; documented as a known limit.
…earing Second review round on the archive cascade fix: - Drop the check-back clearing inside thread.archive. It could report a check-back ended while a room agent's runtime still held it (the named archive stops only the projected session), and two agents with the same schedule id shared one note id. - The cascade keeps its time-free rule (holdsRuntimeCheckBack): a stale entry only leaves a child as its own thread. - Auto-archive and "Archive inactive threads now" use the idle reaper's time-windowed rule (runtimeCheckBackOwed, now in shared/checkBacks), so an entry whose runtime ended unreported, or one from before this fix, stops protecting a thread on its own. The reaper's behavior is unchanged. - The sweeper rereads each candidate before archiving it, and the Settings button re-checks each thread against the live store, so one that set a check-back since the list was made is left alone.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A child thread that answered its parent, set a check-back that lives only in its Claude session, and went idle counted as settled. Archiving the parent (by hand or through auto-archive) archived the child with it and stopped its session, so the check-back died. Unarchiving brought the thread back but not the check-back, and the work the agent promised was lost without a word. Auto-archive and Settings' "Archive inactive threads now" had the same hole for any thread, child or not.
Fix
childArchivePlanseparates a child holding any check-back that isn't saved to disk (holdsRuntimeCheckBack), so its session keeps running. The rule reads no clock, so the decider stays deterministic; a stale entry only leaves a child as its own thread.isAutoArchiveProtectedThreadskips a thread whose check-back is still owed, by the idle reaper's own rule (runtimeCheckBackOwed, moved to@threadlines/shared/checkBacks): a one-off until a little past its time, a repeating one until Claude would have dropped it. These paths read the clock, so an entry whose runtime ended without its report landing stops protecting the thread on its own. The sweeper also skips a parent whose child holds one.childHasLiveWorkis unchanged. Its other callers (wrap rules,thread_wrap, stop targets, checkout moves, push alerts, late replies) mean "working right now", and the Nov 9 snooze decision says a check-back doesn't keep a thread out of Wrapped. The idle reaper's behavior is unchanged; it now reads its rule from the shared module.Known limits
peer.thread.stop), and that stop ends its session-only check-backs. Interrupting only its turn would leave background work running there that nothing on this computer shows.Tests
decider.childThreads.test.ts: archiving a parent separates a child with a session-only check-back and archives one with a saved check-back.ThreadAutoArchiveSweeper.test.ts: the sweeper neither archives nor stops a child holding a check-back and skips its parent; a two-day-old stale entry no longer protects; a thread that set a check-back after the snapshot isn't archived.threadAutoArchive.test.ts(shared): a thread with an owed check-back is no candidate; a saved one, a stale one-off and a stale repeating one don't protect it.