Add local operator inspection and reconciliation for quarantined resource leases, including atomic audit-backed FIFO handoff and recovery protocol support.\n\nPreserve capability tokens in the authoritative store and reject non-loopback or ordinary client transport for recovery mutations.\n\nChecked packaged templates and packaged authoring skill references; none need updating. The task-owned docs note records shared README and skill reference follow-up for docs-fold.
Use an explicit chat_create operation_id as the durable bootstrap key while retaining envelope IDs for reply correlation. Legacy requests receive fresh server-scoped identities, so independent cli-1/android-1 requests do not collide; clients that retry retain one operation_id.
Update Android creation state and repository calls to preserve an operation identity across retries, and cover durable reconnect retries, duplicate barriers, changed input, legacy correlation reuse, and protocol serialization.
Checked packaged templates: none describe chat_create. Checked packaged authoring-skill references: the existing description is stale, but shared references and README must not be edited by an item; docs/notes/bootstrap-create-identity.md records the required docs-fold update and rollout compatibility.
Add validated OpenCode-only delivery capabilities, canonical linked-worktree access checks, isolated candidate verification, and guarded main settlement.
Wire the bounded reconnect-foreground controlled HTTP fixture through ordinary server construction so target verification obtains server-controlled provenance and rejects unknown or incompatible fixture evidence.
Checked packaged templates and packaged authoring skill references; no updates are needed because this draft-only infrastructure activates no definition. Recorded the stale reference and activation guidance in docs/notes/delivery-stabilization.md for the docs fold.
Reconcile authoritative shell snapshots with bounded lifecycle journals so concurrent exits and creates cannot be overwritten, coalesce observation setup, and retain verified ownership across reconnects. Add deterministic reconciliation and cancellation regressions plus stable limited-visibility handling.\n\nChecked packaged templates and authoring skill references: none need updating. The task-owned docs note records the stale shared chat documentation for docs-fold; shared documentation was not edited.
Add a process-lifecycle foreground reconnector and pure recovery policy, wiring repository recovery through the validated saved endpoint. Include lifecycle-process and focused unit coverage while preserving explicit Disconnect and stale socket callback guards.
Checked packaged templates and packaged authoring skill references: neither documents Android connection lifecycle behavior, so neither needs updating. Shared android README changes are recorded in docs/notes/foreground-reconnect.md for the docs-fold writer.
Add durable FIFO capacity-one resource leases for executable stages, including cleanup-confirmed release, conservative restart quarantine, queue state events, and CLI/TUI/Android waiting presentation. Add scheduler, cleanup, protocol, client, and Android coverage plus a proposed Android v3 resource draft.
Checked packaged templates and authoring skill references: neither needs updating in this item. The per-item docs note records the shared documentation that docs-fold must update; no shared README or packaged reference was edited.
Derive validated same-run visit artifact capabilities in the runner and pass them to OpenCode and Pi clients. Permit supported file tools to read completed prior visits and write only the current visit, preserving workspace, secret, database, and shell restrictions.\n\nChecked packaged templates and authoring skill references: neither needs updating in this item; docs/notes/scoped-artifact-access.md records the shared documentation staleness for the docs-fold writer.
Identify configured attempt expiry during V2 active-session idle waits and retain bounded phase, timeout and session diagnostics without claiming a lost response. Preserve genuine operation failures, error identities, redaction, cleanup and admitted-work replay protections. Add stage regressions and scratch-server CLI/websocket retention coverage.
Checked packaged templates in examples and the pipeline template generator: none needs updating because timeout configuration and contracts are unchanged. Checked packaged authoring skill references: debugging.md needs a STAGE DEADLINE playbook and clarified transport guidance. Recorded that stale shared documentation in docs/notes/stage-timeout-diagnostics.md for docs-fold; shared documentation was deliberately not edited.
Verification: go build ./...; go vet ./...; go test ./...; go test -count=1 ./internal/server ./internal/stage ./internal/pipeline ./internal/protocol; go test -count=1 -run TestStageDeadlineDiagnosticThroughCLIAndWebsocket -v ./internal/server; gofmt -l .; git diff --check. All passed. Live-provider behavior not tested; no deploy or deployed-service restart.
A stage's session was exported twice, as session.md and session.html, and both
files were presented. It is now one html file; the markdown export is retired.
- internal/stage/session_export.go: ExportSession renders and writes exactly one
file, session.html, via writeSessionFile; renderSessionMarkdown and its helpers
are gone; SessionExportResult carries HTML/HTMLBytes only. The source read, the
8 MiB source / 2 MiB rendered bounds, the truncation banner, the
never-overwrite rule and the honest empty-session handling are unchanged.
- internal/protocol/runs.go: SessionExport drops markdown/markdown_bytes (a
record written before the change still decodes; unknown fields are ignored),
and adds LegacySessionMarkdownArtifact with RunStep.PresentedArtifacts(), the
one Go rule that hides the retired session.md from every artifact listing.
- internal/server/runner.go: evidence.Markdown/MarkdownBytes are no longer copied.
- internal/tui: the artifacts panel, the recorded count and the per-visit summary
derive from PresentedArtifacts(), so the terminal never lists session.md.
- web/src/app.js: the spike's renderArtifacts applies the same filter.
- android: the Session section is the html export alone in a WebView — SessionView,
the Markdown/HTML toggle and the session markdown path are removed;
presentedArtifacts(step) filters the retired session.md out of the per-visit
gallery, the run gallery and its count, the verdict/selection lists and the
timeline indicator; data/protocol SessionExport drops the markdown fields.
- Tests pin the single html file, prove no session.md is written and that a
pre-existing one is neither overwritten nor presented, and prove a legacy
export record still loads and its session.md is hidden.
The legacy session.md of an older run stays on disk (dated evidence); it is only
no longer produced and no longer presented.
Checks (macOS, Go 1.24, Android Gradle 8.11.1, 18 Oct 2026): gofmt -l . prints
nothing; go build ./... && go vet ./... clean; go test ./internal/... ./cmd/...
-> 19 packages ok, 0 failures; node --check web/src/app.js ok and node --test
web/test -> 20/20; gradle --offline --no-daemon :app:assembleDebug
:app:testDebugUnitTest -> BUILD SUCCESSFUL.
Packaged references checked: internal/author/skill/references/delivery.md and
operations.md both described the session.md+session.html pair, so both are
updated here to describe the single session.html export and the retired, hidden
session.md. README.md and internal/author/skill/SKILL.md carry no session.md
reference and install.go's managed inventory is unchanged (no reference added or
removed). docs/notes/session-html-only.md records the remaining stale shared
documentation (docs/stage-artifacts.md, docs/app-integration-verification.md) for
the docs-fold writer; shared docs are not edited by this item.
Brings the tool-call summary chip (7fbbd95) together with main's chat in-flight
state and background-process surface (7b0dc94). Both edit ChatFormat.kt and
ChatTranscript.kt; the merge combined them cleanly (no conflict markers) — the
chip's live gating (live = streaming, toolStartedAt) now sits alongside main's
turn-phase labels and background-process bar, and both sides' pure helpers
coexist.
Re-ran the repository checks on the resolved tree: gradle --offline --no-daemon
:app:testDebugUnitTest :app:assembleDebug => BUILD SUCCESSFUL; JUnit XML
aggregate classes=70 tests=680 failures=0 errors=0 skipped=0.
The chat transcript no longer renders a chip per tool call: `ToolCalls`
(`android/.../ui/chat/ChatToolCalls.kt`) now draws a single summary chip
reading `N tools called` (`1 tool called` for one) as the turn's only
tool-call surface. While the turn streams the chip shows the call count
growing and the existing spinner while any call is in flight, plus the
existing `· long` mark for a running call past `TOOL_LONG_RUNNING_MILLIS`;
both are gated on the turn still streaming (`live = streaming` in
`AgentTurnItem`), so a settled chip never spins or fakes a long mark.
Tapping the chip opens the existing `ToolPanel` as a popup listing every
call of the turn, in the order the agent made them: one independently
collapsible row per call naming it, showing its one-line detail, its
`+N -M` edit stat and its duration, expanding in place to the
pretty-printed INPUT, the synthesised edit diff, then the ERROR block for
a failed call or the OUTPUT (`(no output)` when empty). The list is
bounded by the new `TOOL_PANEL_MAX_HEIGHT_DP` (`Dimens.kt`, purpose-named)
and scrolls inside the panel, so many calls never grow the popup past the
window nor re-flow the transcript. The chip announces the count ("N tool
calls, expand for details") through the app's accessibility treatment.
Pure logic lives in `ChatFormat.kt` (`toolCallsLabel`,
`toolCallsAnnouncement`, `toolCallCount`, `toolsRunning`, `toolCallRow`)
with unit cases added to the existing `ChatFormatTest`; no raw dimension
was introduced, so `DimensTest` is unchanged.
Checked for staleness: the packaged authoring skill references
(`internal/author/skill/references/`) and the packaged templates carry no
Android-chat content, so neither needs updating — this change is
`android/`-only. The shared docs this change makes stale
(`android/README.md`'s "Tool-call chips and the expandable panel" section
and `docs/chat-verification.md`'s tool-chip row) are recorded in
`docs/notes/chat-tool-group.md` for the single `docs-fold` writer rather
than edited here.
Two gaps in the chat's in-flight feedback.
The turn indicator no longer reads a bare `Working…` for every state. A new
pure derivation (TurnPhase/turnPhase/turnPhaseLabel in ui/chat/ChatFormat.kt)
labels the headline from evidence already on the wire: `Thinking…` while text
or reasoning deltas are still arriving (within TURN_THINKING_WINDOW_MILLIS),
`Running a tool…` while calls are in flight, `Waiting…` otherwise. No
percentage, ETA or invented progress.
The agent's shell commands are now surfaced end to end as their own frame kind,
so a background process (a dev server, a watching build) that outlives its tool
call is visible and clears when it exits.
Server:
- protocol/chat.go adds ChatEventShell, ChatShell (id, status, command, *int
exit — a pointer so exit 0 is not "absent") and ChatEventFrame.shell.
- opencode/chat.go maps shell.created/shell.exited through a new exported
ChatStreamState, attributing created via info.metadata.sessionID and exit via
the ids the stream already surfaced; another session's or an unattributed
shell is ignored, an id-less shell fails the stream. No cwd/file/credential is
carried.
- server/chat_hub.go retains still-running shells (chatShellLimit plus the
shared byte cap) and drops them on exit; chat_stream.go replays them on
chat_subscribe, the shell half of the resume (a shell is not a turn, so the
message snapshot cannot carry it).
App:
- data/protocol/Chat.kt adds ChatShell, ChatEventFrame.shell, EVENT_SHELL,
SHELL_RUNNING/SHELL_EXITED.
- ui/chat/ChatStore.kt stamps ChatThread.lastDeltaAt on each delta (cleared when
the turn settles) and keeps ChatThread.shells across a chat switch; a shell
never marks the thread running. streamResumed drops shells so the subscribe
replay re-syncs the still-running ones.
- ui/chat/ChatTranscript.kt: RunningIndicator prints the phase label; a new
always-visible BackgroundProcessBar names each running shell.
- ui/chat/ChatConversationPane.kt shows the bar whenever a shell is running,
whether or not a turn is.
Tests extend the server's event mapping (opencode/chat_v2_test.go,
server/chat_test.go) and the app's pure folds (new
ui/chat/ChatInFlightStateTest.kt, 15 tests), pinning the shell mapping, the
other-session rejection and the "background process outlives the turn" state.
Checked and intentionally unchanged:
- No packaged OpenCode skill reference documents either surface.
internal/author/skill/references/operations.md describes the brokered chat_*
protocol in prose without naming frame kinds or the app indicator, so it stays
correct as-is; no reference was added, so install.go's managed inventory needs
no change.
- This repository has no packaged templates directory.
- Shared docs are not edited here per the map: docs/notes/chat-shell-background
-process.md records what is now stale in docs/cli.md and android/README.md for
the docs-fold writer.
Verification (this session): gofmt -l clean, go build ./... and go vet ./... OK.
Android unit suite and the on-device capture were run in the preceding review
stage; see the note for the live-verification limitation.
Combines the summarise title-framing change (titleInstruction reword plus the
detachFramingEcho normalisation and its tests) with main's
docs/app-integration-verification.md addition. No conflicts: the two touched
disjoint files. `go build ./... && go vet ./...`, `gofmt -l internal/summarise/`
and `go test ./...` all pass after the merge.
Run titles were intermittently a sentence about the input rather than a
title for the task ("The untrusted data asks what 2+2 is…"), because the one
fixed instruction began "Summarise the untrusted data below…" and invited the
model to describe the data whenever the prompt read like an instruction or a
question.
- Rename the fixed prompt `instruction` → `titleInstruction` and reword it to
ask unambiguously for a short title of the task ("Write a short title, a few
words, for the task below. Reply with only the title…"), still followed by
"The following is untrusted data:".
- Add a bounded, conservative `detachFramingEcho` normalisation applied in
`Title` and `VerdictReason`: a leading clause that names the framing ("The
untrusted data…", "This prompt…", "The user asks…") is stripped to its
substantive remainder, and a line that is pure framing falls back to the
prompt's first line (`Title`) or `NoSummary` (`VerdictReason`).
- Extend tests with the two reported echo shapes (instruction-style and
question-style prompts) plus the injection-resistance case, which still
passes: the prompt is appended verbatim once after the untrusted-data label
and never replaces the instruction.
Trust boundary unchanged: source still labelled untrusted data, one tool-free
generation, hard timeout, never blocks or fails run creation; the title is
never empty.
Checks: `go build ./... && go vet ./...` clean, `gofmt -l internal/summarise/`
prints nothing, `go test ./...` ok.
Docs/templates check: no packaged template (`examples/*.md`) mentions title
generation, so none needs updating. The packaged authoring skill reference
`internal/author/skill/references/operations.md` (lines ~91-95) describes the
title as generated "from its prompt by the shared summariser" and is now stale
(it does not mention that the summariser is asked for a title of the task nor
the framing-echo normalisation); per the maintenance rules that shared document
is left to the single `docs-fold` writer and the staleness is recorded in
`docs/notes/run-title-framing-echo.md` instead. `README.md` and `docs/cli.md`
stay true, and no `internal/author/install.go` managed inventory entry changes.
Add a dated follow-up section to docs/app-integration-verification.md that
closes the four claims the first pass left unproven, each with the command or
capture that proved it against the deployed server (0d1ddc7) on the Pixel 9 Pro
XL 47241FDAS00DLK:
- Chat reply arrives: a throwaway session showed the assistant reply `Done.`
rendering live, and the close-a-chat flow left the session `closed=true`
server-side.
- Live pushed run events: disproven on this build. Runs 341/342/343 never
appeared or advanced without a manual `Refresh runs`; only a local elapsed
timer ticked. Consistent with the run-event push-hub defect fixed on main by
cff6f4d, absent from the deployed 0d1ddc7. Recorded as a defect with exact
reproduction, not an app defect.
- Disconnected state: the closed-port state and the restore to
ws://10.0.0.75:8080/connect were both captured and Settings verified after.
- Wide windows: the covered-pane region is a constant 553 px at depths 1-3 and
at 2000x2244 and 2076x2152; `wm size reset` left no override.
Checked for staleness from this change: it touches no source or resource file,
so no packaged template or packaged authoring skill reference
(internal/author/skill/references/) depends on it - none references this
document and none needs updating.
Report-only: the untracked scratch directory .gaps-tmp/ is deliberately left
uncommitted.
Rewrite the workflow documentation to describe how the system actually works:
the agent (the session) is the brain and advances the queue by hand through the
`pipelines` CLI. There is no orchestration script, no driver, no polling loop and
no lane machinery, and none may be written.
- references/work.md: rewritten end to end. The queue-driver script
(drivers/workd.sh), the claim-file ledger with atomic renames, the PAUSED
marker and the poll loop are gone. State is now the server (authoritative for
run state), the queue file (authoritative for intent) and the conversation.
The agent reads the queue, picks the item, creates its worktree/branch and
launches it with `pipelines run <pipeline> <brief> --json --yes`; progress is
event-driven via a background `pipelines wait <run-id> [...]` (never polled);
on completion the agent reconciles with `pipelines inspect <run-id> --json`,
verifies it landed and starts the next item.
- references/queue.md: the landing gate runs the command directly
(`git merge-base --is-ancestor <branch> main`, exit 0 = landed) instead of a
`land-check.sh` helper; the never-delete-branch / never-remove-worktree rules
are kept, and the waiting section states the agent advances the queue by hand.
- references/orchestration.md: intro and "Running and watching" state the
agent-driven, event-driven model; "Pipeline choice" names the current set
(Android, TUI, Server, Generic, Plan and land, UI sweep, Probe) by area and
records the retired names.
- references/debugging.md: "Duplicated work after a driver restart" became
"…after a session restart", resuming from the queue file not a cursor file.
- SKILL.md: the routing row no longer says "queue driver".
- AGENTS.md: the maintenance workflow names the current pipeline set instead of
the retired `Pipelines maintenance - plan implement review`.
- internal/tui/AGENTS.md: the restart line no longer names lanes.
- docs/notes/agent-driven-work-model.md: the docs-fold note recording that
docs/cli.md needs its "Scripted runs"/`--wait` framing aligned to the
event-driven model, and that the dated evidence docs stay as they are.
Checked before committing: no packaged template directory exists in this repo, so
none needed updating; internal/author/install.go's managed file inventory needs no
change (no packaged reference was added or removed — the 13 listed files all
match internal/author/skill/references/); no stale `queue driver`/`workd.sh`/
`claim-file` references remain anywhere under internal/author. Genuine device
tooling (android/scripts/capture_png.sh-style) and server-side polling prose were
left alone.
Checks: `go test ./internal/author -count=1` ok; `go build ./...` clean;
`go vet ./...` clean; `gofmt -l .` clean.
The phone's chat transcript rendered one agent reply as ~36 bubbles, each with
its own thinking block, and a finished tool call lost its name and its input.
- Turn fold (android): ChatFormat.kt gains the pure ChatTurn / TranscriptRow /
transcriptRows fold - each run of consecutive assistant messages between two of
the operator's messages is one agent turn - and ChatTranscript renders one
bubble per turn: the turn's single collapsible thinking block (all its
reasoning, in order, growing live while it streams), then its tool-call chips,
then one answer block of just the turn's text parts. AssistantParts/MessagePart
are replaced by AgentTurnItem/UserMessageItem; ChatConversationPane counts the
folded rows.
- Delta part ids (server + client): internal/protocol/chat.go adds
ChatDeltaPartID(messageID, kind, ordinal), mirrored as ChatProtocol.deltaPartId
in data/protocol/Chat.kt, and NormalizeChatEvent keys a text or reasoning delta
on it. OpenCode numbers a message's text and reasoning parts independently from
0, so the old "%s#%d" gave the first text delta and first reasoning part the
same id: the answer was appended into the thinking block, and the server's
retained state (chat_hub.go) re-collided on resume. ChatStore's upsert now
routes a delta through the kind-aware deltaPartId fold, so it stays robust even
against a peer that still shares one id.
- Tool fields (server + client): NormalizeChatEvent takes a call's arguments from
session.tool.input.ended's text as well as session.tool.called's input object
(toolInput), and chat_hub.go's new mergeChatToolPart folds each tool frame onto
the retained part so the progress/success frames that omit name and input never
blank them. ChatFormat.kt's mergeToolPart mirrors that on the client, so the
chip and panel header keep the real tool name and the panel shows INPUT beside
OUTPUT.
Tests: chat_v2_test.go and chat_test.go add the text/reasoning id-collision and
the tool name+input retention cases; ChatReasoningTurnTest, ChatTranscriptTest
and ChatRunningWorkTest cover the turn fold, the collision and the tool lifecycle.
Checks: Go build, vet, gofmt and the package tests pass (go build ./... &&
go vet ./...; gofmt -l . empty; go test ./internal/server ./internal/opencode
./internal/protocol ./internal/stage ./internal/pipeline; go test ./...).
Android passes offline with --no-daemon (assembleDebug and the full
testDebugUnitTest suite, 660 tests). The on-phone observation was not performed:
the device lock was held by another run and adb was not available here.
Documentation inventory checked: no packaged OpenCode skill reference in
internal/author/skill/references/ and no packaged template documents the app's
chat transcript, this delta part-id derivation or the tool-field retention, and
no internal/author/ managed file inventory entry names any touched file, so none
of them needs updating. The shared android/README.md behaviour statements are
made stale by this change and are recorded instead in
docs/notes/chat-transcript-turn-fold.md for the docs-fold writer, per the repo
rule that an item never edits a shared document itself.
Adds docs/app-integration-verification.md, an operator-facing report of an
end-to-end verification of the Android app against the real running Pipelines
server on the phone. Report only: no app, server, installer or Docker file was
changed, and nothing was fixed.
The report records, per flow, the result, capture path and the real server data
observed: the pipelines list and its filters/sort, pipeline detail tabs, runs
list aggregate (246 total) and run detail, the stage sheet/timeline and
full-screen artifact viewer gaps, artifacts gallery, omni search, Settings
(endpoint ws://10.0.0.75:8080/connect, server build 0d1ddc73a4), the templates
gallery, chat sessions, live run updates and the disconnected state that were
not verified and why.
Revision tested: phone app at main's build (0d1ddc7, installed md5
722f6a139a8aea6d15b09c89360dbea0), server build
v0.0.0-20261018001257-0d1ddc73a444. The phone was left on main's build.
Checked for staleness: no packaged template or packaged authoring skill
reference (internal/author/skill/references/*) describes or indexes this
document, and the change adds no runtime behaviour, so none of them needed
updating. Per the maintenance convention the shared docs were not edited; the
verification findings live in this document alone.
Brings main (chat-persistence: OpenCode pairing, protocol status, server
websocket/status changes) up to date on this branch so it can land without
conflict. Auto-merged with no conflicts; no comment or intent from either side
was dropped. Re-ran build, vet, gofmt and the full test suite after the merge -
all pass.
The harness resumes a session when a background command finishes, so "tell me
when this run is done" needs one command that blocks and exits rather than a
polling script.
- `pipelines wait <run-id> [run-id ...]` resolves every id up front (an unknown
run is a fast client error), then polls each run to a terminal status -
`succeeded`, `failed`, `canceled` or `interrupted`, blocking through a run
parked on a human decision - and prints one line per run as it finishes with
id, status and outcome, stage and duration.
- A finished-but-unsuccessful run is still a finished run: it is reported and
the command exits 0. The exit is non-zero only for a client-side failure: an
unknown id, a connection that cannot be established, or `--timeout` expiring
while a run is still active. A timeout reports the still-active runs,
changes nothing, and is never treated as a run's outcome.
- Reuses the existing `run --wait` polling machinery: the per-second `get_run`
reattachment is factored into `awaitRuns`, used by `finishRun` too. No
subscription or new protocol message. `--url`/`--timeout` follow the existing
client conventions; `--timeout` is the overall client limit (default 0).
- Read-only: sends only `get_run`, resolves no workspace, is not refused by the
workspace guard and writes nothing. `--json` prints the final run envelope
(one envelope for one id, an array for several).
- `commands.go` and `help.go` add it to the usage inventory and EXECUTE help.
Tests: `wait_test.go` (line format, batch reporting, wait-until-terminal,
unknown id, timeout leaves the run active, `--json` shape) and
`wait_command_test.go` (real CLI against the real websocket server and store).
Packaged assets checked: no packaged template changes. No authoring skill
reference file is added, so `internal/author/install.go`'s managed inventory
needs no change. `internal/author/skill/references/operations.md` (the
"inspect results first" run-operations list) and `docs/cli.md` (the scripted-runs
`--wait` paragraph and the CLI/TUI capability-map row) are now stale and are
recorded - not edited - in `docs/notes/wait-command.md` for the `docs-fold`
writer. `SKILL.md` stays a task-directed index; no shared document is edited
here.
No protocol, server, store, TUI or Android change; no new dependency; no run
started. Committed locally only, not pushed or deployed.
Brings main (78725e9, "bottom-strip": the Android detail and visit selectors
moved to a bottom strip, with its docs/notes/bottom-selector-strip.md) into this
branch on top of the chat-persistence commit. The two sides touch disjoint files
- main changes android/ and its own note, this branch changes
cmd/pipelines-server, internal/opencode, internal/protocol, internal/server and
docs/notes/chat-persistence.md - so the merge applied with no conflict and no
resolution was needed. Repository checks after the merge: go build ./...,
go vet ./... and gofmt -l . clean; go test ./internal/... ./cmd/... green.
Brokered chat accepted an operator-supplied endpoint (-opencode-endpoint /
PIPELINES_OPENCODE_ENDPOINT) but failed closed against the operator's running
V2 service: that API authenticates every request with HTTP Basic auth (fixed
user "opencode" plus a password), the broker had no credential, so the health
probe answered 401 and startup logged "OpenCode endpoint ... is unreachable or
is not an OpenCode service", disabling chat entirely.
Established from the installed binary (opencode v2.0.20), not from docs:
`opencode --help` advertises `api`, `pair`, `serve`, `service` and `auth`;
`GET /api/info` is unauthenticated-401 with www-authenticate Basic realm
"Secure Area"; Basic auth user `opencode` with the password from
~/.local/state/opencode/service.json answers 200; `POST /api/pair` returns a
code and `GET /auth/connect/{code}` returns a token that is then accepted as
the Basic password.
- internal/opencode/pair.go (new): PairEndpoint does the pair exchange over the
shared nativeRequest transport (same auth, bounds and JSON checks);
ReadServiceCredential reads the operator's local service password under the
private-file rule; OpenEndpointAttached resolves the credential in precedence
order - explicit password file, a paired token stored by an earlier run, then
a fresh pairing bootstrapped by the local service credential - stores the
token owner-only and re-pairs once when a stored token is refused (401).
- internal/opencode/endpoint.go: OpenEndpoint wraps probeEndpoint, which returns
the connection even on failure; Connection.unauthorized (set on HTTP 401 by
the request paths, cleared per probe) distinguishes an authentication refusal
from any other refusal.
- cmd/pipelines-server/main.go: the endpoint attach uses OpenEndpointAttached
with the paired-credential file beside the pipeline database. An endpoint that
cannot be attached logs a line naming it and falls back to the server's own
OpenCode instance instead of leaving chat refused.
- internal/protocol/status.go, internal/server/websocket.go: get_status gains an
opencode object (health = endpoint | fallback | spawned | unavailable, plus
the endpoint url), the honest status evidence for the fallback. No credential
is ever placed there.
- Tests: internal/opencode/pair_test.go, internal/protocol/status_test.go and a
TestStatusReportsOpenCodeAttachment case in internal/server/status_test.go.
Repository checks: go build ./..., go vet ./... and gofmt -l . clean;
go test ./internal/... ./cmd/... green.
Packaged templates and skill references: the repository has no template tree
that mentions the OpenCode endpoint, and no packaged reference file is added, so
internal/author/install.go's managed inventory is unchanged. The packaged
authoring reference internal/author/skill/references/operations.md (the endpoint
paragraph around line 289, the "clear refusal and no fallback" wording and the
password-file/username-only credential story, and the missing opencode status
field) is now stale; per the maintenance convention the item does not edit the
shared document and instead records the stale points, with the exact wording
they should take, in docs/notes/chat-persistence.md for the docs-fold writer.