Skip to content

Child sessions created via SDK don't execute prompts (v1.1.15+) #8528

Closed

Description

@Gladdonilli

Description

Child sessions created via the SDK's session.create() and session.prompt() accept prompts successfully but never execute them. The server returns a successful response, but no request is ever sent to the AI provider.

Environment

  • OpenCode version: 1.1.20
  • OS: Windows 11
  • Plugin: oh-my-opencode (uses SDK to spawn background agents)

Steps to Reproduce

  1. Create a child session via SDK:
const createResult = await client.session.create({
  body: { parentID: parentSessionID, title: "Background task" },
  query: { directory: projectDir },
})
  1. Send a prompt to the child session:
await client.session.prompt({
  path: { id: sessionID },
  body: {
    agent: "explore",
    model: { providerID: "anthropic", modelID: "claude-sonnet-4" },
    parts: [{ type: "text", text: "Find all TypeScript files" }],
  },
})
  1. Poll for messages - session stays empty forever

Expected Behavior

The child session should execute the prompt and return AI responses.

Actual Behavior

  • Session creates successfully ✅
  • Prompt returns HTTP 200 with hasError: false, hasData: true ✅
  • But dataPartsCount: 0 - no messages ever appear
  • No request reaches the AI provider
  • Session stays "busy" indefinitely

Debug Evidence

From oh-my-opencode debug logs:

{"type":"spawn_prompt_sent","sessionId":"ses_xxx","agent":"explore","model":{"providerID":"antigravity-claude","modelID":"claude-opus-4-5-thinking"},"promptLength":465}
{"type":"prompt_response","hasError":false,"hasData":true,"dataPartsCount":0}
// Then endless polling with no new messages...
{"type":"polling_tick","elapsedMs":120000}

Regression

This worked in v1.1.14 and broke sometime between v1.1.14 and v1.1.20.

Suspicious changes in v1.1.15:

  • Commit 1954c12: Added basicAuth middleware, changed SDK to use Server.App().fetch() directly
  • Commit f0912ee: Renamed OPENCODE_PASSWORD to OPENCODE_SERVER_PASSWORD

Hypothesis

The v1.1.15 server changes may have broken how external SDK calls (going through HTTP with auth) trigger agent execution. Internal SDK calls (using Server.App().fetch() directly) may work, but external HTTP calls don't properly initialize the agent loop.

Workaround Attempted

We're already passing proper Basic Auth headers via custom fetch wrapper:

const client = createOpencodeClient({
  baseUrl: serverUrl,
  fetch: createAuthenticatedFetch(), // Adds Authorization header
  bodySerializer: JSON.stringify,
})

Auth is working (session creates successfully), but prompts don't execute.

Impact

This breaks all plugins that use background/child sessions, including:

  • oh-my-opencode's background agent system
  • Any plugin spawning subagents via SDK

cc @thdxr

Activity

  1. github-actions commented on Jan 14, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. Gladdonilli commented on Jan 14, 2026

    @Gladdonilli
    Author

    Closing - issue is on oh-my-opencode plugin side, not OpenCode core. Subagents work correctly in vanilla OpenCode without the plugin.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions