correct the field name this doc got wrong, and mark B1/B3 done

22bcd7d fixed both, and found the fix this document suggested was written against a field that does not
exist: opencode 1.17.9 returns `directory` at the top level, not `location.directory`, and sends no
`metadata` at all. The type declared two fields the server never returns, which is the single cause of
both defects.

Worth recording rather than quietly editing, because it generalises: the surveys behind this document
read types and call sites, not a running server, so every field name in it is a hypothesis. The
'check the installed version first' warning was the load-bearing part of the handover, not boilerplate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-10 03:23:07 +01:00
co-authored by Claude Opus 5
parent 492509ae52
commit 29d99127bd
+17 -10
View File
@@ -140,18 +140,25 @@ Each phase is independently shippable. Nothing here is a big-bang rewrite.
and never forwarded. A control that lies is worse than an absent one. Hide the selector first; the
dead plumbing under it (`types.ts:46`, `types.ts:69`, `websocket.ts:262`, the `thinkingLevel` thread
through `useChat`/`useEmbeddableChat`) can go in the same change or a follow-up.
2. **Fix the session-list filter (B1).** Decide the tag-or-don't-filter question: either write
`metadata.officer` at session creation from the runner, or drop the cwd filter and derive the
directory from `location.directory`. The second is smaller and matches where sessions actually come
from. **Until this lands, nothing else in the OpenCode UI is reachable.**
2. ~~**Fix the session-list filter (B1).**~~ **DONE — `22bcd7d`.**
3. **Pass the model through on resume (B2).** Add `model` to `NewChatProps` and thread
`selected.model``useChat`. One prop, and it stops `ses_…` ids reaching `claude --resume`.
4. **Return a real cwd on OpenCode session detail (B3).** `location.directory`, the same source the list
uses.
5. **Stop advertising images on OpenCode models (B4)** — flip `list-models.ts:44` to `false`_or_ plumb
images through `OpenCodeRunParams`. Flipping the flag is the honest one-liner; plumbing is Phase 3.
6. **Guard the OpenCode subscription like the Claude one (B5)**, and call `clearOpenCodeSession` on
disconnect (B6).
4. ~~**Return a real cwd on OpenCode session detail (B3).**~~ **DONE — `22bcd7d`.**
> **Correction, and read this before trusting any field name below.** This document told you to derive
> the directory from `location.directory`. **That field does not exist.** opencode 1.17.9's `GET /session`
> returns `directory` at the top level, with no `location` object and no `metadata` at all — so the type
> declared two fields the server never sends, which is the single cause of both B1 and B3. `22bcd7d`
> found this by reading the live server rather than the type, and deleted `officerMeta` and the metadata
> tag outright rather than fixing them: the only writer of that tag has no callers, and tagging would
> have been a second source of truth for something `directory` already answers.
>
> Two lessons for whoever picks up the rest. The surveys behind this document read types and call sites,
> not a running server, so **every field name here is a hypothesis** — the "check the installed version"
> warning was not boilerplate. And the confirmation that matters is the empirical one: 7 sessions present,
> 0 returned, badge unreachable; now 1 listed under the default dir and 6 filtered to their own. 5. **Stop advertising images on OpenCode models (B4)** — flip `list-models.ts:44` to `false` — _or_ plumb
> images through `OpenCodeRunParams`. Flipping the flag is the honest one-liner; plumbing is Phase 3. 6. **Guard the OpenCode subscription like the Claude one (B5)**, and call `clearOpenCodeSession` on
> disconnect (B6).
### Phase 1 — delete what is dead