Skip to content

fix(custom): rebase onto .4994, keep migration 99 for existing databases, Tot fixes - #80

Merged
CarsonJF merged 0 commit into
customfrom
t3/rebase-custom-4994
Nov 20, 2026
Merged

CarsonJF merged 0 commit into
customfrom
t3/rebase-custom-4994

Conversation

@CarsonJF

Copy link
Copy Markdown
Owner

Rebases custom onto upstream v0.1.12-nightly.20261120.4994 and fixes the migration bug that broke the .4941 custom release, plus three Tot fixes.

Do not merge this through GitHub. The branch is a rebase onto a newer upstream tag, so the PR diff includes upstream's commits. It lands the way the pipeline lands a rebase: git push --force-with-lease origin t3/rebase-custom-4994:custom, after review. Nothing has been force-pushed and nothing has been released.

Rebase

  • 130 fork commits replayed onto the tag. Conflicts were resolved keeping both sides: the project handlers (upstream's workspace-model check and launch-retry guard inside the fork's afterForwarding wrapper), docs/internals/remote.md, the lockfile (fork additions on upstream patch hashes), and a FilePreviewPanel import.
  • Rebase fallout fixed in separate commits: the routes pipe went over 20 arguments (the Tot layers now compose as one), upstream's new background-wait test needed the not-a-Tot layer, mobile used the removed updateMobilePreferencesAtom, and the agent context budget was regenerated.

Migration ids (the .4941 breakage)

Existing custom databases recorded 99 = ScheduledTaskCreatedByTot. The .4941 repair moved it to 101 behind upstream's 099_BackgroundRecoveryIndexes. The migrator compares ids, so every existing database refused to start.

  • ScheduledTaskCreatedByTot is 99 again. Upstream's 099–102 are 100–103 here.
  • Every migration from 99 on is idempotent: a column check, IF NOT EXISTS, and a drop-and-rebuild for ThreadItemCounts.
  • Startup, and the update preflight, rewind a history recorded in another order and replay it in ours. That covers a fresh .4941 custom database (99 BRI, 100 TSRI, 101 STCBT) and a stock upstream database.
  • CUSTOM.md → "Migration ids" records the invariant and the +1 offset for future rebases.
  • Proof:
    • On a schema-and-ledger copy of the Asuna database, the published 666f15416d code fails with 99_BackgroundRecoveryIndexes (recorded: ScheduledTaskCreatedByTot).
    • This branch migrates the same copy to 103.
    • A fresh database written by 666f15416d also upgrades.
    • Regression tests are in Migrations.test.ts and servicePreflight.test.ts.

Tots

  • Auto-settle is opt-in. A Tot's own tot: thread is excluded from automatic settlement unless that Tot has autoSettle: true. Absent means off, so existing Tots stop settling too. The switch is in the Tot's settings panel on web. Explicit settles such as Start fresh are unchanged.
  • Stale thread send. t3_thread_send aimed at a tot: thread that is no longer its Tot's current thread now goes to the current thread. If the Tot is off, it fails with thread_not_sendable and a clear message. The sent run is watched on the thread the message actually reached.
  • fix(tots): report Completed only after awaited background work settles #77 follow-up (Opus review):
    • The watcher now also wakes on the work-ended events ThreadSettlementService uses (provider-thread.updated, turn-item.updated, subagent.updated that end work, and run.background-work-cancelled). A run left waiting on awaited work now reports Completed when that work ends.
    • A sent watch passed by a later run ends instead of leaking.
    • Idle-compaction runs (idle-compact: message ids) no longer wake watching Tots.
    • The new tests drive the real domain-event stream.

Checks

  • vp run check:changed v0.1.12-nightly.20261120.4994: format, lint, knip, typecheck, and react compiler pass. Tests: 3623 pass and 20 fail:
    • 18 web browser tests in ChatView*.browser.test.tsx and DraftHeroHeadline.browser.test.tsx fail identically on the untouched upstream tag, so they predate this branch.
    • The 2 threadNotifications.test.ts failures were a load timeout. The file passes 3/3 when run alone.
  • vp run check:changed origin/custom: everything but tests passes. The test step (465 files) hit the script's 900s limit.
  • Focused tests pass: server persistence, preflight, Tots, settlement, OrchestratorMcpService and MCP toolkits (436), and web Tots (59).

Not covered

  • Mobile has no auto-settle switch; the server default applies there.
  • t3_thread_send_attachments does not redirect stale Tot threads.
  • No real-client UI pass, and no run against a full copy of the live database (only a schema-and-ledger copy).

Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

@CarsonJF
CarsonJF merged commit 3e1ec0f into custom Nov 20, 2026
@CarsonJF
CarsonJF deleted the t3/rebase-custom-4994 branch November 25, 2026 04:41
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