opencode
opencode copied to clipboard
Fork endpoint requires undocumented agent field
Issue
The /session/:sessionID/fork endpoint is requiring an agent field in the request body, but:
- This field is not documented in the API
- The field is not present in the
Session.fork.schemain the git source code - Due to a Zod validation quirk, the agent field gets stripped when sent alone
Error
{
"expected": "string",
"code": "invalid_type",
"path": ["agent"],
"message": "Invalid input: expected string, received undefined"
}
Reproduction
curl -X POST 'http://127.0.0.1:50154/session/ses_xxx/fork?directory=/path' \
-H 'Content-Type: application/json' \
-d '{}'
Expected Behavior
Fork should work without the agent field (as the source code suggests), or the agent field should be documented and properly validated.
Versions Affected
Tested on v1.0.170, v1.0.220, v1.0.223, v1.1.1 - all require the agent field but it's not in the git source.