Skip to content

fix: move AbortSignal from API request body to SDK options#28

Open
galligan wants to merge 1 commit intoEveryInc:mainfrom
galligan:galligan/fix-agent-signal-body
Open

fix: move AbortSignal from API request body to SDK options#28
galligan wants to merge 1 commit intoEveryInc:mainfrom
galligan:galligan/fix-agent-signal-body

Conversation

@galligan
Copy link

Summary

AgentService.runAgentLoop passes signal inside the Anthropic API request body object. The API rejects this with a 400:

signal: Extra inputs are not permitted

signal is a client-side SDK option for request cancellation, not an API parameter. It belongs in the second argument to client.messages.create().

Before:

const request = { model, messages, tools, signal: this.abortController?.signal };
result = await this.client!.messages.create(request);

After:

const request = { model, messages, tools };
result = await this.client!.messages.create(request, {
  signal: this.abortController?.signal ?? undefined,
});

One-line fix. The abort signal still works for cancellation — it's just passed in the right place now.

Test plan

  • "Ask Proof" agent dialog no longer fails with "Extra inputs are not permitted"
  • Cancelling an in-progress agent request still aborts the API call

Closes #26

🤘🏻 In-collaboration-with: Claude Code

The AbortController signal was passed inside the Anthropic API request
body object. The API rejects it with "signal: Extra inputs are not
permitted" since signal is not a valid API parameter — it's a
client-side SDK option for request cancellation.

Move signal to the second argument of client.messages.create() where
the Anthropic SDK expects it.

Closes EveryInc#26

🤘🏻 In-collaboration-with: [Claude Code](https://claude.com/claude-code)
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.

Agent API call fails with "signal: Extra inputs are not permitted"

1 participant