Skip to content

refactor: break SessionPrompt/TaskTool cycle via ctx injection#21948

Merged
kitlangton merged 3 commits intodevfrom
kit/task-prompt-ops
Apr 10, 2026
Merged

refactor: break SessionPrompt/TaskTool cycle via ctx injection#21948
kitlangton merged 3 commits intodevfrom
kit/task-prompt-ops

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • TaskTool no longer runtime-imports SessionPrompt — uses import type only
  • Prompt operations (cancel, resolvePromptParts, prompt) are injected via ctx.extra.promptOps by the caller (SessionPrompt)
  • Breaks the SessionPrompt → ToolRegistry → TaskTool → SessionPrompt cycle
  • Task stays a real tool in the registry, no dynamic registration or mutable state

Test plan

  • All 6 task tool tests pass (updated to provide promptOps via ctx instead of monkey-patching facade)
  • Full test suite: 1885 pass, 0 fail
  • Typecheck clean
  • CI green
  • E2E — watch Windows specifically (long-polling may hang)

TaskTool no longer imports SessionPrompt at runtime. Instead, prompt
operations (cancel, resolvePromptParts, prompt) are injected via
ctx.extra.promptOps by the caller. This inverts the dependency so the
service graph is acyclic, unblocking future single-runtime composition.
@kitlangton kitlangton marked this pull request as ready for review April 10, 2026 23:17
@kitlangton kitlangton merged commit d9d5a06 into dev Apr 10, 2026
9 of 10 checks passed
@kitlangton kitlangton deleted the kit/task-prompt-ops branch April 10, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant