Repository navigation
Fix stale Claude sidebar needs-input status - #4742
austinywang wants to merge 7 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR adds explicit ChangesStatus Tracking and Notification Suppression
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 2 warnings)
✅ Passed checks (14 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Greptile SummaryThis PR fixes stale "Needs input" in the Claude sidebar (#1027) by persisting a
Confidence Score: 4/5Safe to merge for the targeted idle-prompt bug fix; the parallel runtimeStatus field and partial km locale introduction are worth resolving before the PR is considered complete. The suppression logic is narrow and well-tested — the regression covers both flat and nested idle-prompt payloads and asserts the right stdout and absence of sidebar/alert commands. The localization updates for the 19 already-supported locales are complete. Two areas need attention: runtimeStatus is a new side-channel field that duplicates information already present in agentLifecycle and lastNotificationStatus without a documented invariant tying them together, and km is introduced for only three of the catalog's many strings, leaving Khmer-locale users with a patchy translation experience. CLI/cmux.swift — the relationship between runtimeStatus and agentLifecycle; Resources/Localizable.xcstrings — the partial km locale rollout. Important Files Changed
Sequence DiagramsequenceDiagram
participant Claude
participant Hook as Claude Hook Handler
participant Store as Session Store
participant Sidebar
Claude->>Hook: session-start
Hook->>Store: "upsert runtimeStatus=.running (if clear/replace)"
Hook->>Sidebar: set_status Running
Claude->>Hook: prompt-submit
Hook->>Store: "upsert runtimeStatus=.running"
Hook->>Sidebar: set_status Running
Claude->>Hook: stop
Hook->>Store: "upsert runtimeStatus=.idle, lastNotificationStatus=.idle"
Hook->>Sidebar: set_status Idle
Claude->>Hook: notification idle_prompt stale post-stop
Hook->>Store: read runtimeStatus .idle
Note over Hook: shouldSuppressClaudeIdlePromptNotification = true
Hook-->>Claude: "print {} suppressed no sidebar update"
Claude->>Hook: notification real needs-input
Hook->>Store: read runtimeStatus .idle or .running
Note over Hook: isIdlePromptNotification = false OR runtimeStatus ne .idle
Hook->>Store: "upsert runtimeStatus=.needsInput, lastNotificationStatus=.needsInput"
Hook->>Sidebar: set_status Needs input
Hook->>Claude: notify_target_async user alert
Reviews (6): Last reviewed commit: "merge: resolve conflicts with main" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CLI/cmux.swift`:
- Around line 19727-19734: The suppression branch currently writes "OK" to
stdout but other hook completions return an empty JSON object string; update the
suppression path inside the shouldSuppressClaudeIdlePromptNotification
conditional to print an empty JSON object (e.g. use print("{}") so it emits
"{}\n") instead of print("OK"), keeping the
telemetry.breadcrumb("claude-hook.notification.idle-prompt-suppressed") and the
early return in place to preserve behavior.
- Line 19504: The localized string keys used in CLI/cmux.swift (e.g.,
String(localized: "agent.generic.status.running"),
"agent.generic.notification.status.idle", and
"cli.claude-hook.status.needsInput") are missing translations for several
supported locales; update Resources/Localizable.xcstrings to add the missing
locale entries for these keys (add km for agent.generic.status.running; add ar,
bs, da, de, es, fr, it, km, ko, nb, pl, pt-BR, ru, th, tr, uk, zh-Hans, zh-Hant
for agent.generic.notification.status.idle and
cli.claude-hook.status.needsInput) so all locales referenced by the app have
translations; verify the usages at the other sites in CLI/cmux.swift (around the
occurrences noted) still reference the same keys and run localization validation
to ensure no missing-key warnings remain.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0d984384-5686-4b5d-984e-02e278e56c76
📒 Files selected for processing (3)
CLI/cmux.swiftResources/Localizable.xcstringscmuxTests/CLINotifyProcessIntegrationRegressionTests.swift
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4c31a63. Configure here.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Resources/Localizable.xcstrings`:
- Line 22441: The localization entry for key "agent.generic.status.running"
contains many non-English locale slots set to the English word "Running"; update
each non-English locale stringUnit value to a proper translation (or remove the
locale slot if a genuine translation is not available) so no locale uses copied
English, ensuring every locale follows the project's placeholder/copy rules and
leaving only true translations for the "agent.generic.status.running" key.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 87622493-4a03-43f9-b179-3a4f1e79851a
📒 Files selected for processing (3)
CLI/cmux.swiftResources/Localizable.xcstringscmuxTests/CLINotifyProcessIntegrationRegressionTests.swift
Superseded by follow-up commits addressing the actionable CodeRabbit findings; the inline threads are resolved and the CodeRabbit check is green.

Summary
idle_promptnotifications so they do not relight Needs input or fire a user-facing alertIssue
Testing
Scope
idle_promptfalse-positive path from the issue discussion. Broader cross-agent shell-state reconciliation can follow separately if other agents still report stale Running state.Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.Note
Low Risk
Targeted Claude hook notification and session-state updates with a regression test; no auth or broad architectural changes.
Overview
Claude Code hook handling now persists
runtimeStatusandlastNotificationStatuson session upserts for start, stop, prompt-submit, and notification paths so sidebar state matches the real turn lifecycle.Post-stop
idle_promptnotifications are suppressed when the mapped session is already idle (including nesteddata.notification_typesignals), so the UI does not flip back to Needs input or firenotify_target_asyncafter a completed stop.Status labels for Running, Idle, and Needs input use
agent.generic.*localized strings instead of hardcoded English, with expanded locale entries inLocalizable.xcstrings. A regression integration test covers the idle-prompt-after-stop scenario.Reviewed by Cursor Bugbot for commit 2ffb7b2. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes #1027 by preventing stale “Needs input” in the Claude sidebar via runtime/notification state tracking and by suppressing post‑stop
idle_promptnotifications (flat and nested). Finalizes localized status strings and uses generic agent keys for Running/Idle/Needs input across locales.idle_promptafter stop (including nested signals) so it doesn’t relight “Needs input” or trigger alerts.agent.generic.status.running,agent.generic.notification.status.idle,agent.generic.notification.status.needsInput; add a regression test covering flat and nested idle‑prompt paths.Written for commit 2ffb7b2. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
New Features
Bug Fixes
Tests