Skip to content

fix(opencode): identify agent creation requests - #52193

Open
Dante-dan wants to merge 1 commit into
anomalyco:devfrom
Dante-dan:fix/52192-go-agent-create-session-header
Open

Dante-dan wants to merge 1 commit into
anomalyco:devfrom
Dante-dan:fix/52192-go-agent-create-session-header

Conversation

@Dante-dan

Copy link
Copy Markdown

Issue for this PR

Closes #52192

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

opencode agent create calls Agent.generate outside a saved session. Its one-shot request omitted x-opencode-session, so OpenCode Go rejected it before it could create an agent. This adds a temporary session ID to OpenCode provider generation requests; it does not create a stored session or change requests to other providers.

This is the CLI generation path. #47473 covers normal session-runner requests, while the merged #48358 covers one-shot generation on the separate v2 branch.

How did you verify your code works?

  • A local OpenAI-compatible HTTP fixture rejects a request without the header. The new Agent.generate regression reaches that fixture, returns the generated agent, and confirms a ses_ header was sent. bun test test/agent/agent.test.ts --test-name-pattern 'agent generation identifies' passed with Bun 1.4.2.
  • tsgo --noEmit -p packages/opencode/tsconfig.json, Prettier check, and git diff --check passed. Targeted oxlint reported no errors and existing warnings in the surrounding test file.
  • The full agent test file had 41 passes and three failures while typecheck ran concurrently: two 5-second timeouts (including the new test before its timeout was raised) and an FSEvents startup error. The new test passed when rerun after the timeout change.

Screenshots / recordings

N/A — CLI request fix.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

This branch has not been deployed

No deployments
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.

can't run agent creation command with Go subscription

1 participant