Skip to content

fix(harness): guard against invalid resuming a session vs continuing a turn - #16047

Merged
gr2m merged 5 commits into
mainfrom
fa/guard-against-incorrect-resume-vs-continue
Jun 12, 2026
Merged

fix(harness): guard against invalid resuming a session vs continuing a turn#16047
gr2m merged 5 commits into
mainfrom
fa/guard-against-incorrect-resume-vs-continue

Conversation

@felixarntz

Copy link
Copy Markdown
Collaborator

Summary

This PR improves/fixes a few related harness issues:

  • HarnessAgent had a continueTurn that was returning a StreamTextResult, but it missed the corresponding equivalent that returns a GenerateTextResult. This PR replaces the method with continueStream and continueGenerate.
    • These methods are responsible for continuing a session where there's a mid-flight suspended/interrupted turn (e.g. due to requesting tool approval, or due to manual suspension via suspendTurn).
  • HarnessAgent now more cleanly separates "resume session state" and "continue turn state", with only the latter being able to continue pending tool approvals (because by definition tool approval requests lead to an interrupted turn).
  • HarnessAgent now guards against incorrect method invocation: when a session is resumed with state that indicates that there's a mid-flight turn, calling stream or generate will error. Accordingly, if the resume state indicates there is no mid-flight turn, calling continueStream or continueGenerate will error.

Manual Verification

Run the existing examples.

Checklist

  • All commits are signed (PRs with unsigned commits cannot be merged)
  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

@gr2m
gr2m merged commit 3d87086 into main Jun 12, 2026
37 checks passed
@gr2m
gr2m deleted the fa/guard-against-incorrect-resume-vs-continue branch June 12, 2026 03:04
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
ai 7.0.0-canary.172 github npm
@ai-sdk/alibaba 2.0.0-canary.59 github npm
@ai-sdk/amazon-bedrock 5.0.0-canary.84 github npm
@ai-sdk/angular 3.0.0-canary.172 github npm
@ai-sdk/anthropic 4.0.0-canary.66 github npm
@ai-sdk/anthropic-aws 1.0.0-canary.7 github npm
@ai-sdk/assemblyai 3.0.0-canary.50 github npm
@ai-sdk/azure 4.0.0-canary.75 github npm
@ai-sdk/baseten 2.0.0-canary.56 github npm
@ai-sdk/black-forest-labs 2.0.0-canary.50 github npm
@ai-sdk/bytedance 2.0.0-canary.51 github npm
@ai-sdk/cerebras 3.0.0-canary.56 github npm
@ai-sdk/cohere 4.0.0-canary.52 github npm
@ai-sdk/deepgram 3.0.0-canary.49 github npm
@ai-sdk/deepinfra 3.0.0-canary.56 github npm
@ai-sdk/deepseek 3.0.0-canary.54 github npm
@ai-sdk/devtools 1.0.0-canary.30 github npm
@ai-sdk/elevenlabs 3.0.0-canary.49 github npm
@ai-sdk/fal 3.0.0-canary.49 github npm
@ai-sdk/fireworks 3.0.0-canary.56 github npm
@ai-sdk/gateway 4.0.0-canary.104 github npm
@ai-sdk/gladia 3.0.0-canary.49 github npm
@ai-sdk/google 4.0.0-canary.81 github npm
@ai-sdk/google-vertex 5.0.0-canary.107 github npm
@ai-sdk/groq 4.0.0-canary.53 github npm
@ai-sdk/harness 1.0.0-canary.7 github npm
@ai-sdk/harness-claude-code 1.0.0-canary.3 github npm
@ai-sdk/harness-codex 1.0.0-canary.3 github npm
@ai-sdk/harness-pi 1.0.0-canary.3 github npm
@ai-sdk/huggingface 2.0.0-canary.56 github npm
@ai-sdk/hume 3.0.0-canary.49 github npm
@ai-sdk/klingai 4.0.0-canary.50 github npm
@ai-sdk/langchain 3.0.0-canary.172 github npm
@ai-sdk/llamaindex 3.0.0-canary.172 github npm
@ai-sdk/lmnt 3.0.0-canary.49 github npm
@ai-sdk/luma 3.0.0-canary.49 github npm
@ai-sdk/mcp 2.0.0-canary.63 github npm
@ai-sdk/mistral 4.0.0-canary.54 github npm
@ai-sdk/moonshotai 3.0.0-canary.56 github npm
@ai-sdk/open-responses 2.0.0-canary.53 github npm
@ai-sdk/openai 4.0.0-canary.73 github npm
@ai-sdk/openai-compatible 3.0.0-canary.56 github npm
@ai-sdk/otel 1.0.0-canary.118 github npm
@ai-sdk/perplexity 4.0.0-canary.52 github npm
@ai-sdk/policy-opa 1.0.0-canary.9 github npm
@ai-sdk/prodia 2.0.0-canary.52 github npm
@ai-sdk/provider-utils 5.0.0-canary.48 github npm
@ai-sdk/quiverai 2.0.0-canary.5 github npm
@ai-sdk/react 4.0.0-canary.175 github npm
@ai-sdk/replicate 3.0.0-canary.50 github npm
@ai-sdk/revai 3.0.0-canary.50 github npm
@ai-sdk/rsc 3.0.0-canary.173 github npm
@ai-sdk/sandbox-just-bash 1.0.0-canary.7 github npm
@ai-sdk/sandbox-vercel 1.0.0-canary.7 github npm
@ai-sdk/svelte 5.0.0-canary.172 github npm
@ai-sdk/togetherai 3.0.0-canary.56 github npm
@ai-sdk/tui 1.0.0-canary.7 github npm
@ai-sdk/valibot 3.0.0-canary.48 github npm
@ai-sdk/vercel 3.0.0-canary.56 github npm
@ai-sdk/voyage 2.0.0-canary.23 github npm
@ai-sdk/vue 4.0.0-canary.172 github npm
@ai-sdk/workflow 1.0.0-canary.89 github npm
@ai-sdk/xai 4.0.0-canary.74 github npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/harness related to the harness layer task-merge-tracking-no-issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants