Skip to content

feat(claude-code-style): open a thread as a sheet in threads mode - #4798

Merged
jhoffner merged 2 commits into
mainfrom
feat/claude-code-style-thread-sheet
Nov 5, 2026
Merged

jhoffner merged 2 commits into
mainfrom
feat/claude-code-style-thread-sheet

Conversation

@jhoffner

@jhoffner jhoffner commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

What

Threads mode (Projects view) now opens a thread as a sheet over the main thread, the same flyout session mode uses for background tasks. The board stays in the right pane. Before, a thread replaced the board with an in-pane view and a back arrow.

Why

Session mode and threads mode showed task detail in two different places. One flyout pattern for both reduces UI inconsistency.

Changes

  • Sheet takes its scroll feed from the opener. The thread composer needs the same feed to scroll after a send.
  • ThreadView renders as a Sheet. The action row and Pin sit at the top of the body. The question, review card and composer sit in the footer.
  • ThreadsBoard no longer swaps itself out for the thread view.
  • TasksPane creates its own feed for the same reason.
  • Tests query the thread as a dialog and close it with the sheet's Close button. One new test covers opening, the board staying put, and Esc.
  • The lab README describes the sheet.

Decisions to know

  • Esc closes the sheet from inside the composer. Sheets previously assumed no text field. The draft is kept per task, so nothing is lost.
  • Supersedes FIX-2157's DECISIONS.md entry "the thread view replaces the board". That spec is left as history. An amendment is a separate follow-up.

Testing

  • pnpm test in labs/claude-code-style: 25 files, 173 tests pass.
  • pnpm typecheck in labs/claude-code-style: passes.
  • Not checked visually in a browser. The footer layout is unverified by eye.

🤖 Generated with Claude Code

Threads mode opened a thread by replacing the board in the right pane with
an in-pane view and a back arrow. Session mode already opens a background
task as a flyout sheet over the main thread. Threads mode now uses the same
Sheet, and the board stays in the pane behind it.

- Sheet takes its scroll feed from the opener instead of creating it, since
  the thread composer needs the same feed to scroll after a send.
- ThreadView renders as a Sheet: the action row and Pin sit at the top of
  the body, the question, review card and composer in the footer.
- ThreadsBoard no longer early-returns the thread view in place of the board.
- Tests query the thread as a dialog and close it with the sheet's Close
  button; one new test covers opening, the board staying put, and Esc.
- README describes the sheet.

Supersedes the "thread view replaces the board" decision in FIX-2157's
DECISIONS.md, which copied the original app's in-pane layout. The spec is
left as history.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
flow-state-dev-docs Error Error Nov 5, 2026 8:58pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
flow-state-dev-ui Ignored Ignored Preview Nov 5, 2026 8:58pm UTC
flow-state-dev-build-site Skipped Skipped Nov 5, 2026 8:58pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T20:33:24.853353Z 1025de5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

jhoffner commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Second look + architecture review

Read the diff against main (Sheet, ThreadView, ThreadsBoard, TasksPane). The direction is sound: one flyout for both modes, and ThreadsBoard loses its early-return swap. No blockers. Findings, most important first.

1. Sheet's feed prop is the weakest part of the design (worth a decision)

Sheet now requires every opener to build useJumpToLatest() and pass it back in. TasksPane gained a hook and a prop only to satisfy this, and it never calls feed.sent(). Only ThreadView needs the feed, to call sent() after a send.
Leaner option: keep the feed inside Sheet and let a sheet that needs it get it from the sheet. Either children / footer accept a render function (feed) => ReactNode, or Sheet exposes a small useSheetFeed() context. Then TasksPane reverts to its original shape, and the JumpToLatest type import and the feed prop disappear from the contract.
Not blocking: a required prop is explicit and typechecks, so the current shape is defensible. But it makes a read-only caller carry a write-path concern. Pick one deliberately. If you keep the prop, make it optional with an internal default, so read-only sheets don't pay for it.

