GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): migration 100 skips user messages whose payload is not valid JSON by only21mil · Pull Request #44484 · pingdotgg/t3code

Conversation

@only21mil

@only21mil only21mil commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Problem

When the server starts on a database holding a user message whose payload is not valid JSON, migration 100 fails with malformed JSON and the server exits. Its partial index on slash-command messages reads the payload with json_extract, which raises on a damaged row.

Since #44461, migration 69 skips such a message, so it now reaches 100.

Change

Add json_valid(payload_json) before the json_extract term in DEFERRED_COMMAND_MESSAGE_CONDITION, the guard #35884 and #36898 use. Migrations 100 and 107 build the index from it, and the turn-start read in ProjectionStore spells it so SQLite picks that index. A damaged message is left out of the index.

No new migration is needed. Migration 107 rebuilds the index, so a database below 107 gets the guard. One that already ran 107 keeps its index, which never accepted a damaged user message, and the new read still uses it: each term of its WHERE is in the read. That database still refuses a damaged write, as today; the app never makes one, so there is no rebuild like #36898's migration 92.

Scope

A small fix for an obvious startup failure, covered by a new migration test, so it needs no issue. One production line in apps/server.

Verification

Setup: Linux, Node 26.13.1 (SQLite 3.54.1), a fresh --base-dir per commit with the same synthetic userdata/statev2.sqlite: migrated to 68, plus a settled user message whose payload stops after {"text":"/comp (inserted by hand, as the app never writes one) and a valid /compact message.

Steps: t3 serve --base-dir <dir> --port 47447 --host 127.0.0.1, log filtered, timestamps cut.

Before, 7ffbf77 (main), exits 1 and leaves the database at 99:

  migration: 100_TurnStartReadIndexes
ERROR (#2): MigrationError: Migration "100_TurnStartReadIndexes" failed
      [cause]: Error: malformed JSON

After, bfdfbca on 7ffbf77, it migrates through 119, keeps both rows and indexes only /compact:

  migration: 107_DeferredSlashCommandIndex
  migration: 119_WorkflowRunSubject
INFO (#601): Listening on http://127.0.0.1:47447
T3 Code server is ready.

The new 100_TurnStartReadIndexes test seeds a damaged user message and a valid /compact one at migration 99, then runs every migration. On main it fails with malformed JSON at migration 100. With this change it passes, and only the valid slash command matches. A second case rebuilds the index as migration 107 left it and checks EXPLAIN QUERY PLAN still uses it; the existing ProjectionStore test checks a fresh database. vp run check:changed passes.

Not shown

  • No screenshots: nothing on screen changes.
  • A thread holding a damaged user message still fails its turn-start read in another query of the same function, a separate fix.

Generated with Gemini 4 Neon in T3 Code Nightly

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@only21mil
fix(server): migration 100 skips user messages whose payload is not v…
bfdfbca
…alid JSON
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The deferred-command condition now checks that the message payload is valid JSON. Migration tests verify selection of valid command messages and use of a legacy deferred-command index.

Changes: Deferred command validation

Layer / File(s) Summary
Validate deferred command payloads
apps/server/src/orchestration-v2/deferredCommandMessage.ts, apps/server/src/persistence/Migrations/100_TurnStartReadIndexes.test.ts
The deferred-command condition now requires valid JSON. Migration tests check that malformed messages are not selected, valid /compact messages are selected, and queries using the condition can use the legacy index.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 4c96d

The change stops migration 100 from failing on a user message with malformed JSON, and valid slash-command messages stay indexed. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the actual change: migration 100 no longer fails on user messages whose payload is not valid JSON. It follows the conventional commit format. The title is 78 characters, and the change…
Description check Passed The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each section is filled in with specific content. The Problem section gives the failure mo…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the actual change: migration 100 no longer fails on user messages whose payload is not valid JSON. It follows the conventional commit format. The title is 78 characters, and the change adds a json_valid guard to the deferred-command index condition, which the raw summary confirms.

Full details: Description check

Explanation

The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each section is filled in with specific content. The Problem section gives the failure mode and cause. The Change section explains the guard and why no new migration is needed. The Scope section explains why no issue is linked. The Verification section gives the setup, before and after results, and the new tests. The description also states what was not checked. The description does not include a model/harness line in the template format, but it does include a generation note. These gaps are minor.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: main
  • File: .coderabbit.config.ts
  • Commit: d0f148b
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 744a88d3-2751-486b-9c24-804adc101504
Commits

Reviewing files that changed from the base of the PR and between bfdfbca and 4c96d47.

Files selected for processing: 1

  • apps/server/src/persistence/Migrations/100_TurnStartReadIndexes.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 27, 2026
juliusmarminge and others added 2 commits November 27, 2026 22:32
@juliusmarminge
Merge remote-tracking branch 'origin/main' into fix/server-migration-…
765e12f
…100-malformed-json-guard
@juliusmarminge @claude
test(server): drop assertion that passes without the guard
4c96d47
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge

juliusmarminge commented Nov 27, 2026

Copy link
Copy Markdown
Member

Evidence

Created fresh synthetic databases through migration 68 on both commits, inserted the same truncated JSON user message and valid /compact message, then started each built server with identical arguments. Linux x86_64; captures are 1600×1000 renderings of live server output and database results.

Before After
d0f148b2cb 4c96d4709e
Before: migration 100 fails with malformed JSON After: startup succeeds and valid slash command is indexed
Exit 1; migration ledger 99; both messages preserved. Server ready; migration ledger 119; both messages preserved; forced partial-index scan returns only msg-compact.
Startup recording Startup recording

Driver · Database seed script · Before output and database results · After output and database results

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 27, 2026
@juliusmarminge
juliusmarminge merged commit 146a77d into pingdotgg:main Nov 27, 2026
55 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 27, 2026
@omegent-app omegent-app Bot mentioned this pull request Nov 28, 2026
Merge upstream main through 0f78747290a1 patroza/t3code#688
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@only21mil @juliusmarminge
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.