Skip to content

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

Open
dinhphieu wants to merge 1 commit intoanomalyco:devfrom
dinhphieu:fix/session-list-child-dilution
Open

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

Conversation

@dinhphieu
Copy link

@dinhphieu dinhphieu commented Mar 6, 2026

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 100
SELECT CASE WHEN parent_id IS NULL THEN 'ROOT' ELSE 'CHILD' END as type, COUNT(*)
FROM (SELECT * FROM session ORDER BY time_updated DESC LIMIT 100) GROUP BY type;

-- After (with roots:true): all 100 are root sessions
SELECT COUNT(*) FROM (SELECT * FROM session WHERE parent_id IS NULL ORDER BY time_updated DESC LIMIT 100);

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-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 6, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

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

Sign up for free to 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.

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

1 participant