Skip to content

Map panel does not follow the whiteboard ticket in play or a newly created one #306

Closed

Description

@ToRvaLDz

Parent: 🗺 trailhead mod: Claude Code function hooks for on-screen state, context and in-process guards

Problem

The map panel does not follow the whiteboard. While working a whiteboard ticket, or after creating a new one during the session, the panel stays on the active map, so the ticket is invisible until the user presses the Whiteboard row by hand.

Repro (real case)

In powertrading-workspace: resolved whiteboard ticket #153, then created whiteboard ticket #154 (gh issue create with label trailhead:whiteboard). The panel stayed on active map #3, which excludes trailhead:whiteboard tickets by construction. #154 was visible only in the Dashboard view.

Cause

In plugins/trailhead/hooks/mod/map-pane.tsx the isDashboard atom becomes true only from pressDashboard/setDashboard (a click). No hook sets it when the session's work-state has map: null, nor after a gh issue create --label trailhead:whiteboard.

Expected behaviour

  1. When the session takes a whiteboard ticket (work-state with map: null, read on session.start, turn.complete and after a Bash call running trailhead-work-state.js), the panel switches to the Dashboard/whiteboard view, once per ticket. If the user goes back to the map by hand, it is not forced again.
  2. When a tracker write creates a whiteboard ticket (gh issue create with trailhead:whiteboard) and the active view is a map, the panel signals it: either switch to the whiteboard, or show a hint/toast like "new whiteboard ticket #n: open Whiteboard". The UX is to be chosen in discussion.
  3. On Resolve of a whiteboard ticket (work-state cleared) the view stays on the whiteboard, so the next frontier is visible.

Acceptance

  • plugins/trailhead/hooks/mod/README.md (Map panel section) documents the auto-follow behaviour.
  • Tests in plugins/trailhead/tests/: a mocked work-state with map: null, and a tool.call of gh issue create with the whiteboard label.

