Skip to content

fix(app): track inbox session cutoff per server - #67442

Merged
Brendonovich merged 2 commits into
devfrom
fix/inbox-per-server-cutoff
Dec 1, 2026
Merged

Brendonovich merged 2 commits into
devfrom
fix/inbox-per-server-cutoff

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add persisted per-server cutoffs (serverCutoffs) to SidebarInbox (opencode.global.dat:sidebar.inbox, keyed by ServerScope) so adding a new server does not flood the inbox with its older sessions.
  • Already-connected servers on first initialization start at 0 (no cutoff), so existing inbox items do not disappear on upgrade.
  • Newly added servers start at Date.now() when first seen; their older settled and archived sessions stay hidden unless they are currently working, waiting for attention, pinned, or explicitly opened (and any session created/updated/archived at or after the cutoff appears normally).
  • Extract pure cutoff reconciliation and filtering helpers into packages/app/src/shell/titlebar/inbox-cutoff.ts with unit tests, and add a multi-server Playwright regression test in packages/app/e2e/regression/multi-server.spec.ts.

Verification

  • bun test src/shell/titlebar/inbox-cutoff.test.ts: 10/10 passed.
  • bun run --cwd packages/app typecheck: 0 errors.
  • bun run --cwd packages/app typecheck:e2e: clean for multi-server.spec.ts.
  • e2e/regression/multi-server.spec.ts -g inbox: 2/2 passed (including the new per-server cutoff regression).
  • e2e/regression/tabs.spec.ts -g inbox: 15/15 Inbox sidebar tests passed (the 1 unrelated tab test "an unread tab whose run failed shows the failed dot, as the inbox does" fails on dev too).
  • bun run lint:changed / pre-push oxlint panics in the sandbox (oxc_allocator fixed_size.rs:112), so CI will run lint.

Requested by: @Brendonovich (Brendan via Slack)

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The approach looks sound: persisted per-server cutoffs, with existing servers seeded at 0 so nothing disappears on upgrade. I ran the new unit tests (10/10 pass) and tsc -b for packages/app (clean). I couldn't run the new Playwright test here because no browser is installed, so I didn't see the before and after inbox behaviour myself. Screenshots of the inbox right after adding a server, on dev and on this branch, would help.

Public API: unchanged. The new optional serverCutoffs key is client-side persisted UI state in sidebar.inbox, and older stored state still decodes.

One case worth handling: removing a server and adding it again (inline comment).

let next: Record<string, number> | undefined

for (const scope of scopes) {
if (current[scope] !== undefined) continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cutoffs are never cleared when a server is removed (servers.remove doesn't touch sidebar.inbox), so removing a server and adding it again later keeps its original cutoff. Everything it did between the first add and the re-add then floods the inbox, which is the case this PR is meant to prevent. Could the stale entry be dropped when the server leaves the list, or the cutoff reset when it's added again? Keep in mind the test's note that plugin servers can be absent only temporarily.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new commit only changes spacing in the e2e test, so behaviour is the same as at my last review. The earlier point about a removed and re-added server keeping its old cutoff is still open. Public API is unchanged.

@Brendonovich
Brendonovich merged commit 5225062 into dev Dec 1, 2026
10 checks passed
@Brendonovich
Brendonovich deleted the fix/inbox-per-server-cutoff branch December 1, 2026 08:36
@amrkmn amrkmn mentioned this pull request Dec 3, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant