GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — opencode-claimant(claimant.py): every OpenCode server call is unauthenticated — session create always 401s, and the delete gate trusts curl's exit status · Issue #7367 · developing-today/code

opencode-claimant(claimant.py): every OpenCode server call is unauthenticated — session create always 401s, and the delete gate trusts curl's exit status #7367

New issue
Copy link
New issue
Copy link
Closed
#8174
Closed
opencode-claimant(claimant.py): every OpenCode server call is unauthenticated — session create always 401s, and the delete gate trusts curl's exit status#7367
#8174
Copy link
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 addedpriority/highImportant and time-sensitivesource/design-architectFiled by the repo design architect jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Nov 8, 2026
Issue body actions

Summary

pm-stack/opencode-claimant/poll.py reaches the laptop OpenCode server with HTTP Basic auth read from ~/.local/state/opencode/service-prod.json (_server_get). pm-stack/opencode-claimant/claimant.py reaches the same server on the same port with plain curl -s and no auth at all — every one of its six server calls (session create, per-id get, messages, delete ×3).

Verified against http://127.0.0.1:13420 on 2026-11-08:

$ curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:13420/api/session
401
$ curl -s -o /dev/null -w '%{http_code}' -X POST -H 'Content-Type: application/json' -d '{}' http://127.0.0.1:13420/api/session
401
$ curl -s -o /dev/null -w '%{http_code}' -X DELETE http://127.0.0.1:13420/api/session/nope
401
  body: {"_tag":"UnauthorizedError","message":"Authentication required"}
$ curl -s -m 5 -o /dev/null ...   # curl exit status
0                                 # <- 401 is still a "successful" curl

Consequences in the live path

  1. Session creation cannot succeed. POST /api/session returns {"_tag":"UnauthorizedError",...} with no id. launch_step therefore takes session_id = None, falls into the location check, and records the skip session_wrong_location — a wrong reason for a wrong cause. Live mode can never create a session, so it can never bind, so the claimant's whole live path is a no-op against this server.
  2. returncode == 0 is not a success test for the delete. supervision_step gates its delete on delete_result.returncode == 0. A 401 satisfies that. Today the zero-message gate happens to block it (len(json.loads('{"_tag":...,"message":...}')) == 2, not 0), so the recovery path does not fire — but the only thing preventing "clear the binding while the session still exists" (the duplicate-execution defect the delete-before-reclaim ordering exists to prevent) is an accidental len() of an error body. That is exactly the fail-open shape the packet's step 1b forbids.
  3. The same applies to GET /api/session/<id> and /messages: an error body is parsed as JSON, so any code that reads returncode alone will treat an auth failure as a session/zero-message fact.

Note the correct credentialed path already exists in this repo: pm-stack/dispatch/src/opencode.ts sends the Basic header on the same v2 API.

Suggested acceptance

  1. One transport helper in claimant.py (Basic auth from the same auth file poll.py uses, honouring OPENCODE_AUTH_FILE), used by every server call; no bare curl without the header.
  2. Judge every server response by status/body shape, never by curl exit status alone: a non-2xx or an _tag error body is an unknown/failed read, not "gone" and not "deleted".
  3. Test that fails today: with the stub transport returning 401 for POST /api/session, assert the skip reason names auth/transport, not session_wrong_location; and with 401 for a session GET + messages read, assert the task is left bound (unknown state, fail closed) with no recovery bind argv emitted.
  4. No credential value in logs — the helper may report which auth source was used, never the token.

Found by the laptop opencode-lane claimant fire 2026-11-08 (shadow), #3026 slice 1. Related: #7366 (mode not enforced), #7356 (missing launch steps), #4912 (session contract), #7085 (dispatch auth-file parsing).

Acceptance criteria

  • Every claimant.py call to the OpenCode server (session create, per-id get, messages, delete ×3) carries the same HTTP Basic auth poll.py reads from ~/.local/state/opencode/service-prod.json — no unauthenticated curl -s remains in the claimant.
  • A non-2xx response is never treated as success anywhere in the claimant: the delete/recovery gate checks the HTTP status (and body), not curl's exit code, so a 401 can never read as a completed step.
  • A live-mode fire against the laptop server (127.0.0.1:13420) creates a session successfully (today it always 401s), and the recovery path's gates behave identically under a stubbed 401.

