GeezerVison is showing github.com — fix(app): un-settled threads return to the top of the list by rynfar · Pull Request #109 · pylon-code/pylon
Conversation
rynfar
commented
Aug 27, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Un-settling a thread dropped it back into its old creation-order slot in the sidebar, so the thread you just pulled back into play was hard to find again. It should come back like it just had a new action.
The server now stamps unsettledAt on the thread when a thread.unsettled event lands — an explicit un-settle, or an explicitly settled thread waking on new activity. Web and mobile sort the active list by max(createdAt, unsettledAt) through a shared activeThreadAnchorTimestampMs, so the un-settled thread surfaces at the top and holds that spot until it settles again. The list stays static otherwise and row timestamps do not change. A thread already pinned active keeps its existing stamp, so the activity reset that clears the pin does not reshuffle the list. unsettledAt is optional in the contract, so payloads from servers without the stamp still decode and keep creation order.
Pylon adaptation
Upstream shipped the schema change as migration 043. Pylon retired id 36 and renumbered 037–040, and already holds 043_ProjectionThreadSessionLifecycle through 046_ProjectionThreadLinkedPullRequest, so this lands as 047_ProjectionThreadsUnsettledAt. Reusing 43 would let environments that already recorded the session-lifecycle migration silently skip the unsettled_at column. Migrations.ts was the only conflict; the comment above the new entry follows the convention already used for the 040/041/042/045/046 renumbers. Everything else applied cleanly.
Known limit, inherited from upstream
Threads that settle automatically — inactivity window, merged pull request — still return to their old position when new activity wakes them. Auto-settle is derived on the client, so the server has no event to stamp. That needs its own design.
Checks
- 74 focused server tests:
projector.settled, projector, decider.settled, ProjectionPipeline, ProjectionSnapshotQuery, ProjectionRepositories.
- 155 focused client tests:
Sidebar.logic (web) and threadListV2 (mobile).
- Typecheck passes for server, contracts, client-runtime, web, and mobile. The only diagnostics are pre-existing
unnecessaryFailYieldableError suggestions in untouched files.
- Lint and format clean on all 22 changed files. The two
prefer-set-has warnings in ProjectionSnapshotQuery.test.ts are present on pylon already.
- Migration manifest verified: 46 entries, no duplicate ids, strictly increasing, ending at
47_ProjectionThreadsUnsettledAt. The repository test exercises the real column — SqlitePersistenceMemory runs runMigrations(), and the test asserts unsettledAt round-trips through SQLite.
Not covered: no browser pass on the reordering, since computer use was not requested here.
Upstream: pingdotgg/t3code#8231 (3b86ef941).
Model: Claude Opus 5. Harness: Claude Code.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2Fef26d88456de9cc93cf03b8611c53675c8af4fc8361b0049e62a133b46e853b6%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2e737667)
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Claude Fable 5 <[email protected]>
(cherry picked from commit 3b86ef941c218a000a2ea9920480f469b726f437)
Thread transfer impact
✅ Thread transfer remains within every enforced ceiling.
| Provider |
Metric |
Main baseline |
This PR |
Impact |
PR ceiling |
|
| Codex |
Total thread wire |
13.3 KiB |
13.3 KiB |
+50 B (+0.4%) |
15.1 KiB |
✅ |
| Codex |
Thread snapshot wire |
6.9 KiB |
6.9 KiB |
+8 B (+0.1%) |
7.3 KiB |
✅ |
| Codex |
Live turn WebSocket wire |
6.4 KiB |
6.4 KiB |
+42 B (+0.6%) |
7.8 KiB |
✅ |
| Codex |
Live turn WebSocket decoded |
55.5 KiB |
55.6 KiB |
+44 B (+0.1%) |
66.4 KiB |
✅ |
| Codex |
Live turn messages |
9 |
10 |
+1 (+11.1%) |
21 |
✅ |
| Claude |
Total thread wire |
13.3 KiB |
13.3 KiB |
+6 B (+0.0%) |
15.1 KiB |
✅ |
| Claude |
Thread snapshot wire |
6.9 KiB |
6.9 KiB |
0 B (0.0%) |
7.3 KiB |
✅ |
| Claude |
Live turn WebSocket wire |
6.4 KiB |
6.4 KiB |
+6 B (+0.1%) |
7.8 KiB |
✅ |
| Claude |
Live turn WebSocket decoded |
56.4 KiB |
56.4 KiB |
0 B (0.0%) |
66.4 KiB |
✅ |
| Claude |
Live turn messages |
10 |
10 |
0 (0.0%) |
21 |
✅ |
Baseline: 3ba1857 · PR result: 7f80f59 · Source CI: success
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 109.4 KiB
- Claude decoded thread snapshot: 110.1 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Adversarial review of the port found two gaps, both in the seams the Pylon
adaptation created rather than in upstream's behavior.
047 was the only migration in the 042-046 run without a sibling test. That
matters most for a hand-applied renumber: if the id collided with one a
database had already recorded, Migrator skips the file, the ALTER TABLE never
runs, and every thread read then throws `no such column: unsettled_at`,
because the snapshot queries select it unconditionally. The new test steps
46 -> 47 and asserts the column is absent before and present after, plus an
idempotence case over the guarded PRAGMA check.
mergeEnvironmentThread takes the shell as authoritative for thread lifecycle
and copies archivedAt, settledOverride, settledAt, snoozedUntil, snoozedAt,
pinnedAt and pinOrderKey — but unsettledAt was not added alongside them. A
cached detail merged with a fresher shell produced settledOverride "active"
with no stamp, a state the server cannot emit. Not observable yet, since only
shells feed the sidebar sort, but it would have silently mistrained the next
consumer. Fixed, with a regression test verified to fail without the fix.
|
Adversarial review before merge. This one came back clean on the parts that matter most — all seven categories I attacked verified sound. Two gaps worth closing, both in the seams the Pylon adaptation created rather than in upstream's behavior. Fixed in 7f80f5961.
047 was the only migration in the 042–046 run without a sibling test. Every one of 042–046 ships a test that steps runMigrations to N-1, then N, and asserts the column landed. That guard matters most for a hand-applied renumber: if the id had collided with one a database already recorded, Migrator skips the file, the ALTER TABLE never runs, and then every thread read throws no such column: unsettled_at, because ProjectionSnapshotQuery and ProjectionThreads select it unconditionally — the sidebar would simply never load. Id 47 is genuinely free, so this was a missing safety net rather than a live bug, but it is the one guard this repo uses everywhere else for exactly this class of mistake. Added, including an idempotence case over the migration's guarded PRAGMA check.
mergeEnvironmentThread dropped the new lifecycle field. It treats the shell as authoritative and copies archivedAt, settledOverride, settledAt, snoozedUntil, snoozedAt, pinnedAt, pinOrderKey — but unsettledAt was not added alongside them. A cached detail merged with a fresher shell produced settledOverride: "active" with no stamp, a state the server cannot emit. Not observable today, since only shells feed the sidebar sort, but it would have silently mistrained the next consumer. Fixed, with a regression test I confirmed fails without the fix:
AssertionError: expected { id: 'thread-1', …(29) } to match object { settledOverride: 'active', …(2) }
- "unsettledAt": "2026-08-26T10:00:00.000Z",
+ "unsettledAt": null,
Verified end to end and left alone. The highest-risk question — does the stamp actually reach the client sort, or does the feature silently no-op — traces cleanly: getActiveThreadRowById selects the column, ws.ts's toShellStreamEvent default branch refetches on any thread-aggregate event so thread.unsettled does trigger a refresh, and it flows through the shell reducer and atoms into sortThreadsForSidebar. Read paths pair 4/4 and 2/2 against settled_at; all 19 upsert sites are covered; the three implementations of the stamping rule in projector.ts, ProjectionPipeline.ts, and threadReducer.ts agree byte for byte; every reason: "activity" emitter is gated on settledOverride !== null, so the "activity never reorders the list" invariant holds; the anchor is applied only to the active bucket on both clients; and the contract-optional / persistence-required asymmetry is safe in both directions.
Three findings I looked at and am deliberately not acting on:
- A client-auto-settled thread that wakes on activity gets no stamp, so it re-enters at its old slot. This is upstream's documented known limit — auto-settle is client-derived, so the server has no event to stamp. I checked whether
docs/user/thread-sidebar.md overstates it and concluded it does not: it says "when you un-settle a thread", which is the explicit action, and that path stamps correctly even for an auto-settled thread.
- Wake-from-snooze also re-enters without a stamp, so snooze and un-settle order differently. A real asymmetry, but changing it is a product decision about snooze, not part of this port.
- Divergent per-device auto-settle windows can make a thread jump to the top on a device that never saw it as settled. Defensible — someone did re-enter it.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
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.
|