Fix stale Claude sidebar needs-input status

Closed
AU
2mo ago
+357-7

Summary

  • track Claude hook runtime state when the sidebar is set to Running, Idle, or Needs input
  • suppress post-stop Claude idle_prompt notifications so they do not relight Needs input or fire a user-facing alert
  • localize the Claude needs-input sidebar status and add a regression test for the stale idle-prompt path

Issue

Testing

  • Not run locally per repository/user policy; CI will run the regression.

Scope

  • This PR handles the deterministic Claude idle_prompt false-positive path from the issue discussion. Broader cross-agent shell-state reconciliation can follow separately if other agents still report stale Running state.

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with 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 runtimeStatus and lastNotificationStatus on session upserts for start, stop, prompt-submit, and notification paths so sidebar state matches the real turn lifecycle.

Post-stop idle_prompt notifications are suppressed when the mapped session is already idle (including nested data.notification_type signals), so the UI does not flip back to Needs input or fire notify_target_async after a completed stop.

Status labels for Running, Idle, and Needs input use agent.generic.* localized strings instead of hardcoded English, with expanded locale entries in Localizable.xcstrings. A regression integration test covers the idle-prompt-after-stop scenario.

Reviewed by Cursor Bugbot for commit 2ffb7b268ec8cee1341c98cc38376133edc75096. 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_prompt notifications (flat and nested). Finalizes localized status strings and uses generic agent keys for Running/Idle/Needs input across locales.

  • Bug Fixes
    • Persist runtime and last-notification status to keep the sidebar accurate (Running/Idle/Needs input).
    • Suppress idle_prompt after stop (including nested signals) so it doesn’t relight “Needs input” or trigger alerts.
    • Localize status labels via 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.

Summary by CodeRabbit

  • New Features

    • Session status messages now use localized lookups and localization coverage expanded beyond English/Japanese.
  • Bug Fixes

    • Suppress idle-prompt notifications so sessions are not incorrectly marked as "Needs input" after stop; idle/needs-input status handling improved.
  • Tests

    • Added regression test to verify idle-prompt notification handling and status update behavior.

Review Change Stack