Activity

  1. self-assigned this
    on Oct 22, 2026
  2. ToRvaLDz commented on Oct 22, 2026

    @ToRvaLDz
    OwnerAuthor

    DISCUSS

    Scope confirmed as written. Closed choice for point 2 (a whiteboard ticket created while the panel shows a map): toast hint, e.g. new whiteboard ticket #n: open Whiteboard; the view stays on the map (no auto-switch), so a user looking at the map is not pulled away.

    Points 1 and 3 as in the ticket: auto-switch to the whiteboard view once per whiteboard ticket in play (no re-force after a manual return to the map), and stay on the whiteboard after Resolve.

  3. ToRvaLDz commented on Oct 22, 2026

    @ToRvaLDz
    OwnerAuthor

    REPRO

    1. A session with an active map (.trailhead/active-map = N) and the map panel open on it.
    2. Take a whiteboard ticket: trailhead-work-state.js set ... --map none --ticket W (work-state map: null).
      • Expected: the panel switches to the Whiteboard view (once for ticket W).
      • Observed: the panel stays on map N; W is not visible (map views exclude trailhead:whiteboard).
    3. Run gh issue create ... --label trailhead:whiteboard while the panel shows a map.
      • Expected: a toast hint naming the new ticket and pointing at the Whiteboard row.
      • Observed: nothing; only a refresh of the map, which excludes the new ticket.
    4. Resolve the whiteboard ticket (work-state cleared).
      • Expected: the view stays on the whiteboard.

    Real case: powertrading-workspace, whiteboard #153 resolved then #154 created; the panel stayed on map #3.

  4. ToRvaLDz commented on Oct 22, 2026

    @ToRvaLDz
    OwnerAuthor

    DIAGNOSIS

    Root cause (falsifiable hypothesis, confirmed): nothing derives the panel's isDashboard view from the work-state, and nothing inspects a gh issue create for the whiteboard label. Two independent sub-causes:

    1. In plugins/trailhead/hooks/mod/map-pane.tsx, isDashboard has four writers (viewMap -> false, setDashboard reached only from the pressDashboard buttons, restoreAfterClear, one reset to false); none is driven by workState. viewTarget is viewed ?? active, so a work-state with map: null does not move the view either.
    2. The GH_ISSUE_WRITE tool.call handler only requests a refresh; it reads neither the command's labels nor its output, so it cannot hint a new whiteboard ticket.

    Falsification test (run): two probe tests on the mod test rig (claude plugin test plugins/trailhead): (a) own work-state map: null, ticket: 301 + turn.complete + a trailhead-work-state.js Bash call, expecting the whiteboard view; (b) gh issue create --label trailhead:whiteboard, expecting one toast. Unpatched: both red (870 pass, 2 fail; panel stayed on map #198, toasts empty). One-variable intervention (set isDashboard when workState.map === null on turn.complete): (a) green, (b) still red, so the two gaps are independent (both must be fixed). Probes removed.

    Fix constraints found: follow only this session's own, non-orphaned whiteboard ticket; remember the followed ticket in module state (atoms reset on /clear) so a manual return to the map is not forced again; read the work-state after the band's refresh (the helper-call trigger lives in register.tsx); parse the new issue number from the gh issue create stdout URL, toast only while a map is shown.

  5. ToRvaLDz commented on Oct 22, 2026

    @ToRvaLDz
    OwnerAuthor

    VERIFY

    status: clean
    critical: 0 · warning: 1 · info: 3

    Findings ledger:

    • W1 fixed (0aeb792): the whiteboard label was missed when not on the same segment as issue create (backslash continuation, a separator or newline inside a quoted title/body).
    • I1 fixed (0aeb792): a label flag inside a quoted argument gave a false positive; the attached -lLABEL form was missed. Now a quote-aware segment split; failing cases added first (1b70501).
    • I2 accepted: the Bash result shape (result.stdout, string, or text) follows the host types; a mismatch can only drop the toast, never show a wrong one; settled by acceptance testing.
    • I3 accepted: debug became a function declaration because the mod loader refused the file when $ was passed to a const arrow from a function exported to another file's hook.

    Review notes: hook order holds (followWhiteboard runs after the awaited work-state refresh at session start, turn end and after the helper call); once-per-ticket memo survives /clear; Resolve leaves view and memo untouched; a failed create raises no toast.

    Goal-backward verification

    status: met

    • Own whiteboard ticket in play switches the panel to the whiteboard once per ticket, not re-forced after a manual return to the map, also across /clear: met (nextFollow in whiteboard-follow.ts, followWhiteboard in map-pane.tsx, called from register.tsx after the refresh; integration tests).
    • Whiteboard ticket created while a map is shown raises a toast naming #n, no switch; none on the whiteboard view, on error or without the label: met (hintWhiteboard in the GH_ISSUE_WRITE handler; tests).
    • Resolve keeps the whiteboard view: met (null state changes nothing; test).
    • README Map panel section documents the auto-follow: met (26a13a1).
    • Tests with a mocked map: null work-state and a gh issue create whiteboard tool.call: met.

    Tests: claude plugin test plugins/trailhead 591 pass, 0 fail; claude plugin validate passed; scripts/test.js (npm test) 65 ok, 0 failed on the first fix round.

  6. ToRvaLDz commented on Oct 22, 2026

    @ToRvaLDz
    OwnerAuthor

    Resolved

    Cause: nothing derived the panel's whiteboard view from the work-state, and the tracker-write hook never inspected a gh issue create for the whiteboard label.

    Fix:

    • 9551794 whiteboard-follow.ts (new, pure): once-per-ticket follow rule, whiteboard-create detection, created issue number, hint text; tests in whiteboard-follow.test.ts.
    • cd4768f map-pane.tsx + register.tsx: followWhiteboard runs after the work-state refresh (session start, turn end, helper call) and switches to the whiteboard view for this session's own whiteboard ticket, once per ticket (memo survives /clear); a whiteboard ticket created while a map is shown raises the toast new whiteboard ticket #n: open Whiteboard; integration tests in map-pane-ui.test.ts.
    • 26a13a1 README.md: Map panel section documents the behaviour.
    • 1b70501, 0aeb792: quote-aware label parsing (continued lines, quoted separators, -lLABEL), from review findings W1/I1.

    Findings ledger: #306 (comment)

    Acceptance testing: waived by the user (unconfirmed in the real panel; the automated rig drives the same hooks on both surfaces, 591 pass).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions