Skip to content

feat: Go to a session by clicking its notification toast - #14

Open
fismif wants to merge 4 commits into
eclipse-enclave:mainfrom
fismif:feat/toast-go-to-session
Open

fismif wants to merge 4 commits into
eclipse-enclave:mainfrom
fismif:feat/toast-go-to-session

Conversation

@fismif

@fismif fismif commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Clicking a notification toast goes to its session. A "waiting for input" toast also expands the
session and focuses its send box, so you can answer right away. This is web-app only; the daemon
already sent the IDs.

Closes #13

click toast → notificationDestination (session → workstream → project, whichever still exists)
  → goTo (the palette's path) → ProjectView.focus → the card holding the session
    → expand row + focus send box (waiting only; the ask lapses after 10 s)

A toast stays on screen while you aim at it:

pointer anywhere over the stack → hold every toast, new arrivals included
focus in a toast                → hold that toast
stack cap (3)                   → drop the oldest toast not held, never the newest
new toast                       → shown on top; the bottom-anchored stack grows upward,
                                  so nothing moves under the pointer
  • Test toasts have no session, so they aren't clickable. Native OS notifications are out of scope.

Evidence:

  • e2e: from Settings, click a waiting toast. The test checks that its project is selected, its
    session row is expanded, the send box is focused and the toast is gone.
  • e2e: hover a toast while the demo keeps sending new ones. After 7 s it's still visible and hasn't
    moved. Before this fix it was evicted, or another toast slid under the pointer.
  • Unit tests cover the fallbacks, the stack-wide and focus holds, the cap skipping held toasts, the
    newest-on-top order, and the send-box ask lapsing.
  • make test, make lint and make test-e2e pass.

Merge danger: two-way door, small blast radius: UI only, with no state, settings or API. The
visible change in the stack: the newest toast now shows on top instead of at the bottom.

Changelog

- Click a notification to go to its session, even from Settings. For a session waiting for
  input, it opens the session's output with the cursor in the box to answer it.
- Notifications stay on screen while you point at them, and newer ones appear above them instead
  of pushing them aside.

Checklist

  • Tests added: unit and e2e, or a regression test for a bug fix (see AGENTS.md)
  • Docs updated per the trigger table in AGENTS.md (none needed)

Clicking an in-app toast selects the session's project and focuses the
session's row, then dismisses the toast. A session gone since the
notification falls back to its workstream, then to its project; a test
notification has nowhere to go and is not clickable.

A toast now stays on screen while the pointer is on it or it has focus,
and gets a full lifetime again once both have left, so it can be read
and clicked.
Clicking a "waiting for input" toast now also expands the session's row,
showing its output and the box to answer it in. A finished toast still
only focuses the row, and a fallback to a workstream or project expands
nothing.
Clicking a "waiting for input" toast now puts focus in the expanded
session's send box, so the answer can be typed at once. The box can show
up a render after the panel opens, so the row waits for it; the ask lapses
if focus has moved elsewhere by then, or the user toggles the panel, so a
late box never pulls focus from where the user went. A session that takes
no input keeps focus on its row.
@fismif

fismif commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

@EclipseSourceAI

@EclipseSourceAI EclipseSourceAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Autonomous AI review. May contain mistakes.

Useful comment? React 👍. Disagree? React 👎 to reject it for follow-up reviews. A reply explaining why helps too.

This agent never approves PRs. A maintainer must sign off.

Only a maintainer can re-request a review from this agent.

Powered by Eclipse Enclave via review-guard-mcp

This PR makes notification toasts clickable, and the change is web app only. Clicking a toast does the following:

  • It resolves where to go with notificationDestination: the session, or its workstream or project if the session is gone.
  • It then reuses the palette's goTo path.
  • For a waiting toast, it expands the session row through new WorkstreamCardHandle.expandSession / SessionRowHandle.expand handles and moves focus to the send box.

Toasts are also held while hovered or focused. useNotifications gains hold/release, and the component tracks pointer and focus per toast.

UI check: I ran it in the demo app with Playwright.

  • Clicking a waiting toast from Settings selects the project, expands the row, focuses the send box and dismisses the toast.
  • A finished toast focuses the row without expanding it.
  • Keyboard Enter, the focus outline and the hover underline in light and dark all work, with no console errors.

Where to focus: the hold logic.

  • A held toast is still evicted by the 3-toast cap.
  • Because the stack is bottom-anchored, a new toast shifts a different one under a pointer that hasn't moved.

Both showed up in the demo app, and both can make a click open the wrong session. The other comments are smaller:

  • The card lookup in ProjectView.focus asks every card instead of only the one holding the session.
  • The send-box focus request never expires, unlike usePendingFocus.

No doc updates look needed. The changelog block covers both user-visible changes.

Addresses the review of the clickable toasts:

- The stack cap no longer evicts a held toast; it drops the oldest one
  not held, never the newest, so the stack outgrows the cap while too
  many are held.
- The pointer anywhere over the stack holds every toast in it, ones that
  arrive meanwhile included; focus still holds just its own toast. The
  newest toast now shows on top, so a new one grows the bottom-anchored
  stack upwards and the toast under a still pointer stays where it is.
- The send-box focus a waiting toast asks for lapses after 10 s, as
  usePendingFocus does, so a box that shows up much later cannot take
  focus.
- ProjectView asks only the card holding the session to expand it.

@EclipseSourceAI EclipseSourceAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Autonomous AI review. May contain mistakes.

Useful comment? React 👍. Disagree? React 👎 to reject it for follow-up reviews. A reply explaining why helps too.

This agent never approves PRs. A maintainer must sign off.

Only a maintainer can re-request a review from this agent.

Powered by Eclipse Enclave via review-guard-mcp

Follow-up on bb34ab3, the only commit since my last review.

I checked all four of my earlier findings against the actual code (not just the reply text), and ran the updated/new unit tests (use-notifications.spec.ts, notification-toasts.spec.tsx, session-row.spec.tsx, project-view.spec.tsx), all 88 + 165 of which pass locally:

  • capToasts in use-notifications.ts now skips held toasts and the newest when trimming to the cap. Traced through the eviction logic manually (including the "all older ones held" case) and it matches the stated behavior; the stack correctly outgrows the cap while enough toasts are held.
  • The hold is now stack-wide for pointer (via a single onPointerEnter/onPointerLeave on the container) and per-toast for focus, with the newest toast rendered first so the bottom-anchored stack grows upward. Confirmed against the CSS (flex-direction: column, bottom anchored) that this actually keeps a hovered toast's position fixed.
  • SessionRow's answer-focus request now carries a Date.now() + ANSWER_FOCUS_MS deadline and gives up past it. It can't reuse usePendingFocus directly since that hook lives in apps/web while session-row.tsx is in the @homeshell/components package, which apps/web depends on, not the other way around, so a bespoke deadline check is the right call here.
  • ProjectView.focus now looks up the workstream holding the session and only calls expandSession on that card's handle.

No new issues from this commit. Didn't re-run the Playwright e2e suite (needs the daemon built and browsers installed) given the unit-level coverage already exercises the exact scenarios (cap-with-holds, stack-wide pointer hold including toasts arriving under the pointer, deadline expiry), but the new e2e test added for the "stays put while newer ones arrive" case looks sound on read.

These previous comments can be resolved as they are now handled:

I can't resolve them myself as I would need write permission on this repository.

@fismif
fismif marked this pull request as ready for review November 16, 2026 18:25
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.

Click on a notification toast to go to its session

2 participants