Skip to content

Sync settle inbox and reconcile subthread sidebar#239

Open
wizzoapp[bot] wants to merge 9 commits into
mainfrom
wizzo/settle-sidebar-v2-subthreads
Open

Sync settle inbox and reconcile subthread sidebar#239
wizzoapp[bot] wants to merge 9 commits into
mainfrom
wizzo/settle-sidebar-v2-subthreads

Conversation

@wizzoapp

@wizzoapp wizzoapp Bot commented Jul 22, 2026

Copy link
Copy Markdown

Design recommendation — independently settled subthreads, visually grouped

Adam deliberately withheld his preference, so this recommendation is based on workflow merits and is intentionally easy to redirect before approval.

  • A — settle a parent and all descendants as one unit: strongest visual cohesion, but a blocked/working child makes settlement non-atomic and bulk actions surprising.
  • B — settle subthreads independently, keep each root tree together, and show aggregate open descendants: preserves worker-level inbox semantics without orphaning children.
  • C — exempt subthreads and settle only top-level parents: smallest change, but completed workers permanently occupy the inbox and a settled parent can misrepresent live child work.

Recommendation implemented: B. Each row owns its settled state. A parent tree stays in the active inbox while any member is unsettled; settled members become slim rows in place; the parent reports its open-descendant count; only a fully settled tree moves as a group into the history tail. This lets completed workers clear independently while preserving parent context.

What this PR brings in

  • Syncs upstream's server-backed settle/inbox sidebar overhaul in its own first commit, followed by the fork reconciliation in the second commit.
  • Uses fork-safe migration 055 to add nullable settlement state. Existing rows remain intact and decode as unsettled; no historical thread is silently moved out of the inbox.
  • Enables sidebar v2 by default and disables automatic age-based settlement by default. Both settings controls remain available, including an explicit sidebar opt-out.
  • Makes light the default theme for the shared web/desktop renderer while preserving explicit saved light, dark, or system preferences.
  • Retains the fork's subthread tree expansion state, child indentation, active-route visibility, keyboard order, and whole-tree settled pagination.
  • Applies the same v2 settlement model, project scope, pending tasks, PR-state observation, and settled paging to the persistent iPad/wide-layout sidebar.
  • Negotiates settlement event variants on both live detail subscriptions and raw replay RPCs, preserving mixed-version decoder compatibility.

Ephemeral UI proof

Captured against an ephemeral server using a SQLite .backup copy of the live state DB plus new synthetic parent/child fixtures. The live DB was never opened by the proof server.

Before settling After settling
Before settling After settling

Verification

  • Factory gate: full workspace typecheck and formatting/lint; its sole review concern was audit-dismissed after verifying mobile has no auto-settle preference and both mobile layouts intentionally use the same explicit policy
  • Full web unit suite plus focused mobile, server settlement/orchestration, contracts/settings, and desktop settings suites
  • Focused typechecks: contracts, web, mobile, server, and desktop
  • Isolated migrated-state browser proof in light mode, including settle before/after

Landing policy

Do not auto-merge. This PR requires Adam's manual design approval in addition to the normal CI, Codex review, and wizzo-approve conditions.

@wizzoapp
wizzoapp Bot marked this pull request as ready for review July 22, 2026 16:14

@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: a45e7b2ff8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/web/src/components/SidebarV2.tsx Outdated
Comment thread apps/mobile/src/features/home/HomeRouteScreen.tsx
Comment thread apps/web/src/components/Sidebar.logic.ts
@wizzoapp
wizzoapp Bot marked this pull request as draft July 22, 2026 16:57
@wizzoapp
wizzoapp Bot marked this pull request as ready for review July 22, 2026 16:58

@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: 6126e99d2f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/contracts/src/orchestration.ts
@wizzoapp
wizzoapp Bot marked this pull request as draft July 22, 2026 17:28
@wizzoapp
wizzoapp Bot marked this pull request as ready for review July 22, 2026 17:28

@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: de2084ba57

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +198 to +202
if (
supportsSettlement &&
effectiveSettled(thread, { now, autoSettleAfterDays, changeRequestState })
) {
settled.push(thread);

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 Keep mobile v2 subthreads grouped through settlement

When a mobile v2 list contains a mixed subthread tree, such as a settled parent with an active child, this per-thread partition pushes the settled member into the global settled tail and leaves the active member in the card block. Both HomeScreen and the split sidebar call this builder, so subagent children can be detached from their parent context on mobile even though the web v2 path keeps a tree in the inbox until every member settles; the final code here still partitions each shell independently. Build the mobile list from the parent/child tree before splitting settled groups.

Useful? React with 👍 / 👎.

Comment on lines +215 to +216
const visibleSettled =
orderedSettled.length > settledLimit ? orderedSettled.slice(0, settledLimit) : orderedSettled;

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 Keep the selected settled row visible on mobile

When the currently open thread is a settled row beyond the first settled page (for example on iPad/split after the page resets to the first 10), this slice drops it from items completely. ThreadNavigationSidebar can only apply its selectedThreadKey to rows returned by this builder, so the sidebar can show no current thread while that chat remains open; the web v2 pager explicitly keeps the active settled group visible for this case. Pass the selected thread key into the mobile builder and include that settled row despite the page limit.

Useful? React with 👍 / 👎.

// Server-side twin of the client's canSettle session check: a stale
// or raced client must not settle a thread whose session is coming
// alive or working.
if (hasActiveThreadSession(thread.session)) {

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 Block settling turns already marked running

When an assistant stream materializes latestTurn.state === "running" before the matching thread.session-set has reached the read model, this session-only guard still accepts thread.settle. The projector and sidebar sort logic already treat a running latest turn as active work, so a stale/raced client can hide an in-progress response until some later session activity happens to un-settle it; reject running latestTurn here and mirror that in the client settlement blockers.

Useful? React with 👍 / 👎.

@wizzoapp
wizzoapp Bot marked this pull request as draft July 22, 2026 17:58
@wizzoapp
wizzoapp Bot marked this pull request as ready for review July 22, 2026 20:35
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.

1 participant