perf(server): adopt the upstream server performance pass - #252
Merged
Conversation
…into memory from db (#8988)
…he perf pass Two regressions the perf chain introduced. #8988 narrows the thread-shell summary read to listUserInputLifecycleByThreadId, whose SQL filters to the three user-input.* kinds. Pylon's Prime adapter emits generic interaction.* activities for the same pending-input count, and shouldRefreshThreadShellSummary already wakes on them — so the refresh fired and read nothing, driving pending_user_input_count to zero and blanking the sidebar indicator. The filter now covers both families. #8187 makes raw ACP protocol logging opt-in behind verboseProtocolLogging, which no production adapter sets. Pylon's Prime thought-chunk test asserted an outgoing protocol frame reached the native log; that frame no longer exists for any ACP provider. The test now asserts the stronger property: no protocol frames at all, so a thought chunk has no path to disk.
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Five upstream perf commits, in order:
#8988stop loading full tool-call output from the DB on every refresh#9000bound snapshot activity payload memory#9032skip full-message reads while streaming#8187cut idle CPU use and stop provider event leaks#8368cut chatty tool-update frames by 90%#9024was already onpylon, so its cherry-pick was correctly a no-op.Carve-outs
ProjectionSnapshotQuery.#9000extracts the pinned-activity CTE intopinnedThreadActivityIdsCte. Pylon pins one more thing than upstream — the latestturn's authoritative plan, via
latest_plan_activity— and its tests assert 504activities where upstream asserts 503. Both are preserved. Upstream also
reintroduced a plainer
ProjectionThreadSessionDbRowSchemaalongside Pylon's,which carries
restoredandpendingTurnRequestAmbiguous; the duplicate isdropped and Pylon's kept.
ProviderRuntimeIngestion.#8187adds an early return for non-assistantcontent deltas and drops the unconditional
getPendingTurnStartByThreadIdread infavour of an event-gated one. Both are taken. Pylon's rate-limit handling and its
turn.completedcapacity refresh — the composer capacity gauge — sit in the samehunk and are kept, as does
let thread, which Pylon reassigns further down.Two regressions this surfaced, both fixed in the last commit
Pylon's pending-input count silently went to zero.
#8988narrows thethread-shell summary read to a query whose SQL filters to the three
user-input.*kinds. Pylon's Prime adapter emits generic
interaction.*activities for the samecount, and
shouldRefreshThreadShellSummaryalready wakes on them — with acomment saying so. So the refresh fired, read no rows, and wrote zero. Nothing
typechecked wrong;
ProjectionPipeline.test.tscaught it.Prime protocol logging.
#8187puts raw ACP protocol logging behind a newverboseProtocolLoggingflag that no production adapter sets — upstream's ownGrok and Cursor adapters included, and the flag appears set only in upstream's
unit test. Pylon's Prime thought-chunk test asserted an outgoing protocol frame
reached the native log. That frame no longer exists for any ACP provider, so the
test now asserts the stronger property instead: no protocol frames at all, which
means a thought chunk has no path to disk.
Verification
t3typecheck clean, lint clean, 3890 server tests passing (2 were failingbefore the fixes above; both bisected to the commit that caused them).
Model: Claude Opus 5 in Claude Code.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.