fix(cli): respect project scope on TUI session refresh#1587
Conversation
The sessions view only used project-scoped fetching when both currentProject and currentAgentID were set. When a user switched projects via number keys (which clears currentAgentID), the initial fetch was correctly scoped but every subsequent poll tick fell through to FetchAllSessions(), replacing the filtered view with all sessions. Fix fetchActiveView() and CmdSessions to check currentProject independently of currentAgentID. This matches the spec: "`:sessions` is also accessible globally or scoped when drilled in." Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for cheerful-kitten-f556a0 canceled.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughSessions view now prioritizes project-scoped fetching in ChangesProject-Scoped Sessions View
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 8✅ Passed checks (8 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add dataFetcher interface and scopeTrackingClient fake to verify fetchActiveView() dispatches the correct fetch method based on currentProject state. Tests cover: - Project set via number key (no agent) → must use FetchSessions - Project + agent set (drill-down) → must use FetchSessions - No project (global) → must use FetchAllSessions - Scheduled sessions and agents scoping Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merge Queue Status
This pull request spent 27 seconds in the queue, including 5 seconds running CI. Required conditions to merge |
Summary
Problem
When a user presses a number key (1-9) to switch projects in the TUI,
currentAgentIDis cleared (correct — you're not drilling into a specific agent). The initial fetch correctly callsFetchSessions(projectName). But on the next 5-second poll tick,fetchActiveView()checkedcurrentAgentID != "" && currentProject != ""— sincecurrentAgentIDis empty, it fell through toFetchAllSessions(), replacing the project-filtered view with all sessions across all projects.The same issue existed in the
:sessionscommand handler (CmdSessions).Fix
fetchActiveView(): checkcurrentProjectalone — if set, fetch project-scoped sessions regardless of agent contextCmdSessions: add acurrentProject-only branch between the agent-scoped and global pathsThe TUI spec (
docs/internal/design/tui.spec.md) correctly describes this behavior: ":sessionsis also accessible globally (all sessions across all projects) or scoped when drilled in." The spec was right, the implementation didn't match.Test plan
go build ./...passesgo vet ./...passes🤖 Generated with Claude Code
Summary by CodeRabbit