Skip to content

fix(server): skip undecodable provider runtime rows when listing sessions#3951

Merged
juliusmarminge merged 5 commits into
mainfrom
fix/skip-undecodable-provider-runtime-rows
Jul 17, 2026
Merged

fix(server): skip undecodable provider runtime rows when listing sessions#3951
juliusmarminge merged 5 commits into
mainfrom
fix/skip-undecodable-provider-runtime-rows

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Jul 14, 2026

Copy link
Copy Markdown
Member

Problem

A single stale row in provider_session_runtime — e.g. one written by an older build with a status value that's no longer in ProviderSessionRuntimeStatus — made ProviderSessionRuntimeRepository.list() fail wholesale. That silently broke every consumer that enumerates sessions, most notably ProviderSessionReaper, whose sweep then failed on every run:

WARN provider.session.reaper.sweep-failed
  cause: PersistenceDecodeError ProviderSessionRuntimeRepository.list:decodeRows

Seen in the wild on a machine with one leftover status = "ready" row from June: idle-session reaping was completely disabled until the row was deleted by hand.

Fix

list() now decodes rows individually: a row that fails to decode is logged (provider.session.runtime.row-skipped, with the threadId and the decode error) and skipped, instead of failing the whole list. Point reads (getByThreadId) intentionally keep surfacing decode errors, so a corrupt row for a specific thread is still visible where it matters.

Updated the correlation test that pinned the old fail-the-whole-list behavior to assert the bad row is skipped and valid rows are still returned.

Verification

  • pnpm typecheck in apps/server
  • pnpm test src/persistence/RepositoryErrorCorrelation.test.ts src/provider/Layers/ProviderSessionDirectory.test.ts src/provider/Layers/ProviderSessionReaper.test.ts — all passing

🤖 Generated with Claude Code


Note

Medium Risk
Changes enumeration semantics for session consumers (e.g. reaper) so stale rows are silently omitted rather than blocking the sweep, while targeted reads still fail on corruption.

Overview
ProviderSessionRuntimeRepository.list() no longer fails the entire enumeration when one DB row fails schema decode (e.g. legacy status values). Each row is decoded in isolation: failures emit provider.session.runtime.row-skipped with threadId and a safe error message, and valid rows are still returned.

getByThreadId is unchanged—decode errors for a specific thread still surface as PersistenceDecodeError.

The persistence correlation test now asserts that a corrupt row is omitted from list() while a valid upserted row remains visible; SQL failure correlation behavior is unchanged.

Reviewed by Cursor Bugbot for commit 3f61538. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Skip undecodable rows in ProviderSessionRuntimeRepository.list instead of failing

  • ProviderSessionRuntimeRepository.Service.list now maps each row to Option.some on success or Option.none on failure, then filters out failed rows rather than propagating a PersistenceDecodeError for the entire operation.
  • Failed rows emit a warning log with the threadId and a safe error message.
  • The test in RepositoryErrorCorrelation.test.ts is updated to assert that only valid rows are returned when bad rows exist.
  • Behavioral Change: runtimes.list() now returns a partial result instead of failing when any row is undecodable.

Changes since #3951 opened

  • Modified make.list function in ProviderSessionRuntime to skip rows that fail decoding [3f61538]
  • Added module imports for functional error handling utilities [3f61538]

Macroscope summarized 2f3904a.

A single stale row in provider_session_runtime (e.g. written by an older
build with a status value that is no longer in the schema) made
ProviderSessionRuntimeRepository.list() fail wholesale, which silently
disabled every consumer that enumerates sessions — most notably the
session reaper, whose sweep failed on every run.

list() now logs a warning with the offending threadId and skips the row
instead. Point reads (getByThreadId) still surface decode errors so a
corrupt row for a specific thread remains visible.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4d9eb82e-97ba-4ea5-8cbb-cd9104359a9e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/skip-undecodable-provider-runtime-rows

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 14, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 14, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Straightforward defensive bug fix that changes decode error handling from failing the entire list operation to logging a warning and skipping undecodable rows. Clear intent, limited scope to one repository method, with updated test coverage.

