CreateSession: send the session directory to OpenCode #266
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#266
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#265 — One OpenCode per project: worktree sessions run in-app.
What to build
opencode.Adapter.CreateSessionmust actually send the session'sdirectoryto OpenCode so a single project instance can create asession rooted at a worktree (an external directory). Today it uses
req.Directoryonly for port discovery and POSTs/sessionwith aliteral
{}body, so a session's directory always equals the process'slaunch cwd.
POST /sessioncarries the directory via thex-opencode-directoryheader (URL-encoded) or
?directory=query param. (Verified onOpenCode 1.17.10: a single instance created a session rooted at
/private/tmpthis way, and the returned session reported the correctdirectory.)instance) so
CreateSessiondoes not re-run an lsof scan for worktreesessions. Keep the
platforms.CreateSessionRequestchange minimal —thread the known port rather than adding a second discovery.
external directory is provided.
Acceptance criteria
CreateSessionsends the requested directory to OpenCode onPOST /session(query or header).opencode process launch cwd, and the returned session reports that
directory.
CreateSessiondoes not trigger afresh lsof scan.
directory-sending branch and the provided-port branch. Prior art:
TestCreateSessionPinsReturnedSessionPort,TestCreateSession_TitleIsSetAfterCreation.go test ./... && go vet ./...green; coverage delta ≥ 0.Blocked by