Skip to content

Bound low-risk performance hotspots#218

Merged
ictechgy merged 4 commits into
mainfrom
ultragoal/g004-low-risk-performance-hotspots
Jun 21, 2026
Merged

Bound low-risk performance hotspots#218
ictechgy merged 4 commits into
mainfrom
ultragoal/g004-low-risk-performance-hotspots

Conversation

@ictechgy

Copy link
Copy Markdown
Owner

Summary

  • cache benchmark resume keys during G004 resume writes to avoid per-row CSV scans
  • skip transcript prompt extraction after the prompt sample cap
  • cache pruned tool schema byte counts/parameter terms, skip large JSON canonicalization, and omit oversized context-pack bodies before receipt sizing
  • sync plugin copies and add targeted regression tests

Verification

  • python3 -m py_compile changed kit/plugin scripts and tests/test_context_guard_kit.py
  • python3 -m unittest tests.test_context_guard_kit.BenchmarkRunnerTests.test_benchmark_runner_bounds_fixture_prompt_and_resume_csv_reads tests.test_context_guard_kit.BenchmarkRunnerTests.test_append_csv_skip_existing_suppresses_duplicate_rows tests.test_context_guard_kit.BenchmarkRunnerTests.test_append_csv_resume_key_cache_avoids_per_append_reread tests.test_context_guard_kit.ClaudeTokenKitTests.test_cache_score_json_walk_caps_nodes_depth_and_warnings tests.test_context_guard_kit.ClaudeTokenKitTests.test_cache_score_large_json_skips_canonical_compare tests.test_context_guard_kit.ClaudeTokenKitTests.test_cache_score_json_order_provider_thresholds_and_help tests.test_context_guard_kit.ClaudeTokenKitTests.test_tool_prune_caches_schema_bytes_and_parameter_terms tests.test_context_guard_kit.ClaudeTokenKitTests.test_tool_prune_select_ranks_relevant_tools_and_writes_receipts tests.test_context_guard_kit.ClaudeTokenKitTests.test_transcript_audit_prompt_cap_skips_extraction_after_sample_limit tests.test_context_guard_kit.ClaudeTokenKitTests.test_transcript_audit_cache_friendliness_bounds_broad_prompt_content tests.test_context_guard_kit.ClaudeTokenKitTests.test_context_pack_receipt_cap_does_not_write_oversized_metadata tests.test_context_guard_kit.ClaudeTokenKitTests.test_context_pack_omits_oversized_pack_before_receipt_size_probe -q
  • python3 scripts/prepublish_check.py --skip-tests
  • python3 scripts/sync_plugin_copies.py --check
  • git diff --check

ictechgy added 4 commits June 22, 2026 01:19
Constraint: G004 targets benchmark resume writes, transcript prompt sampling, schema pruning, cache-score JSON linting, and context-pack receipts without new dependencies
Rejected: Broad rewrites or concurrency behavior changes beyond the resume key cache | too risky for a low-risk performance story
Confidence: high
Scope-risk: moderate
Directive: Keep future optimization passes tied to measured hot paths and preserve plugin copy sync
Tested: python3 -m py_compile changed kit/plugin scripts and tests/test_context_guard_kit.py; 12 targeted unittest cases; python3 scripts/prepublish_check.py --skip-tests; python3 scripts/sync_plugin_copies.py --check; git diff --check
Not-tested: Full test suite and real provider benchmark runs
Round 1 review fixes: refresh resume key caches only when the CSV stamp changes, bound canonical JSON comparison by encoded output size, and lock the oversized pack receipt omission contract with end-to-end coverage.

Constraint: ultra-review-loop requires verified fixes before re-reviewing PR #218
Rejected: Restoring per-append CSV scans unconditionally | would undo the G004 resume performance objective
Confidence: high
Scope-risk: narrow
Directive: Keep resume dedupe concurrency-safe and keep canonical JSON comparisons bounded by output bytes
Tested: python3 -m py_compile changed kit/plugin scripts and tests/test_context_guard_kit.py; 15 targeted unittest cases; python3 scripts/prepublish_check.py --skip-tests; python3 scripts/sync_plugin_copies.py --check; git diff --check
Not-tested: Full test suite and real concurrent benchmark processes
Round 2 review fixes: rebuild resume key caches on CSV stamp changes and let the bounded canonical encoder, not input byte size, decide whether JSON byte-stability comparison can run.

Constraint: ultra-review-loop found remaining stale-cache and over-conservative canonical-skip edge cases
Rejected: Input-size based canonical skip | misses whitespace-heavy JSON whose canonical output is small enough to compare safely
Confidence: high
Scope-risk: narrow
Directive: Refresh cached CSV keys by replacement, not merge, whenever the backing file stamp changes
Tested: python3 -m py_compile changed kit/plugin scripts and tests/test_context_guard_kit.py; 17 targeted unittest cases; python3 scripts/prepublish_check.py --skip-tests; python3 scripts/sync_plugin_copies.py --check; git diff --check
Not-tested: Full test suite and real concurrent benchmark truncation during provider runs
Round 3 review fix: derive runnable benchmark targets through the same stamp-aware resume cache used by execution so evidence coverage and preflight cannot fail on stale CSV snapshots.

Constraint: ultra-review-loop found stale runnable target selection after CSV refreshes
Rejected: Keeping one-time runnable_targets from startup | diverges from execution-time resume skip semantics
Confidence: high
Scope-risk: narrow
Directive: Use resume_runnable_targets for future resume-sensitive preflight or evidence gates
Tested: python3 -m py_compile changed kit/plugin scripts and tests/test_context_guard_kit.py; 18 targeted unittest cases; python3 scripts/prepublish_check.py --skip-tests; python3 scripts/sync_plugin_copies.py --check; git diff --check
Not-tested: Full test suite and live provider benchmark replay
@ictechgy ictechgy merged commit 3c9697c into main Jun 21, 2026
3 checks passed
@ictechgy ictechgy deleted the ultragoal/g004-low-risk-performance-hotspots branch June 21, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant