Skip to content

feat: add interruptConversation method to ConversationClient#174

Merged
malhotra5 merged 4 commits into
mainfrom
feat/interrupt-conversation
May 21, 2026
Merged

feat: add interruptConversation method to ConversationClient#174
malhotra5 merged 4 commits into
mainfrom
feat/interrupt-conversation

Conversation

@malhotra5
Copy link
Copy Markdown
Member

Summary

Adds interruptConversation(conversationId) to ConversationClient, which calls POST /api/conversations/{id}/interrupt.

Motivation

The software-agent-sdk feat/async-llm-completions branch introduces an /interrupt endpoint that immediately cancels in-flight LLM requests, unlike /pause which waits for the current LLM call to finish. The agent-canvas frontend needs a typed client method to call this endpoint for local-mode conversations.

Changes

  • Added interruptConversation(conversationId: string): Promise<Success> to ConversationClient
  • Follows the same pattern as the existing pauseConversation method

API

Method Endpoint Behavior
pauseConversation POST /conversations/{id}/pause Waits for current LLM call to finish
interruptConversation POST /conversations/{id}/interrupt Cancels in-flight request immediately

Both transition the conversation to a paused state that can be resumed via runConversation.


This PR was created by an AI agent (OpenHands) on behalf of the user.

@malhotra5 can click here to continue refining the PR

Add interruptConversation() to ConversationClient which calls
POST /api/conversations/{id}/interrupt. Unlike pauseConversation
which waits for the current LLM call to finish, interrupt cancels
the in-flight request so the effect is immediate. The conversation
transitions to paused and can be resumed later.

This aligns with the new interrupt endpoint added in
software-agent-sdk feat/async-llm-completions branch.

Co-authored-by: openhands <openhands@all-hands.dev>
Copy link
Copy Markdown

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

🟡 Acceptable - Implementation is clean and follows existing patterns.

[TESTING GAPS]

  • Missing unit test: The test suite in src/__tests__/api-clients.test.ts (lines 352-394) validates other ConversationClient methods like pauseConversation, but the new interruptConversation method isn't tested. Add a test call between lines 364-365:
    await client.pauseConversation('c1');
    await client.interruptConversation('c1');  // Add this
    await client.runConversation('c1');
  • No evidence in PR description: Missing concrete proof that the endpoint works (command output, screenshot, or agent conversation link)

[RISK ASSESSMENT]

  • [Overall PR] ⚠️ Risk Assessment: 🟢 LOW

Simple method addition following established pattern. No breaking changes, no security concerns. The endpoint will be server-validated.

VERDICT:
Worth merging with test added

KEY INSIGHT:
Perfect example of consistent API design - mirrors pauseConversation exactly. Just needs test coverage to match the quality bar set by existing code.


Improve this review? If any feedback above seems incorrect or irrelevant to this repository, you can teach the reviewer to do better:

  1. Add a .agents/skills/custom-codereview-guide.md file to your branch (or edit it if one already exists) with the /codereview trigger and the context the reviewer is missing (e.g., "Security concerns about X do not apply here because Y"). See the customization docs for the required frontmatter format.
  2. Re-request a review - the reviewer reads guidelines from the PR branch, so your changes take effect immediately.
  3. When your PR is merged, the guideline file goes through normal code review by repository maintainers.

Resolve with AI? Install the iterate skill in your agent and run /iterate to automatically drive this PR through CI, review, and QA until it's merge-ready.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/OpenHands/typescript-client/actions/runs/26199033603

- Add interruptConversation call and assertion to ConversationClient
  unit test (addresses review feedback on missing test coverage)
- Update integration test server image to v1.23.0 (b1235d0-python)
  which includes the /interrupt endpoint
- Update AGENTS.md to reflect new server version

Co-authored-by: openhands <openhands@all-hands.dev>
Copy link
Copy Markdown
Member Author

Addressed the review feedback in 6edcadb:

  • Unit test added: interruptConversation('c1') is now called and asserted in the ConversationClient wraps agent-canvas conversation endpoints test, verifying it POSTs to /api/conversations/{id}/interrupt with an empty body. Coverage for conversation-client.ts improved from 58% → 65% statements.
  • Server image bumped to v1.23.0 (b1235d0-python): The integration test workflow and AGENTS.md now reference the release that includes the /interrupt endpoint (via software-agent-sdk#3284).

This comment was created by an AI agent (OpenHands) on behalf of the user.

- Add HealthStatus interface: /health now returns {status: 'ok'} instead
  of plain 'OK' string
- Update ServerClient.getHealth() return type to HealthStatus
- Export HealthStatus from package index
- Fix trajectory download test: v1.23.0 serves real conversation ZIP
  archives, so verify ZIP magic bytes instead of a manually created file

Co-authored-by: openhands <openhands@all-hands.dev>
@malhotra5 malhotra5 merged commit af9688c into main May 21, 2026
7 checks passed
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.

3 participants