opencode web: child session created with ?directory= returns empty body on POST /session/{id}/message #8597

Open
opened 2026-02-16 18:10:21 -05:00 by yindo · 1 comment
Owner

Originally created by @maou-shonen on GitHub (Feb 5, 2026).

Bug Description

In opencode web mode, child sessions created via POST /session?directory=/path return HTTP 200 with Content-Length: 0 (empty body) on subsequent POST /session/{id}/message calls. Child sessions created without the directory query parameter work correctly.

Environment

  • OpenCode: 1.1.51
  • Mode: opencode web
  • Platform: Linux x86_64

Steps to Reproduce

AUTH="Basic $(echo -n 'opencode:<password>' | base64)"
PARENT="<any_existing_session_id>"

# 1. Create child session WITH directory
CHILD=$(curl -s -H "Authorization: $AUTH" -H "Content-Type: application/json" \
  -X POST "http://localhost:4096/session?directory=/home/user/project" \
  -d "{\"parentID\": \"$PARENT\"}")
CHILD_ID=$(echo $CHILD | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")

# 2. Send prompt — returns empty body
curl -v -H "Authorization: $AUTH" -H "Content-Type: application/json" \
  -X POST "http://localhost:4096/session/$CHILD_ID/message" \
  -d '{"agent":"sisyphus-junior","parts":[{"type":"text","text":"hello"}]}'
# → HTTP 200, Content-Length: 0, empty body

Comparison: Without directory

# Create child session WITHOUT directory
CHILD2=$(curl -s -H "Authorization: $AUTH" -H "Content-Type: application/json" \
  -X POST "http://localhost:4096/session" \
  -d "{\"parentID\": \"$PARENT\"}")
CHILD2_ID=$(echo $CHILD2 | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")

# Send prompt — returns full response
curl -s -H "Authorization: $AUTH" -H "Content-Type: application/json" \
  -X POST "http://localhost:4096/session/$CHILD2_ID/message" \
  -d '{"agent":"sisyphus-junior","parts":[{"type":"text","text":"hello"}]}'
# → HTTP 200, body = 1261 bytes (valid JSON)

Controlled Experiment Results

Only variable changed is the directory parameter. Everything else (parent session, prompt body, auth) is identical:

POST /session                              → prompt ✅ body=1261 bytes
POST /session?directory=/home/user/project → prompt ❌ body=0 bytes
POST /session?directory=/home/user         → prompt ❌ body=0 bytes

Impact

The oh-my-opencode plugin passes directory when creating subagent sessions to ensure subagents operate in the correct project directory. This bug causes delegate_task (and call_omo_agent, look_at) to fail 100% of the time in opencode web mode. TUI mode is unaffected (presumably uses in-process transport rather than HTTP).

Originally created by @maou-shonen on GitHub (Feb 5, 2026). ### Bug Description In `opencode web` mode, child sessions created via `POST /session?directory=/path` return HTTP 200 with `Content-Length: 0` (empty body) on subsequent `POST /session/{id}/message` calls. Child sessions created **without** the `directory` query parameter work correctly. ### Environment - OpenCode: 1.1.51 - Mode: `opencode web` - Platform: Linux x86_64 ### Steps to Reproduce ```bash AUTH="Basic $(echo -n 'opencode:<password>' | base64)" PARENT="<any_existing_session_id>" # 1. Create child session WITH directory CHILD=$(curl -s -H "Authorization: $AUTH" -H "Content-Type: application/json" \ -X POST "http://localhost:4096/session?directory=/home/user/project" \ -d "{\"parentID\": \"$PARENT\"}") CHILD_ID=$(echo $CHILD | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") # 2. Send prompt — returns empty body curl -v -H "Authorization: $AUTH" -H "Content-Type: application/json" \ -X POST "http://localhost:4096/session/$CHILD_ID/message" \ -d '{"agent":"sisyphus-junior","parts":[{"type":"text","text":"hello"}]}' # → HTTP 200, Content-Length: 0, empty body ``` ### Comparison: Without directory ```bash # Create child session WITHOUT directory CHILD2=$(curl -s -H "Authorization: $AUTH" -H "Content-Type: application/json" \ -X POST "http://localhost:4096/session" \ -d "{\"parentID\": \"$PARENT\"}") CHILD2_ID=$(echo $CHILD2 | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") # Send prompt — returns full response curl -s -H "Authorization: $AUTH" -H "Content-Type: application/json" \ -X POST "http://localhost:4096/session/$CHILD2_ID/message" \ -d '{"agent":"sisyphus-junior","parts":[{"type":"text","text":"hello"}]}' # → HTTP 200, body = 1261 bytes (valid JSON) ``` ### Controlled Experiment Results Only variable changed is the `directory` parameter. Everything else (parent session, prompt body, auth) is identical: ``` POST /session → prompt ✅ body=1261 bytes POST /session?directory=/home/user/project → prompt ❌ body=0 bytes POST /session?directory=/home/user → prompt ❌ body=0 bytes ``` ### Impact The oh-my-opencode plugin passes `directory` when creating subagent sessions to ensure subagents operate in the correct project directory. This bug causes `delegate_task` (and `call_omo_agent`, `look_at`) to fail 100% of the time in `opencode web` mode. TUI mode is unaffected (presumably uses in-process transport rather than HTTP).
Author
Owner

@github-actions[bot] commented on GitHub (Feb 5, 2026):

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

  • #11289: Empty response bug with missing await in prompt_async handler - directly matches HTTP 200 with empty body responses
  • #8528: Child sessions created via SDK don't execute prompts - regression affecting oh-my-opencode plugin
  • #11342: delegate_task fails with NotFoundError when using external OpenCode Server - related to directory parameter handling
  • #10959: delegate_task not working for windows 11 - related oh-my-opencode delegation issue
  • #12133: Permission requests from child sessions do not get forwarded - related to child session handling in web mode

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

@github-actions[bot] commented on GitHub (Feb 5, 2026): This issue might be a duplicate of existing issues. Please check: - #11289: Empty response bug with missing await in prompt_async handler - directly matches HTTP 200 with empty body responses - #8528: Child sessions created via SDK don't execute prompts - regression affecting oh-my-opencode plugin - #11342: delegate_task fails with NotFoundError when using external OpenCode Server - related to directory parameter handling - #10959: delegate_task not working for windows 11 - related oh-my-opencode delegation issue - #12133: Permission requests from child sessions do not get forwarded - related to child session handling in web mode Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8597