2. resetKey: task.id is now partly moot

ThreadView is keyed by open.id in ThreadsBoard, so it remounts on task change. The resetKey in useJumpToLatest({ resetKey: task.id }) is redundant, and TaskSheet doesn't use one. Pre-existing, but this PR is the moment ThreadView and TaskSheet converge. Align them (drop it, or key both).

3. Esc-in-composer is a behaviour change worth a guard

Sheet's capture-phase Esc listener closes the sheet from inside the textarea. That is stated and the draft is kept, so it is acceptable. Two edges:

  • Esc during IME composition (event.isComposing) will close the sheet. Skip the close when isComposing.
  • KeysSheet is a separate dialog, not a Sheet. With both open, Esc closes the thread sheet too, because the listener is on document in capture. Check which one should win, and add a test if it matters.

4. onClose identity churns the effect

ThreadsBoard passes () => onOpen(undefined) inline, so the Esc useEffect (deps [onClose]) re-subscribes on every render. This is harmless, but a streaming task re-renders often. useCallback in ThreadsBoard, or a ref-latest pattern inside Sheet, fixes it.

5. Footer inherits text-xs text-muted-foreground

Sheet's <footer> sets these, and ThreadView now puts the question note, ReviewCard, and the composer inside it. The textarea and the buttons set their own sizes, but ReviewCard and the "Waiting on you" note will inherit muted colour unless they set their own. The PR says the layout is unchecked visually. Please look at the review and question states in a browser before merge. No test covers this.

6. Duplicate-ish patterns left behind

  • ThreadView's JSDoc re-narrates the whole composer contract. Fine, but the "Esc closes the sheet" sentence duplicates the Sheet doc.
  • The DECISIONS.md entry from FIX-2157 is now contradicted. Leaving it as history is OK, but queue the amendment follow-up now. Otherwise the repo has a retained decision that disagrees with the code.

Architecture note (opportunistic, in scope only if cheap)

Sheet is now doing frame, Esc handling, scroll feed, and portal. Of these, only the feed ownership is being touched here. Don't split it further in this PR. The sheet-plus-feed coupling in #1 is the one worth fixing while it is open.

Verification gap: the new test covers open, board stays, and Esc. There is no test for a send scrolling the feed (feed.sent() via the new wiring), which is exactly what moved ownership for. A test asserting that sending from the composer scrolls the sheet body would back the reason for the feed prop.


Generated by Claude Code

- Sheet takes an optional `feed`; it keeps its own when the opener does not
  send into the body. TasksPane reverts to its original shape.
- Sheet holds onClose in a ref, so its Esc listener subscribes once.
- Esc is ignored during IME composition, and yields to a dialog opened over
  the sheet (the keys sheet) when focus is in that dialog.
- Sheet footer no longer sets muted, extra-small text for its contents.
- ThreadView drops the redundant resetKey (the board keys it by task) and a
  duplicated Esc sentence.
- Tests: a send from the thread composer scrolls the body smoothly; Esc
  during IME composition keeps the thread open; Esc with the keys sheet open
  closes only the keys sheet. layOutFeeds moves to test/feed-layout.ts so
  both screen tests share it.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1025de5188

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +183 to +185
{work?.entries.map((entry) => (
<Entry key={entry.id} entry={entry} mark={entry.kind === "user" ? feed.mine(entry.id) : undefined} />
))}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve wrapping for task-thread messages

When a task message contains a long URL or unbroken identifier, moving these entries into Sheet removes the previous feed's inherited overflow-wrap:anywhere. The sheet body has no equivalent rule, and Entry's user-message bubble only sets whitespace-pre-wrap, so text now overflows the bubble and requires horizontal scrolling instead of wrapping. Preserve the wrapping rule on the thread content when rendering it inside the sheet.

Useful? React with 👍 / 👎.

This branch had an error being deployed

1 failed deployment
Preview – flow-state-dev-docs — 1025de51 Deployed Nov 5, 2026 by vercel[bot]
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