Activity

  1. dezren39
    added
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 8, 2026
  2. developing-today commented on Nov 8, 2026

    @developing-today
    developing-todayBot
    on Nov 8, 2026 – with developing.today
    Contributor
    More actions

    CODE-2269

  3. dezren39
    added
    queue/queuedHas a queued queue task
    on Nov 8, 2026
  4. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    Cross-ref from the 2026-11-08 16:17Z laptop fire (shadow): fixing the transport alone does not make the zero-message gate correct.

    claimant.py:253 also calls the wrong path. The v2 server serves the singular /api/session/<id>/message (envelope {"data": [...], "cursor": ...}); /messages is a 404 with an empty body. Verified on 127.0.0.1:13420:

    GET /api/session/ses_e5e441...977/message   -> 200  data[50]
    GET /api/session/ses_e5e441...977/messages  -> 404  (empty body)
    

    So even with Basic auth added, the step-1a read still returns nothing — and len(json.loads(stdout or "[]")) == 0 then reports zero messages for any session, which is the fail-open direction (recovery would DELETE-then-clear over a session holding 50 messages). The or "[]" was written for a timeout; a 404 on curl -s is exit 0 with an empty body, so it lands on the same branch.

    Filed separately as #7760 (path + empty-body-reads-as-zero, with the fail-closed acceptance for step 1a). The transport item in this issue should carry the path in the same helper so the two cannot be fixed apart.

  5. dezren39
    added a parent issue on Nov 8, 2026
    • Act only on a verified read — one seam contract for the opencode-claimant #7770
  6. dezren39
    added
    source/design-architectFiled by the repo design architect job
    on Nov 8, 2026
  7. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · design-architect pass 74 — adopted as a phase of design #7770

    • Design: Act only on a verified read — one seam contract for the opencode-claimant #7770 — act only on a verified read (one seam contract for the opencode-claimant). Doc: files/designs/code-claimant-seam-contract.md in the keep-the-four-repos-healthy goal workspace. Audit at origin/main b64288a567.
    • Phase: Phase 2 of Act only on a verified read — one seam contract for the opencode-claimant #7770 (server seam), with opencode-claimant(claimant.py): zero-message gate calls /api/session/<id>/messages — a 404 empty body reads as "zero messages" (fail-open before DELETE + binding clear) #7760
    • Pin recorded on Act only on a verified read — one seam contract for the opencode-claimant #7770: one authenticated transport helper for every claimant server call; success = HTTP 2xx AND the body parses into the expected envelope. A subprocess exit code is never a verdict — for reads or for the DELETE gate in this issue.
    • For triage: do NOT re-file, re-scope, or split this issue — it is a phase of Act only on a verified read — one seam contract for the opencode-claimant #7770 with the decision recorded there. Its existing queue lifecycle is unchanged (no new packet was enqueued for it).
  8. dezren39
    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
    status/needs-triageNot yet triaged; needs a first look
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 8, 2026
  9. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    Intake review

    Related: #7760 (the zero-message gate half of this chain, enriched last run); #7366 (launch_step mode) and #7356 (launch_step prompt) are the same function's siblings; seam-contract design #7770 lists this filing.
    Live check: filer's live probes today show 401 on create/get/delete against the real server while curl exits 0; no merged fix in this run's scan.
    Notes / risks: this is the destructive-path member of the claimant family: an unauthenticated delete gate that trusts curl's exit status would act on a session it never verified. Fix auth AND status handling together — auth alone leaves the exit-code trust armed for the next error class.
    Suggested approach: route all claimant server calls through one authenticated helper mirroring poll.py's _server_get, check status codes explicitly, and add a stubbed-401 regression test for the gate.

    — fleet monitor (repo-fleet-monitor), 2026-11-08 12:12 CST run: acceptance criteria appended to the body, labels normalized, meta/enriched applied.

  10. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 9, 2026
  11. developing-today commented on Nov 9, 2026

    @developing-today
    developing-todayBot
    on Nov 9, 2026 – with developing.today
    Contributor
    More actions

    🤖 Agent note · triaged

    • Agent: repo queue worker, lane code-v (repo-worker-code)
    • Session / ID: cron repo-queue-worker-shift-v run 2026-11-08; task 13730
    • Found via: claimed task 13730 (triage, direct execution lane); verified fresh against laptop clone main 1f5ac11276 and the live server on 2026-11-09T00:4xZ
    • Task: task 13730 for issue opencode-claimant(claimant.py): every OpenCode server call is unauthenticated — session create always 401s, and the delete gate trusts curl's exit status #7367 — claimant.py's OpenCode server calls were unauthenticated.

    Triage verdict: the reported defect is FIXED on current main; one narrowed residual remains.

    Verified on current main (~/git/code @ 1f5ac11276):

    • _auth_header_args() exists in pm-stack/opencode-claimant/claimant.py (line ~61): reads the same auth file poll.py uses, honours OPENCODE_AUTH_FILE, value never logged.
    • Every curl call site carries it: session get (line 233), messages (lines 269, 393), deletes (lines 299, 555, 581), prompt POST (line 374, also -f), session create (line 529).
    • Session create now raises when the response carries no id — a 401 error body can no longer fall through to the misleading session_wrong_location skip (issue consequence 1 closed).
    • _get_messages returns None on transport/non-JSON/error responses — an unreadable session is UNKNOWN, never zero-message (issue consequence 3 closed for the prompt path).
    • Live check: unauthenticated GET http://127.0.0.1:13420/api/session still returns 401, as expected; the credential file exists at the path the helper reads.

    Residual (narrowed from issue consequence 2): the supervision recovery delete (line ~299) still gates the recovery bind on delete_result.returncode == 0 with no -f and no HTTP-status/body verification — curl exits 0 on HTTP errors, so if auth ever fails (e.g. credential unreadable → helper returns no header), the delete can silently not happen while recovery proceeds. The session-get path (line ~240) likewise treats an error body as "session gone". A scoped small_fix follow-up has been enqueued for exactly this fail-open residue; the rest of issue #7367 needs no further work.

    Note: lane rows this shift still show session_id=null for opencode-assigned tasks — live launching remains unproven for reasons outside this issue's scope (see design #7770 phases / task 13488 escalation); this triage does not claim the claimant is live, only that the unauthenticated-transport defect named here is fixed on main.

    • Links: task 13730 · issue opencode-claimant(claimant.py): every OpenCode server call is unauthenticated — session create always 401s, and the delete gate trusts curl's exit status #7367 · design Act only on a verified read — one seam contract for the opencode-claimant #7770
  12. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 9, 2026
  13. developing-today
    added
    status:in-review
    on Nov 9, 2026
  14. dezren39 commented on Nov 9, 2026

    @dezren39
    dezren39
    on Nov 9, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done — PR opened (task 14229)

    • Agent: queue worker (repo-worker-code), lane code-p
    • Session / ID: cron repo-queue-worker-shift-p run 2026-11-08 22:57 CST; task 14229 (small_fix, direct execution lane)
    • Task: opencode-claimant(claimant.py): every OpenCode server call is unauthenticated — session create always 401s, and the delete gate trusts curl's exit status #7367 residual — claimant supervision delete gate trusts curl exit code (fail-open on HTTP error).
    • Fix: PR fix(claimant): fail closed on HTTP errors in supervision recovery (#7367) #7960 (branch queue/14229-7367-claimant-delete-gate, commit e423ba3, vs main 129df4a). Session GET in supervision_step now reads the HTTP status via curl -w: only 404 = genuinely gone; 401/403/5xx, transport failure, or a 200 with no session object = unknown state, binding left alone. Recovery DELETE now uses curl -f, so an HTTP error (401 → rc 22) fails the gate: the failure is recorded and the recovery bind is NOT attempted.
    • Tests (oracle: an HTTP error is unknown state, never absence): test_claimant.py 12/12 OK on the laptop (2 new tests: 401 session GET leaves the binding alone; simulated 401 DELETE never binds), test_poll.py 50/50 OK.
    • State: PR fix(claimant): fail closed on HTTP errors in supervision recovery (#7367) #7960 OPEN, MERGEABLE, basic checks QUEUED at completion, no Codex review posted yet. Resume: merge PR fix(claimant): fail closed on HTTP errors in supervision recovery (#7367) #7960 once its checks settle green and any Codex findings are dispositioned, then this residual is fully landed.
    • Links: task 14229 · issue opencode-claimant(claimant.py): every OpenCode server call is unauthenticated — session create always 401s, and the delete gate trusts curl's exit status #7367 · PR fix(claimant): fail closed on HTTP errors in supervision recovery (#7367) #7960
  15. dezren39
    closed this as completedin #8174on Nov 10, 2026
  16. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 10, 2026
  17. dezren39 commented on Nov 11, 2026

    @dezren39
    dezren39
    on Nov 11, 2026
    MemberAuthor
    More actions

    🤖 Agent note · Phase 4 evidence (design #7770 closing audit, issue #7772, task 14782)

    • Agent: repo-worker-code, lane code-y
    • What landed for your phase: Phase 2 (server seam) is dispositioned in the Phase 4 seam inventory in pm-stack/opencode-claimant/README.md (PR claimant: #7770 Phase 4 closing audit — seam contract, fire-log unknowns, stub-shape fix (#7772) #8367): every OpenCode-server call in claimant.py goes through the one authenticated transport _server_request (status captured via curl's -w trailer; a curl exit code is never a verdict); gone is only a 404 from the per-id GET; zero messages is only a 2xx with an empty data list from the singular /message. Call-level dispositions live in Phase 4 (audit) of #4912 — closing server-call inventory + contract statement for the opencode-claimant #4916's landed inventory (cross-referenced, not duplicated).
    • Stub-shape audit result for your phase: the root test_claimant.py stub mirrors the transport writer correctly (status trailer, rc 0 on 401); test/test_claimant.py's stub still mirrored the pre-Act only on a verified read — one seam contract for the opencode-claimant #7770 reader assumption (bare bodies, no status) and 2 of its 5 tests failed against the verified transport — fixed in PR claimant: #7770 Phase 4 closing audit — seam contract, fire-log unknowns, stub-shape fix (#7772) #8367, with the stub docstring now naming the writer.
    • Also fixed: claimant.py comments citing the server seam as "decision 3" corrected to Decision 2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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 addedpriority/highImportant and time-sensitivesource/design-architectFiled by the repo design architect jobstatus:donetask/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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.