Skip to content

fix(fork): session create silently ignores ?directory= — honor it or reject loudly #1360

Open

Description

@dezren39

Found in the access-pattern benchmark (code#1344), 2026-10-27: POST /api/session?directory=/tmp/oc-bench-work returned a session whose location was /home/user — the query param is silently ignored; location only takes effect via the JSON body ({"location": {"directory": ...}}). The silent fallback ran a tool-enabled session in the account home directory and wrote a file there (f1.txt in /home/user) before the cause was spotted.

Fork: developing-today/opencode v2 API. Fix options, in preference order: honor ?directory= on session create for parity with the body's location; or return a 400 when an unknown/ineffective directory param is supplied. Silent fallback to the server's home is the one unacceptable behavior. Cover with a server test: create with the query param, assert the session location (or the 400).
Acceptance: no API path can produce a session in an unintended directory without an explicit, visible signal.

Acceptance criteria

  • No API path can produce a session in an unintended directory without an explicit signal: POST /api/session either honors ?directory= (parity with the body's location) or returns a 400 for the ineffective parameter.
  • A server regression test covers session create with the query param and asserts the session location (or the 400).
  • The silent fallback to the server's home directory is gone.

Activity

  1. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    Intake review

    Safety-relevant silent fallback: ?directory= on session create is ignored and the session lands in the account home directory — a tool-enabled session already wrote a file there during the benchmark. Preference order in the issue: honor the param, else reject loudly. Priority set high for the silent-wrong-directory failure mode.

    Related: Related: #1344 (benchmark that found it); fork repo developing-today/opencode (v2 API) is where the fix lands. Labels normalized by fleet monitor: the issue arrived with only meta/follow-up.

    Still live: checked this run — no merged PR in the recent merged list of this repo implements or resolves this issue, and no closing reference was found; the issue stays open.

    🤖 Agent note · filed

  3. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/highImportant and time-sensitive
    effort/sSmall: expected under 2 hours of work
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    mode/onlineFully doable remotely: design, config, code, cloud
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    and removed on Oct 27, 2026
  4. 12 remaining items

  5. added
    queue/queuedHas a queued task in the Supabase agent queue
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  6. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 7234 (triage, queued, priority 50) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

  7. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 3, 2026
  8. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  9. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    Triage findings — bug confirmed at current opencode main; fix filed in the opencode repo

    Verified fresh this pass against developing-today/opencode main e57af295bb:

    • packages/protocol/src/groups/session.ts: the session.create endpoint (POST /api/session) declares no query schema — ?directory= is not a declared parameter and is dropped without a signal. Its payload offers only location.
    • packages/server/src/handlers/session.ts: the handler falls back to location ?? { directory: process.cwd() } — exactly the silent fallback to the server's working directory the issue reports.
    • Parity gap in the same protocol file: session.list's SessionsQuery does declare directory, so callers reasonably expect create to accept it.
    • No existing opencode issue covered this (searched this pass).

    Fix path (per this issue's own cross-repo direction): filed as developing-today-forks/opencode#1570 with the file:line evidence, the preference order (honor ?directory= for parity with body location, or 400 loudly), and acceptance criteria including the server regression test.

    This issue stays open as the record of the set (origin: access-pattern benchmark, issue #1344) and closes when opencode#1570 lands. No blockers on this side.

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

Metadata

Metadata

Assignees

Labels

effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedmeta/follow-upFollow-up spun out of earlier workmode/onlineFully doable remotely: design, config, code, cloudpriority/highImportant and time-sensitivesource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions