Repository navigation
perf(agent): reduce tool-result availability allocations - #2028
Merged
Merged
Conversation
Keep common publication IDs inline, store batch publication state in existing records, and capture range-local worker indices without argument wrappers. Preserve run-wide deduplication, safe early publication, and canonical drain ordering. Co-authored-by: Mecatl <[email protected]>
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.
Summary
Routine, performance-only repair for the allocation regression following #2013. No public API, event-ordering, guardrail, cancellation, persistence, or model-history contract changes.
No CI jobs, thresholds, baselines, caches, pools, or dependencies were added or changed.
slices.Containsis from the standard library.Allocation evidence
Profile and escape analysis identified the per-run publication map, boolean slice, and worker argument wrappers. Five local samples agreed for every benchmark below (
-cpu=4 -benchmem -count=5).The pre-feature CI counts were 165, 214, 157, 154, 202, and 146 respectively. The remaining event-publication overhead is below the existing 2% threshold in every case.
The requested retry of main's performance run also failed, this time on scenario allocations. Five local samples after this fix produced these medians:
Those are cross-machine comparisons, not a latency claim or a substitute for PR CI. The fix adds 136 raw bytes of inline tracking per Run on amd64; long runs still use an overflow map. It does not claim universal memory/latency improvement.
Verification
Passed:
engine/agenttests and race tests.task --concurrency 3 test:race.go run ./cmd/mecademo.GOMAXPROCS=4 task bench BENCHCOUNT=5; existingperf/cmd/allocsgatepasses against the fetched gh-pages reference without threshold/baseline changes.git diff --check.Local verification notes
GitHub CI passed Build and the complete non-race suite on
94c56cc19; Analysis and the performance gate were still running when checked. The PR is ready for review, enabling the full race/macOS CI jobs. The local observations below are retained for transparency, not additional conditions on PR readiness.task --concurrency 3 testfailedTestADR_0370_Scenario3_LiveOnlyProjection/grpc-disconnect:persisted 0 canonical results after disconnect. This is reproducible on unmodified baseline6473fa341: 16 failures in 10,000 focused repetitions. The fixture cancels after observing the tool-call card, before execution necessarily starts; cancellation before the existing admission check can finish without a canonical result. The allocation patch does not alter that path. No assertion was weakened or retry added. The full race suite passed separately.task linttwice exceeded the local 600-second command budget during root analysis (second attempt bounded GOMAXPROCS to 4). Scoped changed-package lint passed. Full lint is not claimed green.Review
Reviewed commit
94c56cc19against6473fa341across independent Spec, Standards, Test adequacy, Security, Architecture, Library reuse, and Duplication reviews. No classified findings. Reviewers inspected source; benchmark and executed-gate evidence is recorded separately above.PANEL: ship_blockers=0 important=0 advisory=0 reviewer_failures=0