Fix BUG-076: Hera-pane false "Session not running" after ordinary rail nav - #920
Merged
Conversation
…l nav The session wasn't misclassified as dead — it was genuinely stopped by a legitimate size-drift kick (heraKickRerender, BUG-074), whose auto-restart then unconditionally skipped itself. handleSessionExitUI's "is the user still watching" gate checked only a.mode==modeAgent (the classic fullscreen agent view), but the native Hera view never sets that mode — it stays modeTaskList with ActiveTab()==TabHera regardless of which pane is focused. So every kick fired from a Hera pane took the "user navigated away, settle at InReview" branch, even while the operator was watching it live in Hera. Fix: App.isViewingTaskSession recognizes both ways of "watching" — the classic agent view, or the Hera tab with the task bound to either pane via the new HeraPage.IsBoundToTask. handleSessionExitUI now uses it instead of the inline modeAgent-only check. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
heraKickRerender, BUG-074), whose auto-restart then unconditionally skipped itself.handleSessionExitUI's "is the user still watching" gate checked onlya.mode==modeAgent(the classic fullscreen agent view). The native Hera view never sets that mode — it staysmodeTaskListwithActiveTab()==TabHeraregardless of which pane is focused. So every kick fired from a Hera pane (nearly every task's first Hera-view bind, since Hera panes are narrower than the main agent view) took the "user navigated away, settle at InReview" branch, even while the operator was watching it live in Hera. The kick itself is async (RPC +QueueUpdateDraw), so the operator sees it fine, glances away for "a moment," and by the time they look back the session has already been stopped and never resumed.App.isViewingTaskSession(taskID)recognizes both ways of "watching a session" — the classic agent view, or the Hera tab with the task bound to either pane via the newHeraPage.IsBoundToTask.handleSessionExitUInow calls this instead of the inlinemodeAgent-only check. The kick decision itself (heraKickRerender/ShouldKickRerender) is untouched and correct — only the exit-time restart decision was wrong.Regression coverage
internal/tui/hera/panes_test.go:TestPanes_IsBoundToTask— pureIsBoundToTasksemantics (coordinator counts as bound the whole time a worker under it is selected; unrelated/empty task rejected).internal/tui/app_test.go:TestApp_IsViewingTaskSession— allisViewingTaskSessionbranches (classic agent view, Hera tab with a bound task, Hera tab with an unbound task, Hera binding present but a different tab active).internal/tui/heraactions_test.go:TestHandleSessionExitUI_RerenderRestartsWhenViewedViaHeraPane— end-to-end through a real Hera tab selection +handleSessionExitUI; confirmed to fail withstatus=in_reviewagainst the oldmodeAgent-only gate before asserting the fixed auto-restart behavior.Documented as BUG-076 in
context/knowledge/gotchas/hera-view.md.Test plan
make build,make vet,make fmt-check,make lint-prall clean.make vulnfails on 3 pre-existing Go-stdlib-only CVEs (toolchain-level,continue-on-errorin CI) — unrelated to this diff.make test-cover-gate's full-parallel-racerun non-deterministically times out a PTY/emulator-heavy package (internal/tui/terminalorinternal/agent, depending on run) on this loaded local machine — this is the documented pre-existing flake ingotchas/ci-gates.md(macOS PTY/pipe-device contention under full-suite-race). Confirmed pre-existing and unrelated to this diff by reproducing it with these changes fully stashed out. Confirmed passing via the documented workaround:go test -p 1 -race -count=1 ./...(fully serialized) is green with full coverage —internal/tui83.4%,internal/tui/hera92.3%. Also broadened the existing ci-gates.md bullet to note the flake also hitsinternal/tui/terminal/internal/tui, not justinternal/agent.TestHandleSessionExitUI_RerenderRestartsWhenViewedViaHeraPanefails withstatus=in_review) and pass with the fix restored.🤖 Generated with Claude Code