Repository navigation
Conversation
Harness-injected UserPromptSubmit (compact summary, task notifications, local-command machinery) no longer mints a working row without a Stop. Claude PreCompact marks busy and PostCompact resolves to done so finished compaction cannot leave the sidebar spinner stuck. Fixes stablyai#11352
Greptile SummaryThis PR fixes a bug where Claude (and Kimi) worktrees would stay stuck on a Working… spinner indefinitely after
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to two event normalizers, the guard delegates entirely to the pre-existing isKnownHarnessInjectedUserTurnText allowlist, and no prompt-cache or subagent-roster paths are touched. Both changed code paths (normalizeClaudeEvent and normalizeKimiEvent) are well-isolated and thoroughly tested. The harness-guard short-circuits only when the event is UserPromptSubmit AND the prompt text matches a known harness prefix — real user prompts, array-format Kimi prompts, and custom-element pastes all pass through unchanged. PreCompact/PostCompact additions mirror the existing Devin PostCompaction pattern and have no side-effects on the subagent roster or prompt cache. The previous gap in Kimi test coverage is now closed. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/shared/agent-hook-listener.ts | Adds shouldIgnoreHarnessInjectedUserPromptSubmit helper shared by Claude and Kimi normalizers; maps PreCompact→working and PostCompact→done for both agents. Logic is correct, guard correctly delegates to the pre-existing isKnownHarnessInjectedUserTurnText, and subagent/prompt-cache paths are unaffected. |
| src/shared/agent-hook-listener.test.ts | Adds Kimi harness-guard and compact lifecycle tests (addressing the prior P2 comment), rewrites two Claude harness tests to match null-return semantics, and adds PreCompact/PostCompact and sticky-working regression tests for Claude. Coverage is thorough for all changed paths. |
Sequence Diagram
sequenceDiagram
participant U as User
participant C as Claude TUI
participant H as Hook Listener
participant S as Agent Status (sidebar)
Note over U,S: Real user turn (unchanged)
U->>C: types "fix login"
C->>H: "UserPromptSubmit {prompt: "fix login"}"
H->>S: working ("fix login")
C->>H: "PreToolUse {tool: Bash}"
H->>S: working ("fix login")
C->>H: Stop
H->>S: done ("fix login")
Note over U,S: /compact BEFORE this PR (bug)
U->>C: /compact
C->>H: "UserPromptSubmit {prompt: "/compact"}"
H->>S: working ("/compact")
C->>H: "UserPromptSubmit {prompt: "This session is being continued..."}"
H->>S: working ("") sticky, no Stop ever arrives
Note over U,S: /compact AFTER this PR (fixed)
U->>C: /compact
C->>H: "UserPromptSubmit {prompt: "/compact"}"
H->>S: working ("/compact")
C->>H: PreCompact
H->>S: working ("/compact")
C->>H: "UserPromptSubmit {prompt: "This session is being continued..."}"
H-->>S: null (ignored, harness machinery)
C->>H: PostCompact
H->>S: done ("/compact")
Reviews (2): Last reviewed commit: "test(agent-status): cover Kimi compact g..." | Re-trigger Greptile
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughUpdated Claude and Kimi event normalization to ignore harness-injected 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/shared/agent-hook-listener.ts (1)
2562-2569: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicated harness-injected guard across
normalizeClaudeEventandnormalizeKimiEvent. Both functions inline the identicaleventName === 'UserPromptSubmit' && isKnownHarnessInjectedUserTurnText(promptText)check; extracting a shared helper avoids the two agent paths drifting apart on this exact bug class (issue#11352) in the future.
src/shared/agent-hook-listener.ts#L2562-L2569: replace the inline guard innormalizeClaudeEventwith a call to a sharedshouldIgnoreHarnessInjectedUserPromptSubmit(eventName, promptText)helper.src/shared/agent-hook-listener.ts#L2787-L2792: replace the inline guard innormalizeKimiEventwith the same shared helper.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 96102564-c96c-4196-b413-485b537c50e0
📒 Files selected for processing (2)
src/shared/agent-hook-listener.test.tssrc/shared/agent-hook-listener.ts
Address Greptile/CodeRabbit review on stablyai#11353: extract a shared shouldIgnoreHarnessInjectedUserPromptSubmit helper for Claude and Kimi, and add Kimi harness + PreCompact/PostCompact regression tests so the parallel path cannot drift.
|
Thanks Greptile + CodeRabbit — addressed in ccaca5ef6:
Skipped the Docstring Coverage pre-merge warning — this file follows the repo’s |
|
Thanks for working on the stuck The blocking sequence is:
The hook payload has no provider-issued compact operation ID, so generation 1s delayed completion is indistinguishable from generation 2s valid completion. In our deterministic oracle, that stale event retires the newer work. The separate owner map also retained entries for 4,097 unique pane keys, so authenticated but untrusted hook payloads can grow memory without a lifecycle bound. We also tested an owner-map-free rewrite that attached state to the authoritative status. It fixed the earlier stale-owner cases, but it still failed the identical-generation sequence because receiver-generated counters and timestamps cannot manufacture the missing correlation identity. A safe version needs an opaque operation ID carried from I am closing this for now because the remaining fix requires protocol work beyond this PR. Please feel free to reopen with a provider-correlated design, or with reproduction evidence that disproves the sequence above. |
…d record exists Review finding round 4: teammate ids persist across turns, so a delayed stale SubagentStop parks a live teammate's row and the drain->done inference retired newer work — PR #11353's uncorrelated-completion race. With no lead record, only a live working child (working) or a one-shot row removal (done; duplicate-proof since the row is gone) may speak; teammate parks and idle-only refreshes stay silent.
Address Greptile/CodeRabbit review on #11353: extract a shared shouldIgnoreHarnessInjectedUserPromptSubmit helper for Claude and Kimi, and add Kimi harness + PreCompact/PostCompact regression tests so the parallel path cannot drift.
Summary
Fixes Claude worktrees that stay stuck on Working… after
/compactfinishes (and the TUI is idle).User-visible change: after compaction completes, the sidebar/card agent row returns to idle/
doneinstead of spinning forever with an empty prompt and no tools.Root cause
/compactinjects a harness user turn (This session is being continued from a previous conversation…) that firesUserPromptSubmit.UserPromptSubmit→working, including harness machinery. There is no matchingStop.PreCompact/PostCompactwere ignored for status, so compact neither showed as busy nor cleared on completion.✳ …) does not clearworking, so the spinner sticks until the 30‑minute stale window or a new real turn.Live diagnosis on Orca
1.4.161/ snapstudiolocal-moderationis documented in the issue.Fix
UserPromptSubmitfor Claude and Kimi (return no status update). Real activity still arrives via PreToolUse/PostToolUse/Stop.PreCompact→workingandPostCompact→doneso multi-minute compact shows activity and clears cleanly (also covers a real/compactslash-command submit without a Stop).Tests
UserPromptSubmit(task-notification / system-reminder / compact-summary) does not mint a sticky working row; cached user prompt is preserved for later real tool events./compactUserPromptSubmit.pnpm exec vitest run src/shared/agent-hook-listener.test.ts pnpm typecheckFixes #11352
Related
ORCA_AGENT_HOOK_PORTon long-lived PTYs) is out of scope here; this PR fixes the compact harness path that repros with a live hook port.AI agent review summary
ORCA_PANE_KEY; no cwd-based resolution change. Dead remote hook ports remain a separate issue.PostCompaction→ working mapping.Manual verification
/compact.✳title +❯prompt, card should not stay on Working….