Repository navigation
Promote stale agent targets when live titles prove they are sendable - #7043
Conversation
- Extract centralized `detectAgentSendTitleStatus` helper to determine if an agent is ready or needs permission based on pane and tab titles. - Prevent stale hook-backed status rows from disabling active targets when fresh live titles and PTYs prove they are sendable. - Fallback to the tab's launch agent type when status-backed targets have unknown agent types. - Add comprehensive test coverage for promoting stale pane targets and preserving permission blocks.
|
Ready to review this PR? Stage has broken it down into 4 individual chapters for you:
Chapters generated by Stage for commit 0b1adb5 on Jul 2, 2026 5:41am UTC. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesThis PR adds runtime pane-title resolution metadata, introduces title-based agent send-status detection, and wires that status into running-agent and notes-send target derivation. Running-agent targets now distinguish stale state from permission-required state using live title evidence. Notes-send targets now derive launch candidates per tab, resolve agent type from launch metadata when needed, and merge candidates with pane-aware deduplication. The related tests expand coverage for stale-status behavior, live-title promotion, and split-pane cases. Related PRs: None identified. Suggested labels: area/renderer, refactor, tests Suggested reviewers: None specified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
Introduce `resolveRuntimePaneTitleLeafResolution` to track whether a tab has any reported runtime pane titles. Use this to ensure that a split pane does not fall back to the overall tab title when another pane in the same tab already has active title evidence, avoiding stale target status.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/lib/runtime-pane-title-leaf-id.ts (1)
98-102: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a short "why" comment on the fallback branch.
The
!tabLayout?.root && hasOnePaneTitle && !hasMultiplePaneTitlescondition (and thehasAnyPaneTitle: truesuppression on Line 102) encodes the non-obvious rule that a single reported title only maps to the leaf when no layout root exists, and that any pane title present must suppress stale tab-title fallback elsewhere. The downstream callers (detectLaunchAgentPaneStatus,detectLiveAgentPaneStatus) both carryWhy:comments, but this resolver — where the constraint actually lives — has none.As per coding guidelines: "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."
💬 Suggested comment
+ // Why: with no layout root we can only attribute a title when exactly one + // pane reported one; otherwise flag hasAnyPaneTitle so callers suppress the + // stale tab-title fallback instead of borrowing another pane's title. if (!tabLayout?.root && hasOnePaneTitle && !hasMultiplePaneTitles) { return { title: firstTitle, hasAnyPaneTitle: true } }Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 332cb57f-082c-428a-b6b9-9c0922127d4a
📒 Files selected for processing (7)
src/renderer/src/lib/agent-send-title-status.tssrc/renderer/src/lib/notes-send-agent-targets.test.tssrc/renderer/src/lib/notes-send-agent-targets.tssrc/renderer/src/lib/running-agent-targets.test.tssrc/renderer/src/lib/running-agent-targets.tssrc/renderer/src/lib/runtime-pane-title-leaf-id.test.tssrc/renderer/src/lib/runtime-pane-title-leaf-id.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- src/renderer/src/lib/agent-send-title-status.ts
- src/renderer/src/lib/running-agent-targets.test.ts
- src/renderer/src/lib/notes-send-agent-targets.test.ts
- src/renderer/src/lib/running-agent-targets.ts
- src/renderer/src/lib/notes-send-agent-targets.ts
When a tab layout does not have a root, we can only attribute a single reported pane title. This ensures that any pane title still suppresses the stale tab-title fallback.
…tablyai#7043) * Promote stale agent targets when live titles prove they are sendable - Extract centralized `detectAgentSendTitleStatus` helper to determine if an agent is ready or needs permission based on pane and tab titles. - Prevent stale hook-backed status rows from disabling active targets when fresh live titles and PTYs prove they are sendable. - Fallback to the tab's launch agent type when status-backed targets have unknown agent types. - Add comprehensive test coverage for promoting stale pane targets and preserving permission blocks. * Prevent split panes from borrowing stale tab titles Introduce `resolveRuntimePaneTitleLeafResolution` to track whether a tab has any reported runtime pane titles. Use this to ensure that a split pane does not fall back to the overall tab title when another pane in the same tab already has active title evidence, avoiding stale target status. * Resolve single pane title if tab layout lacks root When a tab layout does not have a root, we can only attribute a single reported pane title. This ensures that any pane title still suppresses the stale tab-title fallback.
Summary
Allows promoting stale agent status-backed panes/tabs to eligible send targets when a live pane or tab title proves the agent is active and idle. Introduces
detectAgentSendTitleStatusto parse titles and verify sendability, preventing sleep/resume or stale timeouts from incorrectly disabling active agent targets.Screenshots
No visual change
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAI Review Report
Reviewed the stale target promotion logic and PTY title detection. Checked that stale status-backed launch agent panes correctly resolve using the fresh live runtime titles, and verified that split-pane deduplication rules are preserved. Explicitly checked cross-platform compatibility: all title parsing logic utilizes standard RegExp and unicode prefix checks that operate identically on macOS, Linux, and Windows.
Security Audit
Conducted a security review. The changes only introduce pure title string regex matching and state derivation in the renderer. There are no IPC changes, no terminal command execution logic modifications, and no external inputs parsed unsafely.
Notes
No platform-specific risks or follow-up work required.