Skip to content

feat(core): Add PromptSuspend for prompt pause/resume at tool call boundaries#174

Merged
ClickerMonkey merged 5 commits intomainfrom
copilot/prompt-refactor-pause-resume
Apr 3, 2026
Merged

feat(core): Add PromptSuspend for prompt pause/resume at tool call boundaries#174
ClickerMonkey merged 5 commits intomainfrom
copilot/prompt-refactor-pause-resume

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

  • Add toolCallId?: string to Context type in packages/core/src/types.ts
  • Inject toolCallId from toolCall.id into context before tool.run() in packages/core/src/prompt.ts
  • Merge the duplicated anySuspended loop into the single tool-result loop below it
  • Run tests — only 3 pre-existing failures, none introduced

…ptions

Agent-Logs-Url: https://github.com/ClickerMonkey/aeye/sessions/572e69b6-be85-4ee7-a3e5-9c179468a7f4

Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor prompt handling for pause and resume on tool interruptions feat(core): Add PromptSuspend for prompt pause/resume at tool call boundaries Apr 2, 2026
Copilot AI requested a review from ClickerMonkey April 2, 2026 22:54
Copy link
Copy Markdown
Owner

@ClickerMonkey ClickerMonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets make sure the non suspended tool calls that came back with valid responses still get their tool call results added to the request messages. Anything that came in before suspend breaks the loop and returns needs to be on the request messages - we don't want to drop anything from the response just because of tool suspension.

// alongside the tool result messages.
// Returns undefined (not TOutput) — the prompt has not produced a final result yet.
if (suspended) {
yield emit({ type: 'suspend', messages: request.messages, request });
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just emit request, doing messages is duplicitous

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in fb238b8 — the suspend event now only carries request. Use event.request.messages to access the saved state.

…es from suspend event

Agent-Logs-Url: https://github.com/ClickerMonkey/aeye/sessions/05b72ef8-96ec-4c3f-8866-9a77784d8189

Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 2, 2026

Lets make sure the non suspended tool calls that came back with valid responses still get their tool call results added to the request messages. Anything that came in before suspend breaks the loop an...

Fixed in fb238b8. When any tool suspends, the loop now iterates all executors before breaking: completed/errored tools have their results added to request.messages as usual; only suspended tools are skipped (their toolCallId result is what the caller provides on resume). A new test (should add completed tool results to request.messages before suspending) verifies this with a sequential two-tool call where one completes and one suspends.

Copilot AI and others added 2 commits April 3, 2026 00:42
@ClickerMonkey ClickerMonkey marked this pull request as ready for review April 3, 2026 00:44
@ClickerMonkey ClickerMonkey merged commit dd576c9 into main Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prompt Refactor for Pause/Resume by Tool Interruptions

2 participants