Repository navigation
perf(server): cut shell snapshot and enrichment query overhead - #47780
Conversation
Co-Authored-By: Julius Marminge <[email protected]>
Co-Authored-By: Julius Marminge <[email protected]>
Co-Authored-By: Julius Marminge <[email protected]>
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — The change reduces shell snapshot queries by batching fork-source reads and fetching only projects affected by enrichment refreshes. Its read-only scope introduces no obvious material risk requiring human judgment. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 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.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
…otgg#47780) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <[email protected]> (cherry picked from commit 7d4b3c5)
Merges upstream `pingdotgg/t3code` `3067c49847` (301 commits since `fc5ddf3d3c`). > **Merge this PR with "Create a merge commit". Do not squash it.** > pingdotgg#323 was squash-merged, so `fc5ddf3d3c` stopped being an ancestor of `main` and this merge's base fell back to `c16ad0ce17`: 1013 commits and 180 forecast conflicts. The first commit here, `git merge -s ours fc5ddf3` with the tree unchanged, puts the ancestry back. A squash would throw that repair away along with this merge's own parent. ## Commits (read in order) 1. `chore: record upstream fc5ddf3 as merged`: the ancestry repair, with no content change (`git diff f455503 HEAD^` is empty). 2. `chore: merge upstream t3code to 3067c49`: the merge itself, the `threads.moveWorkspace` union entry, and the docs/fork updates. ## Numbers - Landed 817 files against 819 in the upstream range. The two missing files are `apps/server/src/cli/pair.ts` and its test, which the fork deletes on purpose. - Fork delta: 802 files. ## Conflicts (5, each resolved by its verdict) - `cli/pair.ts` and `cli/pair.test.ts`: upstream modified them and the fork deletes them, so they stay deleted. - `ui/textarea.tsx`: upstream's class string, plus the fork's `font` prop. - `agentContextBudget.json`: upstream's values, with `mcpToolListJsonBytes` set to upstream + 108 (63684). `AgentContextBudget.test.ts` passes. - `pnpm-lock.yaml`: re-derived from upstream's copy. `duplicate-adds` and `resolution-check` are clean. The owned-concern sweep matched 6 new files: four vendored libghostty headers and two e2e scenarios, all false positives. ## Feature classification **Usable as-is** - Effect 4.2.0 (pingdotgg#47767) and libghostty-vt 1.0.2 (pingdotgg#47842). - Several hundred web, mobile and shared fixes: footnotes, previews, the workflow panel, PR UI and more. **Unsupported in Moatless / needs implementation** - `threads.moveWorkspace` (pingdotgg#47234: "Move to project…", the palette folder pick, and recovery from a missing workspace). The union entry is added. Every entry point checks the `threadWorkspaceMoves` capability, which Moatless does not report, so the surface is hidden with no fork gate. Recorded in gaps.md under the methods and capabilities entries. - Blume docs site at t3.codes/docs (pingdotgg#44630): upstream publishing, not relevant to the fork. **Backend behavior to consider reproducing in Moatless** (added to gaps.md under runtime fixes) - Worktree recovery and setup reruns after a stopped turn, a retry, or a failed hook (pingdotgg#47694, pingdotgg#47681, pingdotgg#47679, pingdotgg#47685). - Commits stop when the checkout moves under them (pingdotgg#47617, pingdotgg#47526, pingdotgg#47438), and reused PR worktrees stay on the recorded head (pingdotgg#47596, pingdotgg#47528, pingdotgg#47799). - Scheduled runs resume watching their turn after a restart (pingdotgg#47732) and don't fire twice for one slot (pingdotgg#47722). - Codex resumes and forks keep the selected reasoning effort (pingdotgg#47811). - Perf: shell snapshot queries (pingdotgg#47780), workflow questions answered in one query (pingdotgg#47734), bounded history reads (pingdotgg#47544), event-log pruning (pingdotgg#47862). ## Verification - `verify.mjs`: the parallel pass got the pod evicted, so it was re-run with `--sequential`. Everything except tests is green: duplicate-adds, tripwires, resolution-check, unsupported-methods (after the ADD), lockfile, fmt, lint, typecheck and build. - Tests: 39 of 40 completed packages pass. `@t3tools/shared` fails only `AgentScope`, a known OOM-score sandbox gap. - **Not fully verified: `t3` (apps/server) did not finish.** The container stopped after about 3 hours, 84 files in. Every failure up to that point is a known sandbox gap: - git `insteadOf`, Chromium, and the Codex `/tmp` sticky bit. - `ProjectionStore` and `Orchestrator.control-reads`, which call Node 26's `StatementSync.stat` while the sandbox runs Node 24. - The `t3` tests beside the fork's server delta were run separately: 12 files, 366 tests, all passing. CI should run the rest. - The commit skipped the known knip pre-commit failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- Moatless task: https://moatless.soaplabstest.com/tasks/bc02b1b2-62c6-4ed0-9429-49bb17da1c4c
Problem
Two server shell paths do more database work than they need to:
Change
ProjectionStore.ts: fork sources are looked up in one batch per ancestry level instead of one query per source. Query count now grows with ancestry depth, not with the number of sources. A single deep chain gains little.ProjectStore.ts/ws.ts: enrichment reads only the projects whose roots are in the refresh batch, using the existing index. Startup and the client payloads stay the same.Neither change touches the wire format or adds caching, so there is no staleness tradeoff.
Scope
Small performance fix that a maintainer asked for directly (optimize data transfer and DB queries). No issue linked.
Verification
Repro (Node 26.13.1, repo root). The new tests assert the counts above. To see the "before" numbers, apply only the test-file diff on
main.vp run check:changed mainpasses (4 test files, 116 tests). I also tried forcing the shell high-water index on thread replay. It made no difference (19 → 19 SQLite VM steps on 100k events), so it is not included. Not checked: production latency, since no tracing is connected.Done by Devin (Cognition AI).
Implemented in session Optimize data transfer and DB queries in t3code
Review with Devin · Open in Devin Desktop
Note
Devin could not open this Pull Request as the requested session collaborator: they have no GitHub connection usable for this repository.
As a fallback, Devin opened this PR as itself.