You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): settled remote delegated tasks stay hidden after their pare… - #42252
When a parent thread on environment A is archived, deleted, or reset, every completed remote delegatedFrom child on linked environment B shows up as a standalone top-level thread in B's sidebar. Old delegated sub-tasks flood the list.
Expected: completed delegated tasks stay grouped under their parent (hidden from the top level) even after the parent is archived, deleted, or gone.
Reproduction: link environments A and B, run several delegate_task calls from a parent on A targeting B, let them finish, then archive or delete the parent (or reset A's statev2.sqlite). B's sidebar lists every finished child.
Change
delegatedUnderParentAtom in packages/client-runtime/src/state/threadShell.ts only hid a delegated child while its parent was in the catalog and unarchived. Otherwise it listed the child on its own, whether or not the child had finished.
Now a settled child (!isChildRunLive) stays hidden regardless of its parent's state. A running or waiting child is still listed on its own when its parent is archived or gone, so unfinished work is never hidden. The logic lives in packages/client-runtime, which web and mobile share (including the command palette), so no per-client change is needed.
This narrows an existing rule. Before, a delegated task whose parent the client could not list always kept its own row, "so its work is never out of reach". That now applies only to live tasks. The comments on isShownUnderParent and resolveListedAncestorThreadRef are updated to match.
Scope
Bug fix for #42226. Related earlier fixes (#34870, #42197) covered trimmed snapshots and unsettled children, not this archive/delete/reset case.
The issue's second option, cascade-archiving remote children on the server, is not part of this PR. It changes the server and wire contract, and would not cover a deleted or reset parent.
Verification
Extended the existing "lists a task a linked environment runs for a listed thread under that thread" test in threadShell.test.ts: after the parent is archived, a settled task stays hidden; it also stays hidden once the parent is removed.
Against HEAD without the fix, the new assertion fails (the settled task is listed). With the fix, threadShell.test.ts passes.
vp run check:changed: format, lint, knip, typecheck and tests pass.
Not checked: a manual pass in the web or mobile client. No screenshots, since the change is in state logic.
Open question for maintainers: a settled child whose parent is archived or gone now has no row in the sidebar, command palette, or archived list (the child itself is not archived on its machine). It is reachable only by direct link. Do you want a way back to those tasks, for example through the archived list? Happy to follow up separately.
No actionable comments were generated in the recent review.
Walkthrough
The delegated task selector now keeps settled delegated tasks hidden when their parent is archived or unavailable. Live tasks with an unlisted parent remain in thread lists. The test covers an archived parent and a cleared parent snapshot.
Changes: Delegated task navigation
Layer / File(s)
Summary
Parent state filtering and test coverage packages/client-runtime/src/state/threadShell.ts, packages/client-runtime/src/state/threadShell.test.ts
Settled delegated tasks are treated as under their parent even when the parent is unavailable or archived. Live tasks remain grouped under the parent only when its environment is enabled and its thread exists and is not archived. The test checks navigation with an archived parent and after its snapshot is cleared.
This stops completed delegated tasks from reappearing as top-level threads after their parent is archived or removed, while unfinished tasks stay visible. The change is small and covered by an extended test, so merge risk is minimal. Settled child tasks in that situation are now reachable only by direct link, which the PR describes as intentional.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix and the affected behavior: settled remote delegated tasks stay hidden after their parent is archived, deleted, or gone. It matches the main change in threadShell.ts and its tes…
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections, and it links issue #42226. It explains the root cause, the narrowed rule, and the tests run. It also nam…
Linked Issues check
[#42226] Requires completed remote delegatedFrom children on linked environment B to stay out of the top-level sidebar when parent A is archived, deleted, or gone. Evidence at head b7b3d97:
1. resolv…
Out of Scope Changes check
The PR, per its description and summary, changes only packages/client-runtime/src/state/threadShell.ts (visibility rule and comments) and threadShell.test.ts (regression assertions). Both serve the #4…
Full details: Title check
Explanation
The title names the fix and the affected behavior: settled remote delegated tasks stay hidden after their parent is archived, deleted, or gone. It matches the main change in threadShell.ts and its test. The text is cut off at the end ('pare…'), which reduces clarity but does not make the title off-topic.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections, and it links issue #42226. It explains the root cause, the narrowed rule, and the tests run. It also names the open question about reachability. The template's screenshot requirement does not apply because the change is in state logic, and the author says so. The author notes that manual web and mobile checks were not run.
Full details: Linked Issues check
Explanation
[#42226] Requires completed remote delegatedFrom children on linked environment B to stay out of the top-level sidebar when parent A is archived, deleted, or gone. Evidence at head b7b3d97:
resolveListedAncestorThreadRef in packages/client-runtime/src/state/threadShell.ts returns the child's own ref when its delegatedFrom parent is missing or archived. A settled child therefore resolves to a ref that matches no row. A live child keeps its own row. This matches the described rule.
isShownUnderParent hides a delegated child whose key is in delegatedUnderParent. The updated comments describe the settled-hidden and live-listed rule.
The PR description and the AI summary agree that delegatedUnderParentAtom now hides a child when !isChildRunLive, whatever the parent state.
The test change extends the existing threadShell.test.ts case to assert that a settled task stays hidden after its parent is archived and after the parent is removed.
Limits: the diff tools failed (changed blobs missing from checkout). The delegatedUnderParentAtom body and the test file were not read directly; the file read was truncated before that atom. The verdict relies on the visible resolver code, the PR description, and the summary. The change since the previous reviewed head (93d98fc) could not be diffed, so it was not separately verified. Reachability of settled children is an open maintainer question. The issue does not require it.
Full details: Out of Scope Changes check
Explanation
The PR, per its description and summary, changes only packages/client-runtime/src/state/threadShell.ts (visibility rule and comments) and threadShell.test.ts (regression assertions). Both serve the #42226 objective. The visible resolver code in threadShell.ts matches that objective. No unrelated change is reported. Limits: the diff tools failed, so the full file list and changed hunks were not read directly. The verdict relies on the PR description and the summary. Changes since the previous reviewed head (93d98fc) could not be diffed.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 93d98fc and b7b3d97.
Files selected for processing: 1
packages/client-runtime/src/state/threadShell.ts
Files skipped from review as they are similar to previous changes: 1
packages/client-runtime/src/state/threadShell.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
No deployments
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
size:S10-29 changed lines (additions + deletions).takeover:blockedTakeover blocked; reason in the PR bodyvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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.
Problem
When a parent thread on environment A is archived, deleted, or reset, every completed remote
delegatedFromchild on linked environment B shows up as a standalone top-level thread in B's sidebar. Old delegated sub-tasks flood the list.Expected: completed delegated tasks stay grouped under their parent (hidden from the top level) even after the parent is archived, deleted, or gone.
Reproduction: link environments A and B, run several
delegate_taskcalls from a parent on A targeting B, let them finish, then archive or delete the parent (or reset A'sstatev2.sqlite). B's sidebar lists every finished child.Change
delegatedUnderParentAtominpackages/client-runtime/src/state/threadShell.tsonly hid a delegated child while its parent was in the catalog and unarchived. Otherwise it listed the child on its own, whether or not the child had finished.Now a settled child (
!isChildRunLive) stays hidden regardless of its parent's state. A running or waiting child is still listed on its own when its parent is archived or gone, so unfinished work is never hidden. The logic lives inpackages/client-runtime, which web and mobile share (including the command palette), so no per-client change is needed.This narrows an existing rule. Before, a delegated task whose parent the client could not list always kept its own row, "so its work is never out of reach". That now applies only to live tasks. The comments on
isShownUnderParentandresolveListedAncestorThreadRefare updated to match.Scope
Bug fix for #42226. Related earlier fixes (#34870, #42197) covered trimmed snapshots and unsettled children, not this archive/delete/reset case.
The issue's second option, cascade-archiving remote children on the server, is not part of this PR. It changes the server and wire contract, and would not cover a deleted or reset parent.
Verification
threadShell.test.ts: after the parent is archived, a settled task stays hidden; it also stays hidden once the parent is removed.HEADwithout the fix, the new assertion fails (the settled task is listed). With the fix,threadShell.test.tspasses.vp run check:changed: format, lint, knip, typecheck and tests pass.Open question for maintainers: a settled child whose parent is archived or gone now has no row in the sidebar, command palette, or archived list (the child itself is not archived on its machine). It is reachable only by direct link. Do you want a way back to those tasks, for example through the archived list? Happy to follow up separately.
Fixes #42226
Claude Sonnet 5.5 via Claude Code