Title: 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 · GitHub
Open Graph Title: 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
X Title: 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
Description: 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 s...
Open Graph Description: 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/clai...
X Description: 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/clai...
Opengraph URL: https://github.com/developing-today/code/issues/7367
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"opencode-claimant(claimant.py): every OpenCode server call is unauthenticated — session create always 401s, and the delete gate trusts curl's exit status","articleBody":"## Summary\n\n`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).\n\nVerified against `http://127.0.0.1:13420` on 2026-11-08:\n\n```\n$ curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:13420/api/session\n401\n$ curl -s -o /dev/null -w '%{http_code}' -X POST -H 'Content-Type: application/json' -d '{}' http://127.0.0.1:13420/api/session\n401\n$ curl -s -o /dev/null -w '%{http_code}' -X DELETE http://127.0.0.1:13420/api/session/nope\n401\n body: {\"_tag\":\"UnauthorizedError\",\"message\":\"Authentication required\"}\n$ curl -s -m 5 -o /dev/null ... # curl exit status\n0 # \u003c- 401 is still a \"successful\" curl\n```\n\n## Consequences in the live path\n\n1. **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.\n2. **`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.\n3. The same applies to `GET /api/session/\u003cid>` 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.\n\nNote the correct credentialed path already exists in this repo: `pm-stack/dispatch/src/opencode.ts` sends the Basic header on the same v2 API.\n\n## Suggested acceptance\n\n1. 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.\n2. 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\".\n3. 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.\n4. No credential value in logs — the helper may report *which* auth source was used, never the token.\n\nFound 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).\n\n## Acceptance criteria\n\n- 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.\n- 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.\n- 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.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-08T06:49:57Z","url":"https://github.com/developing-today/code/issues/7367"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c9cc2bee-6481-8a2d-57a9-c51eaa395c74 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9ADE:1D768B:AD4C44:E07237:6B0638BE |
| html-safe-nonce | 0fdb8e39bff68212b71c7f6bb05262b4f6d5206ba8e2797fad265b3ae79025b6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QURFOjFENzY4QjpBRDRDNDQ6RTA3MjM3OjZCMDYzOEJFIiwidmlzaXRvcl9pZCI6IjM1OTUyNzc2MzMwNTI4ODMxMzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 19420a4de68c68d5a1251b3f2b39ecf2bb8dc46bd79badb66955ed37f9cdfb34 |
| hovercard-subject-tag | issue:6268475803 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/7367/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2558ae6f4b1e2cdf9e11e594bc3bbcf27ec9a33dd590766c95e877ed98d76cb2/developing-today/code/issues/7367 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2558ae6f4b1e2cdf9e11e594bc3bbcf27ec9a33dd590766c95e877ed98d76cb2/developing-today/code/issues/7367 |
| og:image:alt | 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/clai... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | dcf72c457c022486d23c3cbb0dd21aba537a87611ca9ddabd1799cf2eaa9b297 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0f38f5735226749ec5e08a8649dce4cb2613d9ad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width