Skip to content

opencode-claimant: session create sends a top-level directory, which the v2 API ignores — launched workers land in /home/user, not the repo primary #4870

Closed

Description

@dezren39

Summary

pm-stack/opencode-claimant/prompt.md tells the claimant to create the worker session with a top-level directory:

POST /api/session with JSON body {"directory": <the repo's laptop primary>, "title": ..., "model": {...}, "agent": "build"}

(prompt.md:79-82)

The v2 OpenCode server does not accept a top-level directory. session.create decodes location (Location.PublicRef = {directory}) and strips unknown keys, so the field is silently dropped and the session is created at the server default location — /home/user — not the repo primary.

Evidence

  • packages/protocol/src/groups/session.ts:221-234 — session.create payload is {id, parentID, title, agent, model, location, metadata, permissions, subagentPolicy}; there is no directory field.
  • pm-stack/dispatch/src/opencode.ts:52-58 — the working dispatch client sends location: { directory: opts.directory }.
  • pm-stack/opencode-claimant/prompt.md:79-82 — the claimant's instruction still says top-level directory.
  • Observed sessions launched by the claimant with this shape:
    • task 7077 → ses_e5e5ef40dccffesEpg4GoSqzeZ, location.directory=/home/user
    • task 7316 → ses_e5e5ef64873ffedhQFx8Dz4k6h, location.directory=/home/user
    • task 3275 → ses_e5e5fd27fa1ffeOpTSf2l3D84t, location.directory=/home/user
    • all three resolve to project a3b70b365cae… (the /home/user project), not the code-repo project.

Impact

Workers do still do the right work because the prompt text names the directory ("Work in /home/user/git/code"), but the session runs under the wrong project: the server's per-project context (AGENTS.md discovery, project attribution, session listing/aggregation by project) is the /home/user project. It also makes session→repo attribution in the aggregator unreliable, and it is why bound-session listings mix dir=/home/user and dir=/home/user/git/code.

Fix

In prompt.md step 4b, replace the top-level directory with the v2 location object, keeping the model in the model object:

{"title": "...", "location": {"directory": "<repo primary>"},
 "model": {"id": "workhorse", "providerID": "opencode-route"}, "agent": "build"}

A regression guard is worth having for the next launcher: assert that a created session's location.directory equals the requested repo primary before binding (the claimant can check the create response, which already returns location).

Found during the 2026-11-03 11:20Z fire of the opencode-claimant; this fire launched nothing because Supabase returned HTTP 544 (see the fire log), so the defect was documented rather than fixed inline.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/queue-workerFiled or worked by the queue/worker pilot
    priority/highImportant and time-sensitive
    effort/sSmall: expected under 2 hours of work
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Nov 3, 2026
  2. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Adopted as Phase 2 of design #4912 (judge a session by its own record — the opencode-claimant's session contract), filed by the fleet design architect, pass 44 (2026-11-03). Design doc: files/designs/code-claimant-session-contract.md in the keep-the-four-repos-healthy goal workspace.

    Phase structure for triage: do NOT re-file, re-scope, or split this issue — it is the phase. The design records one strengthening of the issue's proposed fix: the regression guard is a required step, not optional — step 4b's create is verified before bind (the create response's location.directory must equal the requested repo primary; a mismatch is a creation failure, the task stays unbound, and the misplaced session is deleted per-id). Rationale in the design doc: two text-only shape fixes in this prompt (the model object, task 5857; now directory) have each cost a launch window. Phases 1 (#4757) and 3 (#4758) are independent; Phase 4 (#4916, closing audit) is gated on all three.

    This filing is also the third claimant-contract filing — the trigger recorded at design pass 42 for originating #4912.

    agent-note:v1 — design-architect adoption note, pass 44.

  3. added
    queue/queuedHas a queued task in the Supabase agent queue
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  4. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 70 (priority/high). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  5. removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 4, 2026
  6. 23 remaining items

  7. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    on Nov 4, 2026
  8. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    task 9312 (lane code-q): parked 20m for CI on PR #5336. Checks contract corpus and aggregator tests/typecheck remained QUEUED through a >5-minute poll (runner backlog; no failures). Codex review completed, no findings; diff verified against acceptance; claimant test_poll.py 21 tests passed on laptop (prior checkpoint). Resume: fresh-check PR #5336, merge when green, then complete task 9312.

  9. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    task 9312 resumed by lane code-g after its park: PR #5336 checks (contract corpus, aggregator tests and typecheck) are STILL QUEUED — they have been queued since the PR opened, a fleet-wide CI backlog, not a PR problem (docs-only prompt.md change; claimant test_poll.py 21 tests OK on the laptop). Task 9312 re-parks for CI. Resume: fresh-check PR #5336, merge when green, complete task 9312.

  10. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  11. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 4, 2026
  12. added a commit that references this issue on Nov 4, 2026
  13. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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

Metadata

Metadata

Assignees

Labels

app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/highImportant and time-sensitivesource/design-architectFiled by the repo design architect jobsource/queue-workerFiled or worked by the queue/worker pilottask/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