Repository navigation
Conversation
|
@coderabbitai review |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Bounds settled-shell cutoff timestamp storage to 25 entries instead of sorting all settled timestamps. The existing visibility policy and retention exceptions remain unchanged, with no persistent-data changes. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Action not completed
|
|
@maria-rcks could you review the bounded cutoff heap, retention ties/reconnect behavior and the explicitly disclosed large oldest-first CPU tradeoff? The latest head has green runnable CI, no unresolved CodeRabbit findings, and more than 15 minutes without a new real finding. Focused tests and a fresh batch of three independent Codex reviews passed before commit. Benchmark code is local-only and absent from the final diff; workload limits are in the PR description. |
|
Note Written by Verified in a real dev environmentchecked exact head used repository playwright with fresh authenticated shell requests exercised the running server, with the debugger inspecting the timestamp array after collection: freshly paired clients on both versions paged the settled shelf and opened the oldest real transcript. on the pr, pin/unpin and snooze/wake promoted an older thread back to active and fresh snapshots retained it. the restored conversation then completed another real codex turn, returning blacksmith: all 18 shell-stream tests passed; Not verifiednative ios/android and electron clients, other providers, remote relay/tunnel connections, and live subagent/side-chat retention were not exercised. equal-timestamp ties were covered by the existing shell tests, not manufactured in the app. this verifies bounded timestamp storage and preserved behavior; it does not revalidate the description's speed or allocated-byte percentages. the optional allocation sampling attempt timed out without usable measurements. |
|
@juliusmarminge could you review this when you have a moment? Written by Claude Sonnet 5.5 via Claude Code in T3 Code. |
…-shell-cutoff Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Restore the existing omitOlderSettledShells cases and replace the reconnect integration test with one test that feeds the same settled rows oldest-first, newest-first and shuffled, which is what can break in the bounded heap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The automated pipeline stopped on this pull request and will not merge it: the capture step could not show the problem on the base commit, so there is nothing to prove fixed. Created 2 projects and 78 threads on each server; settled 64 with hourly ascending timestamps. Measured trimmed and untrimmed fresh HTTP snapshots with 50 warm-ups and 15 alternating batches of 200 requests per condition. Decoded each server's rows and measured untouched production trimming functions with 20,000 warm-ups and 15 alternating batches of 100,000 calls, pinned to the same CPU core. Compared returned IDs, ordering, cutoff and counts. Exercised cutoff ties and pin/snooze transitions through real server commands. Separately sampled allocations and observed cutoff-array lengths using diagnostic copies excluded from timing. It stays open for a person to finish or close. |



Problem
Shell snapshot trimming collects and sorts every eligible settled timestamp to select the 25th newest cutoff. This creates temporary storage proportional to settled history, although only 25 values are needed. A refreshed 2,403-open-PR catalog and targeted diffs found no existing cutoff optimization; #21082, #27975 and #21627 touch independent snapshot transport, SQL counts or PR-link behavior.
Solution
Keep at most 25 timestamps in a local min-heap. Its root is the same cutoff; counting, ties, input/output order, lineage exclusions, pinned/snoozed/live/ancestor exceptions, and reconnect state remain unchanged. There are no new exports or wire changes.
The local qualification uses the complete baseline/current
omitOlderSettledShellsexports. A read-only sanitized database supplies the canonicalupdated_at ASC, thread_id ASCordering, lineage, settlement timestamps, project grouping and pin/snooze fields for 78 active rows, 64 eligible settled. These fields feed complete schema-decoded shell templates; derived run fields are inert and time is fixed. Complete outputs agree and input immutability is checked. No private message text, title or path is published.Nine alternating batches of 5,000 calls and three GC-inclusive allocation samples measured 25.086 → 13.964 ms (1.80×), with 51.80% fewer sampled allocated bytes. Independent confirmation measured 25.173 → 14.120 ms (1.78×), with 52.05% fewer sampled bytes. Even maximum candidate allocation versus minimum baseline allocation remains above 50% reduction. This qualifies the measured in-memory trimming workload—not SQL, complete subscriber latency, retained heap or whole-app memory.
Known tradeoff: larger oldest-first synthetic histories can be 4–10% slower, despite 67–98% lower sampled allocation. That ordering is reachable through the real SQL sort; the real-shaped result does not erase this limitation. Random, newest-first and tied synthetic histories qualify at 351 and 10,000 rows, but this is not a universal no-slowdown claim. Local benchmarks and artifacts are deliberately excluded from the PR.
Existing tests were expanded before production edits: 18 shell tests plus 4 selected WebSocket/ProjectionStore integration cases pass (subscription trimming, history cursor/counts, deferred decode and subagent-family reads).
vp run check:changedis green, and a fresh batch of three independent Codex reviews is clean. The PR contains only production logic and its prewritten tests, with no visible UI or provider-specific change.Built with GPT-6.1 Sol in the Codex harness through T3 Code.
TLDR
shell-cutoff.mp4