You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upgrade the LSP-pilot comparison from the standalone probe shipped in #952 to riding the real production pr-review. Make the review path emit one pilot-schema JSONL record per reviewed PR, so every auto-review becomes a free LSP-off ("A") sample, and flipping LSP_PILOT_ENABLED yields the matching LSP-on ("B") sample through the same pipeline — a true apples-to-apples A/B with zero synthetic data.
Why
PR #952 landed the extractor (scripts/lsp_pilot_measure.sh), the harness (scripts/lsp_pilot_compare.sh, #841), and a standalone scripts/lsp_pilot_run.sh that re-runs reviews with a simplified prompt. The standalone driver does not use the production review, so its "A" side isn't what production actually does.
The blocker for using the real review: the headline metrics nav_tokens/tool_calls are only computable from the model's per-tool-call stream-json transcript, but the engine runs claude --output-format json (aggregate usage only — scripts/engine.sh:660) and never captures that transcript. So today a real review cannot produce a pilot record.
What to build
Behind the pilot being active (REVIEW_MCP_CONFIG set / LSP_PILOT_ENABLED=true), capture what's needed and emit a pilot record from the real review.
Acceptance criteria
Gated stream capture. When the pilot is active, the deep/audit/rubber-duck claude tiers additionally capture the --output-format stream-json --verbose transcript to a temp file. When the pilot is OFF, behaviour is byte-for-byte unchanged — no stream capture, no extra flags, no new records. (The five consumer repos that don't set LSP_PILOT_ENABLED must be wholly unaffected.)
Record emission. After a PR review completes under the pilot, invoke scripts/lsp_pilot_measure.sh on the captured transcript + TOKEN_LOG_FILE to append exactly one pilot-schema record to TOKEN_LOG_FILE — the existing Token Cost Observatory channel already uploaded as the token-usage-<run_id> artifact (.github/workflows/pr-review.yml:445). Discriminate it with a kind (e.g. kind:"lsp_pilot_run") so scripts/token_report.sh keeps excluding it from cost aggregation (its filter is (.kind // "token_usage") == "token_usage").
Tests. Unit coverage for: the capture gate (active vs off), record emission/shape, and the off-pilot no-op. shellcheck --severity=warning -x scripts/*.sh clean; existing test_lsp_pilot_measure / test_lsp_coldstart_sla / test_token_metrics suites stay green.
Scope & safety. Additive + opt-in only. Do not modify the thin caller stubs beyond allowed inputs. Preserve all action/SHA pinning. pr-review.yml is consumed by 5 repos — no off-pilot change.
Out of scope
Enabling LSP_PILOT_ENABLED in production — that's the owner-gated A/B run, not this change.
Any change to lsp_pilot_compare.sh or the extractor's record schema.
A real pr-review running under the pilot drops one lsp_pilot_run record into its token-usage-<run_id> artifact, and lsp_pilot_compare.sh renders an off-vs-on table from two such records (flag off vs on) with no synthetic input.
Epic: #839 (LSP pilot) · Story: #844 · Builds on: #952 (standalone runner +
lsp_pilot_measure.sh)Summary
Upgrade the LSP-pilot comparison from the standalone probe shipped in #952 to riding the real production pr-review. Make the review path emit one pilot-schema JSONL record per reviewed PR, so every auto-review becomes a free LSP-off ("A") sample, and flipping
LSP_PILOT_ENABLEDyields the matching LSP-on ("B") sample through the same pipeline — a true apples-to-apples A/B with zero synthetic data.Why
PR #952 landed the extractor (
scripts/lsp_pilot_measure.sh), the harness (scripts/lsp_pilot_compare.sh, #841), and a standalonescripts/lsp_pilot_run.shthat re-runs reviews with a simplified prompt. The standalone driver does not use the production review, so its "A" side isn't what production actually does.The blocker for using the real review: the headline metrics
nav_tokens/tool_callsare only computable from the model's per-tool-call stream-json transcript, but the engine runsclaude --output-format json(aggregate usage only —scripts/engine.sh:660) and never captures that transcript. So today a real review cannot produce a pilot record.What to build
Behind the pilot being active (
REVIEW_MCP_CONFIGset /LSP_PILOT_ENABLED=true), capture what's needed and emit a pilot record from the real review.Acceptance criteria
--output-format stream-json --verbosetranscript to a temp file. When the pilot is OFF, behaviour is byte-for-byte unchanged — no stream capture, no extra flags, no new records. (The five consumer repos that don't setLSP_PILOT_ENABLEDmust be wholly unaffected.)scripts/lsp_pilot_measure.shon the captured transcript +TOKEN_LOG_FILEto append exactly one pilot-schema record toTOKEN_LOG_FILE— the existing Token Cost Observatory channel already uploaded as thetoken-usage-<run_id>artifact (.github/workflows/pr-review.yml:445). Discriminate it with akind(e.g.kind:"lsp_pilot_run") soscripts/token_report.shkeeps excluding it from cost aggregation (its filter is(.kind // "token_usage") == "token_usage").prjoin key (<repo>#<number>@<head_sha>),variant(lsp-offwhen the flag is off /lsp-onwhen on),candidate,nav_tokens,tool_calls,findings/false_positives(from the [Phase 2] Add the LSP finding-verification step to the deep/audit pr-review tiers #843 verification records),cold_start_s(from the [Phase 2] Cache the LSP index and enforce the 30s cold-start SLA with auto-skip #846lsp_cold_startrecord), real reported usage, andwall_time_s.prand render viascripts/lsp_pilot_compare.shunchanged (reuse feat(#844): live LSP off-vs-on comparison runner + measurement extractor #952's schema exactly).shellcheck --severity=warning -x scripts/*.shclean; existingtest_lsp_pilot_measure/test_lsp_coldstart_sla/test_token_metricssuites stay green.pr-review.ymlis consumed by 5 repos — no off-pilot change.Out of scope
LSP_PILOT_ENABLEDin production — that's the owner-gated A/B run, not this change.lsp_pilot_compare.shor the extractor's record schema.Done when
A real pr-review running under the pilot drops one
lsp_pilot_runrecord into itstoken-usage-<run_id>artifact, andlsp_pilot_compare.shrenders an off-vs-on table from two such records (flag off vs on) with no synthetic input.