Skip to content

Fix /resume flooding with sub-run sessions - #169

Merged
gnanam1990 merged 1 commit into
mainfrom
fix/resume-session-list
Jun 11, 2026
Merged

Fix /resume flooding with sub-run sessions#169
gnanam1990 merged 1 commit into
mainfrom
fix/resume-session-list

Conversation

@gnanam1990

@gnanam1990 gnanam1990 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

/resume showed a session list ending in "… 779 more · /resume " — far more sessions than real conversations. Root cause: the picker called sessions.Store.List() unfiltered, so it listed every session directory, including the child (specialist/sub-agent) and spec-draft/spec-impl sessions an agent spawns by the dozen. The TUI itself creates exactly one session per conversation (ensureActiveSession guards on the active id and appends events), so the flood was entirely the unfiltered listing.

Fix

  • Add sessions.IsResumableKind, Store.ListResumable(), and Store.LatestResumable() — they keep only standalone conversations (regular + user forks) and drop child / spec-draft / spec-impl sub-runs.
  • /resume picker uses ListResumable(); the "N more" count is now honest.
  • /resume latest uses LatestResumable() so it never lands on a newer child/spec sub-run.
  • /resume <id> is unchanged — an explicit id still resolves any session.

Tests

  • TestListAndLatestResumableExcludeSubRuns — store-level: only regular+fork listed; latest skips a newer child.
  • TestResumePickerExcludesSubRunSessions — TUI picker lists the real conversation, excludes child/spec.

go build, full go test ./..., go vet, gofmt all clean.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the resume session picker to display only standalone conversations and exclude sub-runs (child sessions and spec drafts), providing a cleaner selection experience.
    • Fixed the latest resume feature to correctly identify and select the most recent resumable conversation instead of sub-runs.

The /resume picker called sessions.Store.List() unfiltered, so it showed every
session directory — including the child (specialist/sub-agent) and spec
draft/impl sessions an agent spawns by the dozen per conversation. That flooded
the picker (the reported '… 779 more · /resume <id>') even though the TUI
creates exactly one session per conversation.

Add Store.ListResumable()/LatestResumable() (and an IsResumableKind predicate)
that keep only regular and user-fork sessions, and use them for the picker and
for '/resume latest' so latest never lands on a newer child/spec sub-run. An
explicit '/resume <id>' still resolves any session by id.

Covered by TestListAndLatestResumableExcludeSubRuns and
TestResumePickerExcludesSubRunSessions.
@github-actions

Copy link
Copy Markdown
Contributor

Zero automated PR review

Verdict: No blockers found

Blockers

  • None found.

Validation

  • [pass] Diff hygiene: git diff --check
  • [pass] Tests: go test ./...
  • [pass] Build: go run ./cmd/zero-release build
  • [pass] Smoke build: go run ./cmd/zero-release smoke

Scope

Head: 7ac60b437bbe
Changed files (5): internal/sessions/store.go, internal/sessions/store_test.go, internal/tui/command_center.go, internal/tui/session.go, internal/tui/session_test.go

This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 08f17d9c-e00c-4e37-b934-434d741c7a8d

📥 Commits

Reviewing files that changed from the base of the PR and between e381d8e and 7ac60b4.

📒 Files selected for processing (5)
  • internal/sessions/store.go
  • internal/sessions/store_test.go
  • internal/tui/command_center.go
  • internal/tui/session.go
  • internal/tui/session_test.go

Walkthrough

The PR adds resumable-session filtering to prevent child runs and spec drafts from cluttering the /resume picker. New IsResumableKind, ListResumable, and LatestResumable helpers filter the session store to user-resumable kinds (regular and fork), then integrate into TUI resume picker and latest-resume resolution logic.

Changes

Resume session filtering by kind

Layer / File(s) Summary
Session store resumable filtering API
internal/sessions/store.go, internal/sessions/store_test.go
IsResumableKind classifies SessionKind values as resumable (regular "" and fork only), ListResumable filters the existing list preserving newest-first order, and LatestResumable returns the most recent resumable session or nil. Test verifies both methods correctly exclude child and spec-draft kinds while selecting the expected resumable session as the latest.
TUI resume picker and latest-resume integration
internal/tui/command_center.go, internal/tui/session.go, internal/tui/session_test.go
resumeText now uses ListResumable() to filter the picker list, and resolveResumeSession uses LatestResumable() for the "latest" target. Integration test confirms the picker UI includes real conversations while excluding specialist runs and spec drafts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Gitlawb/zero#69: Both PRs modify TUI resume behavior—this PR changes resolveResumeSession to use LatestResumable() for filtering sub-runs, while the retrieved PR implements /resume/latest session hydration and selection in internal/tui/session.go.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and concisely describes the main change: filtering the /resume command to exclude sub-run sessions that were causing list flooding.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/resume-session-list

Comment @coderabbitai help to get the list of available commands and usage tips.

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Cross-checked this against the D session flow and the direction matches: normal resume/latest should only surface user-resumable top-level conversations, while explicit resume by id still works. Local validation passed with go test ./internal/sessions ./internal/tui and go test ./.... No blockers from my side.

@gnanam1990
gnanam1990 merged commit 8409cb4 into main Jun 11, 2026
6 checks passed
@Vasanthdev2004
Vasanthdev2004 deleted the fix/resume-session-list branch June 28, 2026 08:27
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.

2 participants