You can customize Macroscope's approvability policy. Learn more.

@t3dotgg t3dotgg changed the title Skip undecodable provider runtime rows when listing sessions fix(server): skip undecodable provider runtime rows when listing sessions Jul 14, 2026

@macroscopeapp macroscopeapp 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.

Effect Service Conventions: one finding on log payload safety in ProviderSessionRuntime.list. See inline comment.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/persistence/ProviderSessionRuntime.ts
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 17, 2026 20:04

Dismissing prior approval to re-evaluate 2f3904a

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 17, 2026
Use Effect Array.filterMap to discard skipped rows and unwrap successful decodes in a single traversal.

Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 17, 2026 21:23

Dismissing prior approval to re-evaluate 3f61538

@juliusmarminge
juliusmarminge enabled auto-merge (squash) July 17, 2026 21:26
@juliusmarminge
juliusmarminge merged commit 31ca9e5 into main Jul 17, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the fix/skip-undecodable-provider-runtime-rows branch July 17, 2026 21:26
adamfgr pushed a commit to agriffiths-bots/t3code that referenced this pull request Jul 18, 2026
* [codex] Expand real-route app store screenshot harness (pingdotgg#4014)

Co-authored-by: codex <codex@users.noreply.github.com>

* fix(server): use CLAUDE_CONFIG_DIR instead of HOME for Claude instanc… (pingdotgg#4017)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

* feat: show nightly update changelog tooltip (pingdotgg#3832)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

* fix(git): treat selected commit paths literally (pingdotgg#3998)

* fix(server): stabilize non-repository Git diagnostics (pingdotgg#4077)

* Refresh app icons across release variants (pingdotgg#4080)

Co-authored-by: codex <codex@users.noreply.github.com>

* Update marketing GitHub star count (pingdotgg#4088)

* fix(marketing): correct Cursor icon color (pingdotgg#4090)

* Normalize protocol-relative remote host input as https (pingdotgg#3971)

* fix(cursor): default binary path to cursor-agent (avoid path conflict w/ grok) (pingdotgg#4094)

* Fix documented task-runner commands (bun run -> vp) (pingdotgg#3965)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* Allow preview panel to grow on wide displays (pingdotgg#4044)

* fix: prevent initial right-click from selecting a context menu item (pingdotgg#3877)

* Fix duplicate keybinding rule when replacing with an existing rule (pingdotgg#3969)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(server): image upload crashed dispatchCommand with a stack overflow (pingdotgg#3952)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* Remove unused code parameter from describePreviewError (pingdotgg#3970)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>

* [codex] prevent ACP assistant ID collisions after restarts (pingdotgg#3932)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(web): inset Windows desktop scrollbars from resize edge (pingdotgg#4097)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>

* [codex] fix mobile composer Enter behavior (pingdotgg#3930)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>

* feat(server): include runtime model and effort in Codex developer instructions (pingdotgg#3948)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(ux): spamming cmd + , no longer stack opening settings (pingdotgg#2757)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(terminal): strip AppImage runtime env from spawned terminals (pingdotgg#3108)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>

* fix(server): thread cwd through Claude capability probe (pingdotgg#2048) (pingdotgg#2124)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* [codex] fix: guard invalid web timestamps (pingdotgg#3515)

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* [codex] fix: tolerate invalid latest user message timestamps (pingdotgg#3521)

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* [codex] Fix provider update checks restore defaults (pingdotgg#3531)

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(server): skip undecodable provider runtime rows when listing sessions (pingdotgg#3951)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>
Co-authored-by: codex <codex@users.noreply.github.com>

* Share MCP OAuth locks across Codex shadow homes (pingdotgg#4104)

* Preserve T3 Code identity in macOS development launcher (pingdotgg#4102)

* fix(web): increase contrast of question option descriptions (pingdotgg#3867)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(sync): reconcile fork divergences after upstream cherry-picks

Post-cherry-pick fixups for the 20260718 upstream sync:
- ElectronUpdater: restore setAllowDowngrade key dropped during pingdotgg#3832 conflict resolution
- AcpSessionRuntime: thread assistantItemRuntimeId through the fork's
  session/load replay path (observeSessionLoadAssistantSegments +
  ensureActiveAssistantSegmentState) to match upstream pingdotgg#3932's collision-safe
  assistant item id scheme
- Update fork tests asserting the old assistant item id format to the
  runtime-scoped format (AcpJsonRpcConnection, CursorAdapter)
- GitVcsDriverCore test: expect the fork's for-each-ref listRefs command under
  pingdotgg#4077's stable-diagnostics assertion
- showcasePendingTasks test: add fork-required dataAudience to EnvironmentProject fixtures

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* style: format GitVcsDriverCore.test.ts (vp check --fix)

* fix(sync): coerce optional itemId to string in CursorAdapter.test asserts

* style: format CursorAdapter.test.ts

---------

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Dimitar Stoykov <mitkostoikov1988@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Hugo Vizcaino Santana <42343504+HugoVizcainoSantana@users.noreply.github.com>
Co-authored-by: Eric Tsai <52527831+EricTsai83@users.noreply.github.com>
Co-authored-by: Manuel De Ceglie <80224270+AmoonPod@users.noreply.github.com>
Co-authored-by: Kriday Dave <technocratix902@gmail.com>
Co-authored-by: BunnyGamezsc <146652788+BunnyGamezsc@users.noreply.github.com>
Co-authored-by: Olivier Melcher <olivier.melcher@gmail.com>
Co-authored-by: Fazal Kadivar <fazalkadivar7@gmail.com>
Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>
Co-authored-by: Maxwell Young <maxtheyoung@gmail.com>
Co-authored-by: Yukun Shan <92423096+nateEc@users.noreply.github.com>
Co-authored-by: James <105842516+jamesx0416@users.noreply.github.com>
Co-authored-by: Leonel Rivas <herial_vi@icloud.com>
Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Co-authored-by: Wout Stiens <71498452+StiensWout@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: xxashxx-svg <xxanshxx9@gmail.com>
Co-authored-by: wizzoapp[bot] <254688279+wizzoapp[bot]@users.noreply.github.com>
Co-authored-by: Wizzo Bot <wizzoapp@users.noreply.github.com>
tarik02 added a commit to tarik02/t3code that referenced this pull request Jul 18, 2026
* Use client-side fallbacks for missing project favicons (pingdotgg#3959)

* Skip stale working-task notifications (pingdotgg#3961)

* Prepare Android beta branding and review diff UI (pingdotgg#3967)

* perf(web): duty-cycle status animations and remove fixed noise overlay (pingdotgg#3978)

* fix(docs): correct CI task-runner commands in ci.md (pingdotgg#3990)

* fix(docs): repair broken source links in architecture overview (pingdotgg#3991)

* fix(docs): replace stale codething-mvp absolute paths with repo-relative links (pingdotgg#3992)

* docs: Add T3 Code Legal Docs (pingdotgg#3972)

Co-authored-by: codex <codex@users.noreply.github.com>

* Fix Legal modal header crash (pingdotgg#4000)

Co-authored-by: codex <codex@users.noreply.github.com>

* [codex] Fix onboarding connection status (pingdotgg#4001)

Co-authored-by: codex <codex@users.noreply.github.com>

* Isolate native diff highlight grammar state (pingdotgg#4029)

* Fix macOS fullscreen titlebar spacing (pingdotgg#4019)

* Prevent duplicate project workspace roots (pingdotgg#3829)

Co-authored-by: codex <codex@users.noreply.github.com>

* Normalize over-indented markdown list items (pingdotgg#4020)

Co-authored-by: codex <codex@users.noreply.github.com>

* Resolve localhost preview URLs for remote environments (pingdotgg#4011)

Co-authored-by: codex <codex@users.noreply.github.com>

* fix(mobile): Send composer images in upload wire format (pingdotgg#4035)

* Fix iOS terminal Enter input encoding (pingdotgg#4043)

* Add native mobile share target support (pingdotgg#4021)

Co-authored-by: codex <codex@users.noreply.github.com>

* [codex] Expand real-route app store screenshot harness (pingdotgg#4014)

Co-authored-by: codex <codex@users.noreply.github.com>

* fix(server): use CLAUDE_CONFIG_DIR instead of HOME for Claude instanc… (pingdotgg#4017)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

* Fix dropped events during initial thread snapshot (pingdotgg#4079)

* feat: show nightly update changelog tooltip (pingdotgg#3832)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

* fix(git): treat selected commit paths literally (pingdotgg#3998)

* fix(server): stabilize non-repository Git diagnostics (pingdotgg#4077)

* Refresh app icons across release variants (pingdotgg#4080)

Co-authored-by: codex <codex@users.noreply.github.com>

* Update marketing GitHub star count (pingdotgg#4088)

* fix(marketing): correct Cursor icon color (pingdotgg#4090)

* Normalize protocol-relative remote host input as https (pingdotgg#3971)

* fix(cursor): default binary path to cursor-agent (avoid path conflict w/ grok) (pingdotgg#4094)

* Fix documented task-runner commands (bun run -> vp) (pingdotgg#3965)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* Allow preview panel to grow on wide displays (pingdotgg#4044)

* fix: prevent initial right-click from selecting a context menu item (pingdotgg#3877)

* Fix duplicate keybinding rule when replacing with an existing rule (pingdotgg#3969)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(server): image upload crashed dispatchCommand with a stack overflow (pingdotgg#3952)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* Remove unused code parameter from describePreviewError (pingdotgg#3970)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>

* [codex] prevent ACP assistant ID collisions after restarts (pingdotgg#3932)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(web): inset Windows desktop scrollbars from resize edge (pingdotgg#4097)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>

* [codex] fix mobile composer Enter behavior (pingdotgg#3930)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>

* feat(server): include runtime model and effort in Codex developer instructions (pingdotgg#3948)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(ux): spamming cmd + , no longer stack opening settings (pingdotgg#2757)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(terminal): strip AppImage runtime env from spawned terminals (pingdotgg#3108)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>

* fix(server): thread cwd through Claude capability probe (pingdotgg#2048) (pingdotgg#2124)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

* [codex] fix: guard invalid web timestamps (pingdotgg#3515)

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* [codex] fix: tolerate invalid latest user message timestamps (pingdotgg#3521)

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* [codex] Fix provider update checks restore defaults (pingdotgg#3531)

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

* fix(server): skip undecodable provider runtime rows when listing sessions (pingdotgg#3951)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>
Co-authored-by: codex <codex@users.noreply.github.com>

* Share MCP OAuth locks across Codex shadow homes (pingdotgg#4104)

* Preserve T3 Code identity in macOS development launcher (pingdotgg#4102)

* fix(web): increase contrast of question option descriptions (pingdotgg#3867)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>

---------

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Kriday Dave <technocratix902@gmail.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Ishan <ishansachu1@gmail.com>
Co-authored-by: Dimitar Stoykov <mitkostoikov1988@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Hugo Vizcaino Santana <42343504+HugoVizcainoSantana@users.noreply.github.com>
Co-authored-by: Eric Tsai <52527831+EricTsai83@users.noreply.github.com>
Co-authored-by: Manuel De Ceglie <80224270+AmoonPod@users.noreply.github.com>
Co-authored-by: BunnyGamezsc <146652788+BunnyGamezsc@users.noreply.github.com>
Co-authored-by: Olivier Melcher <olivier.melcher@gmail.com>
Co-authored-by: Fazal Kadivar <fazalkadivar7@gmail.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>
Co-authored-by: Maxwell Young <maxtheyoung@gmail.com>
Co-authored-by: Yukun Shan <92423096+nateEc@users.noreply.github.com>
Co-authored-by: James <105842516+jamesx0416@users.noreply.github.com>
Co-authored-by: Leonel Rivas <herial_vi@icloud.com>
Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Co-authored-by: Wout Stiens <71498452+StiensWout@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: xxashxx-svg <xxanshxx9@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants