fix(server): preserve automatic settlement timestamps - #9254
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a77a10d157
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a77a10d. Configure here.
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This is a focused correction to automatic settlement timestamps, with coordinated server persistence, bounded repair of legacy projections, and consistent web/mobile display ordering. The change introduces no new workflow, product default, infrastructure change, or static-analysis override, and the affected behavior is covered by targeted tests. Not approved because:
Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more. |
Drop the orchestration_events rewrite from migration 045. Projectors and the engine bootstrap from projection rows and cursors, never a full replay, so repairing projection_threads is enough and the event log stays as recorded. The migration is a single UPDATE and explains why the settledAt == occurred_at match identifies an unrepaired sweep. Migration test covers the no-activity fallback, activity after the sweep, and asserts event payloads are untouched. Engine tests stamp a distinct past settledAt and assert it survives while updatedAt stays the command time; previously they passed the sweep time and asserted nothing. Remove the resolveSettledTimestamp alias on web and have both call sites import the client-runtime helper directly. Mobile slim rows drop the unreachable createdAt fallback. Move the settled ordering line in the user docs into its own paragraph. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Pushed 673f2cd to this branch with a few changes on top of the review:
Thanks for the fix, the core change was right. |
|
rad! Thanks for the review! |
Migration 045 was taken by ProjectionProjectsAutoPull on main, so the settlement repair moves to 046. The test also picks up main's move of NodeSqliteClient into @t3tools/shared. Co-Authored-By: Claude Code <noreply@anthropic.com>
Dismissing prior approval to re-evaluate ab67483
## What's Changed * feat(desktop): browser profiles for the preview browser by @juliusmarminge in pingdotgg/t3code#7254 * refactor(shared): move the node:sqlite Effect SQL client into shared by @juliusmarminge in pingdotgg/t3code#7272 * feat(web): add opt-in panel animations by @maria-rcks in pingdotgg/t3code#8830 * feat(projects): automatically pull clean default branches by @maria-rcks in pingdotgg/t3code#9277 * fix(web): show pull request state icons in tabs by @flamboh in pingdotgg/t3code#9112 * feat(providers): add context compaction across harnesses by @maria-rcks in pingdotgg/t3code#8808 * feat(web): add proactive panels by @maria-rcks in pingdotgg/t3code#9276 * fix(web): unify control sizing across settings pages by @juliusmarminge in pingdotgg/t3code#9281 * fix(web): offer browser profiles from the empty-panel launcher by @juliusmarminge in pingdotgg/t3code#9279 * Revert "feat(providers): add context compaction across harnesses" by @maria-rcks in pingdotgg/t3code#9284 * fix(web): show scroll-to-end as soon as the last message slips under the composer by @juliusmarminge in pingdotgg/t3code#9280 * fix(cursor): honor auto and full access modes by @maria-rcks in pingdotgg/t3code#9283 * fix(desktop): detect installed Spectre libs for Windows builds by @juliusmarminge in pingdotgg/t3code#9285 * fix(pull-requests): missing features & better behaviour by @maria-rcks in pingdotgg/t3code#9188 * fix(providers): discover workspace skills everywhere by @maria-rcks in pingdotgg/t3code#9180 * fix(server): preserve automatic settlement timestamps by @eimexdev in pingdotgg/t3code#9254 * fix(opencode): show Reasoning selector for OpenCode models by @maria-rcks in pingdotgg/t3code#9287 * feat(web): preview document attachments in the file viewer by @juliusmarminge in pingdotgg/t3code#9292 * chore(ci): narrow the UI consistency check-run agent by @juliusmarminge in pingdotgg/t3code#9297 **Full Changelog**: pingdotgg/t3code@v0.0.39-nightly.20260902.1261...v0.0.39-nightly.20260903.1262 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.39-nightly.20260903.1262

Problem
Server-side auto-settlement records the sweep time as
settledAt. On startup, old threads therefore look newly settled and receive incorrect dates and ordering. #9081 suppresses the resulting notifications, but does not correct the durable timestamp.Fix
updatedAtat command time, preserving normal update semantics.projection_threads.settled_atfor identifiable automatic settlements, without changing manual or later re-settled timestamps. The event log is left as recorded: projections and the engine bootstrap from projection rows and cursors, so a projection-only repair is sufficient.resolveSettledThreadTimestamp.Refs #9057
Pairs with #9081
Verification
Made with GPT-5.6 Sol in T3 Code through the Codex harness. Follow-up commit by Claude Fable 5 in Claude Code.
Note
Medium Risk
Schema-breaking
thread.auto-settlenow requiressettledAt, and migration 046 rewrites settled timestamps on projection rows for identifiable automatic settlements—deployments should run migrations before relying on sidebar ordering.Overview
Automatic thread settlement now persists when work ended, not when the server sweep ran.
resolveAutoSettlementAtreturns the activity timestamp (ornull);ThreadSettlementReactorpasses it as requiredsettledAtonthread.auto-settle, and the decider writes that tosettledAtwhileupdatedAtstays the command time.Migration 046 repairs legacy
projection_threads.settled_atrows where auto-settlement stamped the sweep time (identified via server auto-settle events). Manual and later re-settled threads are left alone; orchestration event payloads are unchanged.Clients share
resolveSettledThreadTimestampfrom client-runtime so web and mobile sort and label the Settled shelf from the same stamp (settledAt, then latest activity, thenupdatedAt). Docs describe that ordering behavior.Reviewed by Cursor Bugbot for commit ab67483. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve
settledAttimestamp in automatic thread settlement and repair legacy projectionsresolveAutoSettlementAtin ThreadSettlementPolicy.ts now returns an ISO timestamp instead of a boolean;ThreadSettlementReactorincludes it onthread.auto-settlecommands, and the decider in decider.ts persists it assettledAtwhileupdatedAtremains the event timeThreadAutoSettleCommand.settledAtas a required field in orchestration.ts, making commands schema-invalid without a valid settlement timestampsettledAtequals the event time, replacing it with the latest pre-settlement activity or creation timestamp without touching orchestration event payloadsresolveSettledThreadTimestampin threadSort.ts and adopts it across web sidebar sorting/labels and mobile settled-row ordering and display so clients prefer persistedsettledAt, then latest activity, thenupdatedAtthread.auto-settlewithoutsettledAtwill now fail schema validation; migration 045 rewritessettled_aton projection rows for automatic settlements where it matchedoccurred_at, so deployments should verify the migration completes before serving readsMacroscope summarized 673f2cd.