Skip to content

feat(question-card): click the session row to focus the asking terminal - #325

Merged
wxtsky merged 1 commit into
wxtsky:mainfrom
mutoe:feat/question-card-click-to-jump
Sep 1, 2026
Merged

wxtsky merged 1 commit into
wxtsky:mainfrom
mutoe:feat/question-card-click-to-jump

Conversation

@mutoe

@mutoe mutoe commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

The question card offers no way back to the conversation that asked the question.

When an AskUserQuestion / plan-mode prompt pops up, the only exits are answering an option or Skip. Skip is not "hide this for now" — it denies the request and drops it from the queue (as explained in #210), so there is no safe way to say "let me go read the terminal first."

The approval card already solves exactly this: clicking it focuses the owning terminal. The question card just never got wired up. QuestionBar receives only session?.source and session?.cwd as plain strings, even though the construction site one screen away already has the full SessionSnapshot:

case .questionCard(let sid):
    let session = appState.sessions[sid]   // ← the session is right here
    QuestionBar(
        sessionSource: session?.source,    // ← but only two strings go down
        sessionContext: session?.cwd,
        ...

So TerminalActivator.activate had exactly two call sites: ApprovalBar and SessionCard.

Change

1. Extract the shared jump driver. ApprovalBar.handleCardClick() held ~60 lines — activate terminal, poll 3× with increasing delays to see whether the jump landed, collapse on success, error sound + shake on failure. Rather than paste a third copy, it moves to startNotchCardJump(kind:session:sessionId:appState:autoCollapseAfterJump:shakeOffset:). ApprovalBar behaviour is preserved line for line; SessionCard is untouched (its jump has slightly different semantics around remote sessions, so it stays as it is).

The only thing that differed between the two cards is which surface may auto-collapse, now a NotchCardKind.

2. Wire up QuestionBar. It gains session / sessionId / appState, and the "CLI icon + project folder" row becomes the jump target — with a hover highlight and an ↗ glyph, so the affordance is discoverable rather than an invisible hit area. The row now also renders when the session has no cwd, so a jumpable session always has an entry point.

I deliberately did not make the question text clickable, the way the approval card's tool-name row is. That line is what the user is reading; a misclick there would yank them to another app mid-thought. The session-identity row carries the clearer meaning anyway: click which session this is → go to that session.

3. Fixed a doc comment that had drifted onto shortcutHint (it documents handleCardClick).

Behaviour

  • Click the session row → the asking terminal comes to the front, exactly like the approval card.
  • With Auto-Collapse After Jump on, the notch folds once the jump is verified. The question stays queued and answerable — in the terminal, or back on the card via ⌘⇧I / hovering the notch. This is the important distinction from Skip.
  • Remote sessions have no local terminal, so the glyph and hover affordance stay hidden rather than presenting a dead control.
  • Jump fails (terminal gone) → the existing error sound + shake, unchanged.

Tests

NotchPanelViewTests

AppStateQuestionFlowTests

  • testCollapsingAQuestionCardAfterAJumpKeepsItAnswerable — collapse the surface the way a successful jump does, then assert the question is still queued and still answers correctly through its continuation. This pins the property that separates a jump from a Skip.

Full suite green locally on macOS 26.4 / Xcode 26 (Swift 6.3.3): 890 tests, 2 skipped, 0 failures. swift build is clean — no new warnings from these files.

Notes

CHANGELOG is left alone since it looks like it's written at release time.

The question card offered no way back to the conversation. When an
AskUserQuestion / plan-mode prompt pops up, the only exits are answering an
option or Skip — and Skip denies the request and drops it from the queue
rather than deferring it, so there was no safe way to say "let me read the
terminal first".

The approval card already does this: clicking it focuses the owning
terminal. QuestionBar simply never received the session to do it with — it
got session?.source and session?.cwd as plain strings, even though the
construction site already holds the full SessionSnapshot.

Extract the driver both cards need — activate terminal, poll to verify the
jump landed, collapse on success, error sound + shake on failure — into
startNotchCardJump, parameterised by NotchCardKind so a jump only collapses
the surface it started from. ApprovalBar behaviour is unchanged; SessionCard
is left alone.

QuestionBar's session-context row becomes the jump target, with a hover
highlight and an arrow glyph so the affordance is discoverable. The question
text stays unclickable on purpose: that line is what the user is reading.

Collapsing after a jump does not answer or discard the question — it stays
queued and answerable, in the terminal or back on the card.
nguyenvanduocit pushed a commit to nguyenvanduocit/CodeIsland that referenced this pull request Aug 26, 2026
…badge, T-088 question card jump)

New open PRs on wxtsky/CodeIsland (Aug 25, 2026):
- T-088: PR wxtsky#325 — click question card to jump to asking terminal (medium, S; depends on T-036)
- T-087: PR wxtsky#326 — multiplexer badge chip on session cards (low, XS; depends on T-055)

Both gated on upstream merge. Upstream otherwise quiet 11 days since v1.0.32.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UXGjprGYFRNkJMwaYmddBJ
nguyenvanduocit pushed a commit to nguyenvanduocit/CodeIsland that referenced this pull request Aug 29, 2026
…1.0.32)

