Repository navigation
fix(retrieval): stabilize async report flows - #623
Conversation
📝 WalkthroughWalkthroughThe change stabilizes full-flow retrieval by carrying flow metadata through ranking and traversal, expanding an asynchronous report-generation fixture, and adding packed parity, artifact-integrity, build-configuration, and governance validation for regression ChangesRetrieval regression
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant OrchestratorWorker
participant PlannerService
participant SectionResearchWorker
participant ResearchAgentService
participant AssemblyWorker
participant AssemblyService
participant DbSyncWorker
OrchestratorWorker->>PlannerService: plan pipeline job
PlannerService->>SectionResearchWorker: enqueue section research
SectionResearchWorker->>ResearchAgentService: research section
ResearchAgentService->>AssemblyWorker: enqueue assembly
AssemblyWorker->>AssemblyService: assemble report
AssemblyService->>DbSyncWorker: enqueue persistence
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
mohanagy
left a comment
There was a problem hiding this comment.
Independent exact-head semantic review — NO BLOCKER
Reviewed commit 9b17c6ce04c8f8bb03fcfb4b5b6b56e3b85e8921, tree 23c8a4e9c0fe9e0fad91693c122f8acbacd65f30, against #622 and protected base 5df59886190a65ba80e07339203aeba013c94ef2.
Evidence:
- real GoValidate full flow: exact 10-stage skeleton, 5 authenticated relationships, 4 honest disconnected handoffs, 3,669 tokens, untruncated;
- MasterAgent follow-up: 10 relevant nodes including
MasterAgentService.call, 6 relationships, 3 honest handoffs, 3,849 tokens, untruncated; - focused locators: 2 files/2 snippets and 1 file/1 snippet, both untruncated;
- no repository/path literals or hard-coded phase names remain in production changes; recovery is graph-structural;
- traversal returns authenticated edges only and exact disconnected verification targets for asynchronous gaps;
- production delta is confined to
rank.ts,traverse.ts, andtypes.ts; no graph/index, dependency, package-script, CLI, or MCP semantic change; - 52 focused tests, 23 governance/baseline tests, typecheck, and diff cleanliness passed;
- packed parity passed at 102 files / 158,284 packed bytes / 639,839 unpacked bytes.
This review is independent from CodeRabbit and does not represent CodeRabbit's disposition.
mohanagy
left a comment
There was a problem hiding this comment.
Independent exact-head governance/package review — NO BLOCKER
Reviewed commit 9b17c6ce04c8f8bb03fcfb4b5b6b56e3b85e8921, tree 23c8a4e9c0fe9e0fad91693c122f8acbacd65f30, sole parent/base 5df59886190a65ba80e07339203aeba013c94ef2.
Evidence:
- fresh package matches the manifest and PR receipts byte-for-byte: 102 files, 158,284 packed bytes, 639,839 unpacked bytes, SHA-1
d9be5a2b86de370c74938e58343b862334c8d9e6, integritysha512-kHuWp72gv/g0r2dROXvM9nTvHeOAHmIRdzPZpJo7GVCdWHIoRMZWaoDQarZ5z6wecHuXBuOMkYGhY22tuQsLFg==, SHA-2567b5ecf689c2a4a79a8101aad296b8872d478e875107a10a0d24eb75da1763494; - fixed ceilings remain 102 / 165,000 / 640,000, leaving 161 unpacked bytes of headroom;
- the sole build-config delta is
/compilerOptions/removeComments=true;tsconfig.jsonandtsconfig.eval.jsonare blob-identical to base; - source comment sentinel remains, emitted JS/declaration sentinel is absent, and the CLI shebang remains;
package.json, lockfile, CI/release workflows, dependencies, scripts, and version are unchanged;- exact production receipt is 43 TypeScript files / 12,147 LOC, +163/-24/net +139, only
rank.ts,traverse.ts, andtypes.ts, inside the unchanged +164/-21/net +143 allowance; - published beta.2
manifest.currentis preserved; the fresh artifact is recorded separately as an unpublished #622 candidate; - typecheck, 23 governance/baseline tests, both builds, isolation, and pack parity passed;
- PR #623 targets
next; publication, tags, Registry publication, releases, andmainremain forbidden.
Non-blocking caution: the unpacked ceiling has only 161 bytes of remaining headroom. This review is independent from CodeRabbit.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (4)
src/domain/query/rank.ts (1)
745-748: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMagic anchor limit.
anchorLimit = 4when a bridge exists is an unexplained constant next toMAX_RANKED_ANCHORS. Name it (e.g.BRIDGE_ANCHOR_LIMIT) so the bounded-selection contract stays auditable.🤖 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/domain/query/rank.ts` around lines 745 - 748, Replace the unexplained literal in the bridge-handling branch near `bridgePair` and `anchorLimit` with a clearly named constant such as `BRIDGE_ANCHOR_LIMIT`, defined alongside `MAX_RANKED_ANCHORS`, and use that constant when a bridge exists.tests/unit/core-reset-governance.test.ts (1)
1414-1418: 📐 Maintainability & Code Quality | 🔵 TrivialTight npm package budget margin.
npm_package_budget.unpacked_bytes_maxis 640,000 while the candidate receipt'snpm_unpacked_bytesis 639,839 — only 161 bytes of headroom (~0.03%). Any small unrelated addition to production source elsewhere in the "evaluation-tooling" surface will likely trip this budget check even without touching#622's scope.Also applies to: 2743-2752
🤖 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 `@tests/unit/core-reset-governance.test.ts` around lines 1414 - 1418, Increase npm_package_budget.unpacked_bytes_max in the relevant budget configuration to provide meaningful headroom above the candidate receipt's npm_unpacked_bytes, while preserving the existing files_max and packed_bytes_max limits.tests/unit/retrieve-context.test.ts (1)
466-599: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider splitting this into focused
itblocks.This single test asserts six distinct scenarios (short control, full flow, paraphrases, MasterAgent follow-up + its paraphrases, focused-queue prompts) inside one
it. A failure in any sub-scenario reports under the same test name, making CI failures harder to triage. Sharing thereportGenerationFixture()setup viabeforeAll/beforeEachand splitting into separateits per scenario would preserve coverage while improving isolation and readability.🤖 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 `@tests/unit/retrieve-context.test.ts` around lines 466 - 599, Split the single report-pipeline test into focused it blocks for short control, full flow, full-flow paraphrases, MasterAgent follow-up prompts, and focused-queue prompts. Share reportGenerationFixture setup through beforeAll or beforeEach, while preserving each scenario’s existing assertions and coverage so failures identify the specific scenario.docs/core-reset/removal-manifest.yml (1)
1373-1398: 🚀 Performance & Scalability | 🔵 TrivialVery tight package-size margin on the
#622candidate.
candidate_package.npm_unpacked_bytes(639,839) leaves only 161 bytes of headroom under the item'snpm_package_budget.unpacked_bytes_max(640,000). Any trivial future change to the moved evaluation tooling output risks tripping this ceiling.🤖 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 `@docs/core-reset/removal-manifest.yml` around lines 1373 - 1398, Reduce the `#622` candidate package footprint so candidate_package.npm_unpacked_bytes has meaningful headroom below the 640,000-byte npm_package_budget.unpacked_bytes_max limit. Remove or exclude unnecessary moved evaluation-tooling output, then regenerate the candidate package size and artifact metadata consistently without changing the protected budget or forbidden configuration fields in post_completion_build_output_amendment.
🤖 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 `@docs/core-reset/removal-manifest.yml`:
- Around line 1865-1920: Update the retrieval-regression-622 verification list
to include tools/eval/core-reset/verify-isolation.mjs and
tests/unit/core-reset-baseline.test.ts, which directly validate the
build_output_exception compilerOptions.removeComments behavior. Keep all
existing verification entries and scope constraints unchanged.
In `@src/domain/query/rank.ts`:
- Around line 700-704: Remove the non-null assertion in the stageEntry
outgoing-id lookup and guard unresolved nodes before calling flowCoverage.
Update the filter around stageEntry so missing corpus.nodeById entries are
skipped while preserving the existing coverage and ranking behavior for resolved
nodes.
In `@src/domain/query/traverse.ts`:
- Around line 127-140: Align the coverage checks with the `sources`/`chain`
index space in the traversal logic: update the loop that accesses
`paths[sourceIndex + offset]` so it cannot treat `sourceIndex` as an `anchors`
index when side branches are present. Prefer carrying each source’s
corresponding anchor position or otherwise deriving consistent positions, while
preserving the existing flow and coverage behavior.
---
Nitpick comments:
In `@docs/core-reset/removal-manifest.yml`:
- Around line 1373-1398: Reduce the `#622` candidate package footprint so
candidate_package.npm_unpacked_bytes has meaningful headroom below the
640,000-byte npm_package_budget.unpacked_bytes_max limit. Remove or exclude
unnecessary moved evaluation-tooling output, then regenerate the candidate
package size and artifact metadata consistently without changing the protected
budget or forbidden configuration fields in
post_completion_build_output_amendment.
In `@src/domain/query/rank.ts`:
- Around line 745-748: Replace the unexplained literal in the bridge-handling
branch near `bridgePair` and `anchorLimit` with a clearly named constant such as
`BRIDGE_ANCHOR_LIMIT`, defined alongside `MAX_RANKED_ANCHORS`, and use that
constant when a bridge exists.
In `@tests/unit/core-reset-governance.test.ts`:
- Around line 1414-1418: Increase npm_package_budget.unpacked_bytes_max in the
relevant budget configuration to provide meaningful headroom above the candidate
receipt's npm_unpacked_bytes, while preserving the existing files_max and
packed_bytes_max limits.
In `@tests/unit/retrieve-context.test.ts`:
- Around line 466-599: Split the single report-pipeline test into focused it
blocks for short control, full flow, full-flow paraphrases, MasterAgent
follow-up prompts, and focused-queue prompts. Share reportGenerationFixture
setup through beforeAll or beforeEach, while preserving each scenario’s existing
assertions and coverage so failures identify the specific scenario.
🪄 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: 28156029-d622-4e6a-b3bc-109d9830100e
📒 Files selected for processing (24)
.github/scripts/verify-packed-retrieval-parity.mjsdocs/core-reset/removal-manifest.ymldocs/core-reset/scorecard.mddocs/designs/2026-07-19-core-reset.mddocs/roadmap.mdsrc/domain/query/rank.tssrc/domain/query/traverse.tssrc/domain/query/types.tstests/fixtures/pack-quality/runtime-generation-explain-report-flow/fixture.jsontests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/platform/src/components/InProgressIdeasDropdown.tsxtests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/src/modules/pipeline/agent/master-agent.service.tstests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/src/modules/pipeline/api/queue-registry.service.tstests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/src/modules/pipeline/assembly/assembly.worker.tstests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/src/modules/pipeline/workers/db-sync.worker.tstests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/src/modules/pipeline/workers/orchestrator.worker.tstests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/src/modules/planning/planner.service.tstests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/src/modules/reports/assembly.service.tstests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/src/modules/research/research-agent.service.tstests/fixtures/pack-quality/runtime-generation-explain-report-flow/workspace/src/modules/research/workers/section-research.worker.tstests/unit/core-reset-baseline.test.tstests/unit/core-reset-governance.test.tstests/unit/retrieve-context.test.tstools/eval/core-reset/verify-isolation.mjstsconfig.build.json
mohanagy
left a comment
There was a problem hiding this comment.
Independent exact-head semantic review — NO BLOCKER. Reviewed head 3b3fb9d, tree d43d9d3cb7cf7d566bcb35eca7df2564f0d9ff8c, against next base 5df5988. Missing corpus nodes now score zero without throwing; flow side branches no longer mix index spaces; the focused regression returns all four authenticated edges with zero boundaries. Real GoValidate probes remain exact: full flow 10 nodes/5 edges/4 honest handoffs/3669 tokens, MasterAgent 10/6/3/3849, focused locators 2 nodes and 1 node, all untruncated. Production remains limited to rank/traverse/types with frozen retrieval, graph/index, dependency, CLI, MCP, and semantic constraints. CodeRabbit is not counted as this independent review.
mohanagy
left a comment
There was a problem hiding this comment.
Independent exact-head governance/package review — NO BLOCKER. Reviewed head 3b3fb9d, tree d43d9d3cb7cf7d566bcb35eca7df2564f0d9ff8c, against next base 5df5988. Live PR body, manifest, and tests agree on 43 source files/12147 LOC/+164/-25/net+139 and an unpublished package of 102 files/158295 packed/639867 unpacked/SHA-256 89971e2c2df3f698f48ee066b08923c0ca28853a547d1aaab2d0bd64fdacf005. Only compilerOptions.removeComments=true changed in build config; package, lockfile, dependencies, other tsconfigs, workflows, ceilings, publication, tags, release, Registry, and main remain frozen. Caution is non-blocking: 133 unpacked bytes remain. CodeRabbit is not counted as this independent review.
Final exact-head merge gate receipt
CodeRabbit did not skip this non-default-base PR. It completed an initial review with three actionable threads; after the exact-head fixes, its rerun reached PASS with no new actionable comments while reusing prior analysis for four unchanged/similar files. CodeRabbit is not counted as either independent review. No npm publication, GitHub Release, Registry publication, tag, or |
Closes #622.
What changed
compilerOptions.removeComments: truetotsconfig.build.json, exactly as owner-authorized on [Bug]: beta.2 full-flow retrieval remains prompt-sensitive and misses async pipeline handoffs #622, so the unchanged package ceiling remains satisfiedFrozen constraints
next, nevermainExact candidate
3b3fb9d404864e725305dc491b75e82006c2371fd43d9d3cb7cf7d566bcb35eca7df2564f0d9ff8c89971e2c2df3f698f48ee066b08923c0ca28853a547d1aaab2d0bd64fdacf005Local gates
Two independent exact-head reviews found no blocker and are recorded on this exact head before merge. CodeRabbit is not counted as an independent review; it reviewed this non-default-base PR and its rerun passed with no new actionable comments, while reusing prior analysis for four unchanged/similar files.
Summary by CodeRabbit