Skip to content

fix(tui): pass roots:true in session list bootstrap to fix child session dilution - #16273

Closed
dinhphieu wants to merge 1 commit into
anomalyco:devfrom
dinhphieu:fix/session-list-child-dilution
Closed

fix(tui): pass roots:true in session list bootstrap to fix child session dilution#16273
dinhphieu wants to merge 1 commit into
anomalyco:devfrom
dinhphieu:fix/session-list-child-dilution

Conversation

@dinhphieu

@dinhphieudinhphieu commented Mar 6, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#16270
Closes#13877

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The TUI session list bootstrap in sync.tsx fetches sessions without passing roots: true. This means root sessions and child sessions (forks, compaction) are mixed together. Session.list() defaults to LIMIT 100, and the TUI dialog filters client-side with .filter(x => x.parentID === undefined).

For users who spawn subagents/tasks heavily, child sessions vastly outnumber roots. In my case: top 100 by time_updated contains 95 children and only 5 roots. So /sessions shows ~5 conversations despite 584 existing in the DB.

Fix: add roots: true to the bootstrap call so the server applies WHERE parent_id IS NULL before the limit. All 100 slots go to actual conversations.

How did you verify your code works?

Verified against a production DB with 8,976 sessions (584 root, rest children):

-- Before (without roots:true): 95 children, 5 roots in top 100SELECT CASE WHEN parent_id IS NULL THEN 'ROOT' ELSE 'CHILD' END as type, COUNT(*)
FROM (SELECT*FROM session ORDER BY time_updated DESCLIMIT100) GROUP BY type;
-- After (with roots:true): all 100 are root sessionsSELECTCOUNT(*) FROM (SELECT*FROM session WHERE parent_id IS NULLORDER BY time_updated DESCLIMIT100);

Screenshots / recordings

N/A — not a UI change, just a query parameter fix.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actionsgithub-actionsBot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 6, 2026
@github-actionsgithub-actionsBot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 6, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI /sessions picker only shows recent sessions /sessions TUI only shows recent sessions, ignores historical ones

1 participant

@dinhphieu