Repository navigation
Tighten runtime pack confidence gating - #393
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR enhances the evidence model to account for scope quality, workflow locality, answer-containedness, and phase completeness. It introduces ChangesGraph-Path-Aware Confidence Assessment and Evidence Threading
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/runtime/stdio/tools.ts (1)
1314-1318:⚠️ Potential issue | 🟠 Major | ⚡ Quick winPass
graphPathinto the remaining directbuildMadarResponseEvidencecalls.These two
context_packevidence paths still omitgraphPath, so scope-aware confidence can diverge from the updated retrieve/path flows.💡 Suggested fix
evidence: buildMadarResponseEvidence({ coverage: deltaResult.delta_pack.coverage, + graphPath, missingPhases: missingPhasesFromPayload(deltaResult.delta_pack), coveredWorkflowOwners: collectWorkflowOwners(resolvedDeltaNodes.nodes.map((node) => node.source_file)), }), @@ evidence: buildMadarResponseEvidence({ coverage: fullPack.coverage, + graphPath, missingPhases: missingPhasesFromPayload(fullPack), coveredWorkflowOwners: collectWorkflowOwners(resolvedNodes.nodes.map((node) => node.source_file)), }),Also applies to: 1338-1342
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/runtime/stdio/tools.ts` around lines 1314 - 1318, The two direct calls to buildMadarResponseEvidence (the one using deltaResult.delta_pack.coverage / missingPhasesFromPayload(deltaResult.delta_pack) / collectWorkflowOwners(...resolvedDeltaNodes...) and the other occurrence later) must include the graphPath argument so scope-aware confidence matches the updated retrieve/path flows; update both call sites to pass the relevant graphPath value (the same variable used elsewhere in this module) as an additional parameter to buildMadarResponseEvidence so the evidence objects include graphPath.
🧹 Nitpick comments (1)
src/runtime/stdio/tools.ts (1)
333-334: ⚡ Quick winMake
graphPathrequired in helper signatures.Keeping it optional weakens the new confidence contract and allows silent regressions.
♻️ Suggested refactor
function evidenceForRetrievePayload( payload: Partial<Pick<RetrieveResult, 'coverage' | 'answer_contract' | 'execution_slice'>> & { matched_nodes?: Array<{ source_file: string }> }, - graphPath?: string, + graphPath: string, ) { @@ function evidenceForPathPayload( payload: Partial<Pick<RetrieveResult, 'coverage' | 'answer_contract' | 'execution_slice'>> & { relevant_files?: Array<{ path: string }> starter_files?: Array<{ path: string }> edit_steps?: Array<{ path: string }> }, - graphPath?: string, + graphPath: string, ) {Also applies to: 351-352
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/runtime/stdio/tools.ts` around lines 333 - 334, Make the graphPath parameter required wherever it's currently declared optional (graphPath?: string) in the helper signatures in this module: change to graphPath: string, update any related parameter destructuring or defaulting, and adjust all call sites (including the two other occurrences referenced around lines 351–352) to always pass a non-null string; ensure any type annotations, overloads, and tests reflect the new required string type so the confidence contract is enforced.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/runtime/mcp-response-evidence.ts`:
- Around line 290-293: The code currently applies runtimeConfidence to update
confidenceCap (runtimeConfidence, moreRestrictiveConfidence, confidenceCap) but
does not record a matching entry in the confidence reasons; change the block so
that after computing the new cap you also append a reason object/string to the
existing confidence_reasons (or confidenceReasons) collection describing the
downgrade (include source "runtime", the runtimeConfidence value, and previous
vs new cap), and only append when the cap actually becomes more restrictive so
the reasons explain the change.
- Around line 128-133: candidateScopes generation is dropping real scopes when
paths start with generic prefixes (e.g. "packages/spi/...") because the code
only takes the first segment; update the mapping over
coveredWorkflowOwners/normalizeSourcePath so that when the first segment is in
GENERIC_SCOPE_SEGMENTS it uses the second segment as the candidate scope (fall
back to the first if no second), otherwise use the first; keep the existing
filters (non-empty and not in GENERIC_SCOPE_SEGMENTS) and the Set dedupe logic
so candidateScopes includes subproject scopes like "spi".
In `@tests/unit/context-pack-command.test.ts`:
- Around line 764-767: The negated regex assertions on
payload.evidence.pack_confidence and payload.evidence.agent_directive can pass
when those fields are missing; update the tests to first assert the fields exist
and are of expected type/value before applying the "not" regex checks: add
explicit presence checks (e.g.
expect(payload.evidence).toHaveProperty('pack_confidence') and expect(typeof
payload.evidence.pack_confidence).toBe('string')) or assert allowed enum values,
then keep the expect.not.stringMatching checks on pack_confidence and
agent_directive; apply the same strengthening to the duplicate assertions around
the block that mentions lines 890-893 (the other payload.evidence assertions for
confidence_reasons).
---
Outside diff comments:
In `@src/runtime/stdio/tools.ts`:
- Around line 1314-1318: The two direct calls to buildMadarResponseEvidence (the
one using deltaResult.delta_pack.coverage /
missingPhasesFromPayload(deltaResult.delta_pack) /
collectWorkflowOwners(...resolvedDeltaNodes...) and the other occurrence later)
must include the graphPath argument so scope-aware confidence matches the
updated retrieve/path flows; update both call sites to pass the relevant
graphPath value (the same variable used elsewhere in this module) as an
additional parameter to buildMadarResponseEvidence so the evidence objects
include graphPath.
---
Nitpick comments:
In `@src/runtime/stdio/tools.ts`:
- Around line 333-334: Make the graphPath parameter required wherever it's
currently declared optional (graphPath?: string) in the helper signatures in
this module: change to graphPath: string, update any related parameter
destructuring or defaulting, and adjust all call sites (including the two other
occurrences referenced around lines 351–352) to always pass a non-null string;
ensure any type annotations, overloads, and tests reflect the new required
string type so the confidence contract is enforced.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b617dc81-6693-4542-9f0e-4ad2f34325f7
📒 Files selected for processing (8)
src/infrastructure/benchmark/runner.tssrc/infrastructure/compare.tssrc/infrastructure/context-pack-command.tssrc/infrastructure/context-prompt-command.tssrc/runtime/mcp-response-evidence.tssrc/runtime/stdio/tools.tstests/unit/context-pack-command.test.tstests/unit/mcp-response-evidence.test.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Actionable comments posted: 0 |
Summary
Closes #388
Summary by CodeRabbit
New Features
Tests