tasks: extract detached task lifecycle runtime#68886
Conversation
Greptile SummaryThis PR extracts a Confidence Score: 5/5Safe to merge — behavior-preserving refactor with thorough seam-contract coverage and consistent caller rerouting. All findings are P2 or lower. The seam implementation is correct, delegation is faithful to the original calls, reset hygiene in tests is sound, and the gateway seam-dispatch test proves one representative caller path in addition to the unit-level contract test. No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/tasks/detached-task-runtime.ts
Line: 41-43
Comment:
**Test helper exported from production module**
`resetDetachedTaskLifecycleRuntimeForTests` is exported from the main runtime module rather than a test-only entry point, so it will be included in the production bundle. Consider co-locating it in a `detached-task-runtime.test-helpers.ts` file (as done elsewhere in the codebase) to keep the production surface clean. The function name suffix `ForTests` signals the intent, but the export boundary does not enforce it.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "tests: relax gateway seam expectation" | Re-trigger Greptile |
| export function resetDetachedTaskLifecycleRuntimeForTests(): void { | ||
| detachedTaskLifecycleRuntime = DEFAULT_DETACHED_TASK_LIFECYCLE_RUNTIME; | ||
| } |
There was a problem hiding this comment.
Test helper exported from production module
resetDetachedTaskLifecycleRuntimeForTests is exported from the main runtime module rather than a test-only entry point, so it will be included in the production bundle. Consider co-locating it in a detached-task-runtime.test-helpers.ts file (as done elsewhere in the codebase) to keep the production surface clean. The function name suffix ForTests signals the intent, but the export boundary does not enforce it.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/tasks/detached-task-runtime.ts
Line: 41-43
Comment:
**Test helper exported from production module**
`resetDetachedTaskLifecycleRuntimeForTests` is exported from the main runtime module rather than a test-only entry point, so it will be included in the production bundle. Consider co-locating it in a `detached-task-runtime.test-helpers.ts` file (as done elsewhere in the codebase) to keep the production surface clean. The function name suffix `ForTests` signals the intent, but the export boundary does not enforce it.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
* tasks: extract detached task lifecycle runtime * tests: relax gateway seam expectation --------- Co-authored-by: Mariano Belinky <[email protected]>
* tasks: extract detached task lifecycle runtime * tests: relax gateway seam expectation --------- Co-authored-by: Mariano Belinky <[email protected]>
* tasks: extract detached task lifecycle runtime * tests: relax gateway seam expectation --------- Co-authored-by: Mariano Belinky <[email protected]>
* tasks: extract detached task lifecycle runtime * tests: relax gateway seam expectation --------- Co-authored-by: Mariano Belinky <[email protected]>
* tasks: extract detached task lifecycle runtime * tests: relax gateway seam expectation --------- Co-authored-by: Mariano Belinky <[email protected]>
* tasks: extract detached task lifecycle runtime * tests: relax gateway seam expectation --------- Co-authored-by: Mariano Belinky <[email protected]>
* tasks: extract detached task lifecycle runtime * tests: relax gateway seam expectation --------- Co-authored-by: Mariano Belinky <[email protected]>
Summary
src/tasks/task-executor.tsacross ACP, cron, gateway, subagent, and background-task paths, leaving no clean seam for alternate detached-work execution.src/tasks/detached-task-runtime.tsas a behavior-preserving lifecycle seam, rerouted detached-run callers to it, and added seam contract coverage.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
task-executorimports in each caller, so there was no narrow override point for alternate executor/runtime ownership.Regression Test Plan (if applicable)
src/tasks/detached-task-runtime.test.tssrc/gateway/server-methods/agent.test.tsUser-visible / Behavior Changes
None.
Diagram (if applicable)
Security Impact (required)
Repro + Verification
Environment
mb-serverSteps
src/tasks/detached-task-runtime.tsas a delegating lifecycle seam.task-executordirectly.origin/mainand run the targeted touched-surface tests.Expected
Actual
pnpm buildonmb-serverhit an existingruntime-postbuildbundled-plugin dependency staging issue in the installed workspace graph, not an error in the seam diff itself.Evidence
Human Verification (required)
origin/mainmb-serverdue unrelatedruntime-postbuilddependency staging issue in the installed workspace graphReview Conversations
Compatibility / Migration
Risks and Mitigations
task-executordirectly again.