No new commits on wxtsky/CodeIsland or vibeislandapp/vibe-island since
Aug 26. Issues wxtsky#327 (Qoder) and wxtsky#328 (Codex) are non-Claude CLI specific.
PRs wxtsky#314, wxtsky#323, wxtsky#325, wxtsky#326 remain open and watching. No actionable items.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T4KU8w1bHuFtRzeNAvW1bn
wxtsky pushed a commit that referenced this pull request Sep 1, 2026
…nal (#326)

Merged. The cmux exclusion and the innermost-wins rule are the two things that would have gone wrong here, and both are pinned by tests — that's what made this easy to take. Verified locally alongside #325: build clean, 907 tests green.
@wxtsky
wxtsky merged commit 24f5671 into wxtsky:main Sep 1, 2026
wxtsky pushed a commit that referenced this pull request Sep 1, 2026
Merged — thanks, this is exactly the shape #239 was asking for.

I verified the contract against herdr's own source rather than taking it on trust, since a wrong CLI verb here would degrade silently:

- `HERDR_PANE_ID` / `HERDR_BIN_PATH` are set in `src/integration/env.rs` (`apply_pane_base_env`), and `HERDR_SOCKET_PATH` is `api::SOCKET_PATH_ENV_VAR` — so requiring the pane+socket pair before emitting anything is right, and it's what keeps a pane id from being aimed at herdr's default server.
- `herdr agent focus <target>` and `herdr agent get <target>` both exist (`src/cli/agent.rs`), and `resolve_agent_target` tries `parse_current_public_pane_id` first, so passing `HERDR_PANE_ID` as the target resolves.
- `agent get` returns `ResponseResult::AgentInfo { agent }`, and `agent_info` populates `focused: pane.focused` — so `result.agent.focused` is the right path for jump validation.

Degradation is the part I cared about most and it's handled: focus failing falls back to `activate(allowHerdr: false)`, and a missing/renamed binary just means the old behaviour.

Verified locally on top of #325/#326: build clean, 917 tests green.

Two follow-ups I'll push myself rather than hold this up:

1. `terminalName` returning `"Herdr"` now conflicts with #326, merged an hour ago: it added `multiplexerLabel`, whose rule is that a multiplexer chip *augments* the terminal name and never replaces it (tmux inside iTerm2 shows both). Herdr is a multiplexer in exactly that sense, so it should read `iTerm2` + a `herdr` chip rather than losing the host terminal.
2. `TerminalVisibilityDetector` routes on `identity(from:)` while `activate` routes on `shouldRoute`, which additionally excludes tmux/zellij panes. For zellij-inside-herdr the two would disagree — activation goes to zellij, validation asks herdr — so validation should use the same predicate.
@mutoe
mutoe deleted the feat/question-card-click-to-jump branch September 1, 2026 14:51
nguyenvanduocit pushed a commit to nguyenvanduocit/CodeIsland that referenced this pull request Sep 2, 2026
…88 to Todo

v1.0.33 released Sep 1, 2026. Three watched PRs merged:
- PR wxtsky#325 → T-088 gate cleared (question-card click-to-jump)
- PR wxtsky#326 → T-087 gate cleared (multiplexer badge chip)
- PR wxtsky#323 → T-086 gate cleared (Herdr pane-jump)

Also adds Sep 1 scout entry (upstream quiet, no changes).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DUc3EnTaiuJxwGonqaNwk3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants