feat(core): run session start hooks - #1156
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Stack
This is 3 of 4 in the Zoo Code hooks MVP stack. Review and merge from the bottom upward. Do not merge this PR until #1154 is merged.
mainfm/zoo-hooks-contractsfm/zoo-hooks-settingssessionStartintegrationfm/zoo-hooks-session-startpreToolUse, E2E, and documentationSummary
Implement the bounded extension-host hook runner and integrate
sessionStarthooks into new and resumed tasks with durable, localized chat lifecycle rows.Scope
sessionStarthooks for new tasks and resumed task history, then add successful output to model context.Runtime Flow
sequenceDiagram participant T as Task participant R as HookRunner participant P as Child process tree participant H as Task history participant M as Model context T->>H: Persist running hook row T->>R: Run sessionStart invocation R->>P: Spawn executable plus argv alt Success within limits P-->>R: Exit 0 plus bounded output R-->>T: Succeeded result T->>H: Finalize row T->>M: Add stdout context else Timeout or cancellation R->>P: Terminate process tree R-->>T: Terminal failure result T->>H: Finalize row endTests
src/core/hooks/__tests__/HookRunner.spec.tssrc/core/task/__tests__/Task.persistence.spec.tswebview-ui/src/components/chat/__tests__/HookRow.spec.tsxapps/cli/src/agent/__tests__/output-manager.hooks.test.tsapps/cli/src/ui/hooks/__tests__/useMessageHandlers.hooks.test.tspnpm test(437 files passed, 7,356 tests passed, 39 skipped).pnpm check-types,pnpm lint, andpnpm buildpassed.USE_MOCK=true TEST_FILE=hooks.test pnpm --filter @roo-code/vscode-e2e test:runpassed, including session-start model visibility/history reopen and root/child process cancellation.Risks
Review Notes
fm/zoo-hooks-settings, notmain.5ffe21f76and762a3fc08propagate the settings CI fixes and type session-hook test doubles; all original published commits remain reachable.ca4fae6b1uses nativetaskkill.exetree termination on Windows, normalizes missing absolute executables, and keeps POSIX mode assertions platform-specific.9c2adfb4cresolvestaskkill.exethrough%SystemRoot%\\System32, avoiding PATH ambiguity and Knip's unlisted-binary finding.784938134injects the platform for deterministic Linux coverage of Windows termination; focusedHookRunner.tsline coverage is 90.74%.75322a7d2removes a redundant rejected-promise fallback becauseexecaalready usesreject: false.preToolUsegating is intentionally deferred to the top PR.#1153->#1154->#1156->#1155.