Repository navigation
Add execution_slice phase and branch modeling - #252
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds phase-aware execution-slice contracts and runtime logic: classifies steps into phases, enumerates and scores candidate paths, selects a primary path, computes phase coverage with missing-phase reasons, classifies non-primary branches (side effects, terminal, omitted), and updates tests and compacting for new slice shape. ChangesExecution Slicing with Phase Coverage
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
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
🤖 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/retrieve.ts`:
- Around line 1666-1671: The current workerLikeExecutionStep too-broadly matches
"orchestrator" and bare "process"; update it to exclude "orchestrator" and only
treat "process" as worker-evidence when it has an attached qualifier (e.g.
process-*, process_*, process/*, etc.). Locate the workerLikeExecutionStep
function and replace the regex so it no longer includes "orchestrator" and
requires a suffix for "process" (for example:
/\b(?:worker|processor|process(?:[-_/]\w+))\b/), keeping the same lowercasing
behavior and return value.
- Around line 1701-1709: The function expectedExecutionPhases currently seeds
phases with ['controller','service'] which forces those phases to be required
for every question; change it to start with an empty phases array and only push
'controller' and/or 'service' when the question explicitly targets them (do this
by calling or adding small predicate helpers such as
promptWantsControllerStep(question) and promptWantsServiceStep(question) or
reusing existing heuristics), keep the existing checks that push
'queue'/'worker' via promptWantsRuntimePipeline(question) and 'persistence' via
promptExpectsPersistenceStep(question), and finally return the unique phases as
before.
- Around line 1878-1898: phaseCoverageForPath currently builds orderedObserved
by filtering only expected phases, dropping any extra observed phases; change
orderedObserved so it includes all observed phases (e.g., first keep expected
phases in order: expected.filter(p => observed.has(p)) then append any remaining
observed phases not in expected: Array.from(observed).filter(p =>
!expected.includes(p))), leaving the rest of the logic (expected, observed Set
construction, missing) intact; reference symbols: phaseCoverageForPath,
expected, observed (Set), orderedObserved, missing.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 831b59ca-4abe-42e3-8434-8cbcbc134d37
📒 Files selected for processing (6)
src/contracts/context-pack.tssrc/runtime/retrieve.tssrc/runtime/retrieve/slicing.tstests/unit/context-pack-command.test.tstests/unit/retrieve-slice-v1.test.tstests/unit/spi-nest-di-runtime-calls-realistic.test.ts
Tighten worker detection, scope expected phases to the prompt, and report extra observed phases truthfully. Add focused regression tests and update the realistic runtime slice expectation to match the new truthful phase coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/unit/retrieve-slice-v1.test.ts (1)
109-114:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winKeep worker edge
source_fileconsistent with theworkerSourceFileoverride.Line 110 and Line 113 still hardcode
'/src/auth/worker.ts', so overridingworkerSourceFileonly changes the node, not its outgoing edges. That can hide path-based classification regressions in this fixture.Suggested fix
...(includePersistenceStep && includeWorkerStep - ? [{ source: 'auth_worker', target: 'session_store', relation: 'calls', confidence: 'EXTRACTED', source_file: '/src/auth/worker.ts' } as const] + ? [{ source: 'auth_worker', target: 'session_store', relation: 'calls', confidence: 'EXTRACTED', source_file: workerSourceFile } as const] : []), ...(includeWorkerStep - ? [{ source: 'auth_worker', target: 'session_notifier', relation: 'calls', confidence: 'EXTRACTED', source_file: '/src/auth/worker.ts' } as const] + ? [{ source: 'auth_worker', target: 'session_notifier', relation: 'calls', confidence: 'EXTRACTED', source_file: workerSourceFile } as const] : []),🤖 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-slice-v1.test.ts` around lines 109 - 114, The test hardcodes the worker edge source_file string in the arrays created when includePersistenceStep/includeWorkerStep are true, so the override variable workerSourceFile isn't applied to outgoing edges; update the two edge objects (the one targeting 'session_store' and the one targeting 'session_notifier' created in the includePersistenceStep/includeWorkerStep spreads) to use the workerSourceFile variable instead of the literal '/src/auth/worker.ts' so node and edge source_file values stay consistent with the workerSourceFile override.
🤖 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/retrieve.ts`:
- Around line 1253-1271: promptWantsControllerStep currently treats the token
"request(s)" as controller evidence unconditionally and promptWantsServiceStep
implicitly promotes any controller-detected prompt to a service, causing false
positives; change promptWantsControllerStep so "request" / "requests" are only
considered controller evidence when there is route/HTTP context (e.g.,
hasRoutePath, hasRouteKeyword or hasHttpVerbIntent) and remove the unconditional
early-return in promptWantsServiceStep (do not return true simply because
promptWantsControllerStep(question) is true); instead let promptWantsServiceStep
independently tokenize the question and check service-related tokens and the
regex for use-case/orchestrator so service detection stays independent of
controller hints.
- Around line 1922-1925: The observed phases list must be emitted in the
canonical runtime order: construct orderedObserved by iterating the canonical
order array (expected) and including any phase present in the observed Set
first, then append any remaining phases from the observed Set that are not in
expected while preserving their Set insertion order; update the logic around
orderedObserved (the variables expected and observed and where
phase_coverage.observed is produced) to use expected.filter(phase =>
observed.has(phase)) followed by [...observed].filter(phase =>
!expected.includes(phase)) so `queue` (and other expected phases) appear in
canonical runtime order.
---
Outside diff comments:
In `@tests/unit/retrieve-slice-v1.test.ts`:
- Around line 109-114: The test hardcodes the worker edge source_file string in
the arrays created when includePersistenceStep/includeWorkerStep are true, so
the override variable workerSourceFile isn't applied to outgoing edges; update
the two edge objects (the one targeting 'session_store' and the one targeting
'session_notifier' created in the includePersistenceStep/includeWorkerStep
spreads) to use the workerSourceFile variable instead of the literal
'/src/auth/worker.ts' so node and edge source_file values stay consistent with
the workerSourceFile override.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: cf1f7adb-10e1-4b60-8e92-1ee0906fec8f
📒 Files selected for processing (3)
src/runtime/retrieve.tstests/unit/retrieve-slice-v1.test.tstests/unit/spi-nest-di-runtime-calls-realistic.test.ts
Stop treating generic request wording as controller evidence, keep service detection independent of controller hints, and emit observed execution phases in canonical order. Update slice and command regressions to match the prompt-scoped phase coverage contract. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closes #231
Summary
execution_sliceTesting