Commit Graph

218 Commits

Author SHA1 Message Date
alan 476ecc781c Merge main into lane-srv3: combine the review-loop control change with main's notification and chat work
Keeps this branch's advisory review edge, bounded blocked_retryable implementer
edge and their tests alongside main's run-attention/ntfy notification work, the
split of the Android chat conversation screen, and the retention/history changes.
No conflicts: the two sides touch disjoint files.
2026-10-17 17:07:17 +01:00
alan e70c94e8dd control: make advisory review findings non-blocking and bound retryable blocks
Cut the review loop's repeat cost and make a blocked stage actionable, at the
definition level only, with the runner's existing visit counting and caps.

The published maintenance, quick and focused pipelines gain a reviewer
`advisory -> next stage` edge for non-blocking notes, so an advisory-only review
continues the run instead of buying another implementer visit; `rejected ->
implementer` and its unchanged {"max_visits":3,"on":["rejected"]} limit keep a
must-fix finding looping and still terminate. The implementer gains
blocked_retryable -> implementer with {"max_visits":5,"on":["blocked_retryable"]}
for a transient environment/tooling/device problem a fresh attempt could
survive, while blocked -> #failure stays terminal. The cap is at least the
reviewer's rejection budget so the implementer's own pre-execution cap cannot
preempt the reviewer's rejected control.

No production Go code changed. New tests in internal/server/review_contract_test.go
cover advisory-only never revisiting the implementer, must-fix still looping to
the reviewer limit, the implementer cap not preempting the reviewer, retryable
blocks bounded then failing closed, a retry that recovers, and a terminal block
failing immediately; concurrency/control/human tests share the new submitRunner
and startRun seams.

Documentation checked: internal/author/skill/references/control.md and
docs/harnesses-and-control.md carry the new edges and the visit-cap rule;
no packaged template defines these pipelines (they are published immutable
versions), and docs/model-results.md needs no change because the {outcome,output}
result contract is unchanged. README and other shared docs deliberately untouched.

Verified: go build ./... and go test -count=1 ./... pass.

Residual limitation: the must-fix-vs-advisory split is carried by the prompt
contract, not a machine-readable marker, because the recorded findings have none;
a model that still returns rejected for advisory-only notes would still buy a
visit. All 18 recorded implementer blocked runs classify terminal, so the
blocked_retryable edge recovers 0 of them.
2026-10-17 17:06:51 +01:00
alan 65b0d87d85 Merge lane-app2: split the chat conversation screen into files by concern 2026-10-17 16:56:33 +01:00
alan 70270fa90e Split the chat conversation screen into files by concern
Move ui/chat/ChatScreen.kt (1864 lines) into ten files by concern with no
behaviour change: ChatScreen.kt keeps the destination and the shared chat
geometry tokens (84 lines); ChatListPane, ChatCreatePane, ChatOpenStrip,
ChatConversationPane, ChatTranscript, ChatComposer, ChatToolCalls,
ChatDiffCard and ChatApprovalCard take the session list, new-chat picker,
open-conversation strip, conversation header, transcript, composer, tool
chips and the cards.

Pure move: same package, same composable names and signatures, same call
graph. The only substantive edits are per-file imports and private->internal
widenings needed for the cross-file calls; review confirmed identical
declaration sets and an equal line multiset. :app:assembleDebug and the full
unit suite pass (545 tests, 0 failures, 0 skipped) and the built APK is
byte-identical (same sha256) to the published artifact.

Checked before committing:
- Packaged templates: this repository carries no packaged template tree, so
  nothing to update.
- Packaged authoring skill references (internal/author/skill/references/):
  none reference the chat UI internals; nothing to update.
- android/README.md still cites ChatScreen.kt inner declarations
  (ChatScreen.MessagePart, rememberElapsedMillis, ChatConversationPane) that
  this move relocated; left unedited for the single documentation writer.
2026-10-17 16:56:19 +01:00
alan 20ff5a47f5 Android: stand the destination pill down in an open chat conversation
Lands lane-app2's pill-standdown work: the floating destinations pill is hidden
while the Chat destination shows an open conversation and stays everywhere else,
with the bottom reserve tracking the drawn pill so content neither jumps nor
leaves a gap. Includes the lane's merge of main and its tests.
2026-10-17 16:27:51 +01:00
alan 1752351dbc Merge main into lane-app2: combine the pill standdown with main's run-title and conversation work
Brings main (c5b0de1) into the pill-standdown lane. Main added the whole-title
run view / two-line list rows (RunIdentity, RunTitlesTest) and the readable
conversation work (ChatFormat, ChatScreen, ChatStore, ChatTranscriptTest). Those
are disjoint from this lane's destination-pill change, so the Kotlin sources
auto-merged; only android/README.md conflicted, where both sides appended a new
dated section to the end of the item log.

Resolved android/README.md by keeping both intents: the lane's "Destination pill
stands down in an open conversation" section and main's "Run title readability"
section are both retained, in that order. No conflict marker remains and nothing
from either side was discarded.

Verified after resolving: gradle :app:testDebugUnitTest --offline --no-daemon ->
BUILD SUCCESSFUL, 60 suites / 545 tests / 0 failures / 0 errors / 0 skipped; and
gradle :app:assembleDebug --offline --no-daemon -> BUILD SUCCESSFUL.
2026-10-17 16:27:05 +01:00
alan 3e14baebd7 android: stand the destination pill down in an open chat conversation
The floating destinations pill was drawn over the bottom of every screen,
including an open chat, where it sat on the composer and the newest message
and competed with the send/stop controls. It now stands down while the Chat
destination shows an open conversation and stays everywhere else, unchanged.

- One rule: `destinationPillVisible(currentRoute, conversationOpen)` is false
  only for `chat` with an open conversation. `conversationOpen` is the new
  `AppViewModel.conversationOpen`, a distinctUntilChanged boolean derived from
  the same ChatStore the chat surface renders, so a background chat never hides
  the pill elsewhere and a streamed delta never recomposes the app shell.
- The space, not just the pill: `destinationPillReserve(pillVisible)` returns
  the named DESTINATION_PILL_RESERVE while drawn and 0.dp while hidden, so the
  content Column clears a drawn pill and leaves no empty band when it is gone,
  and no frame reserves a gap behind a hidden pill or draws one over content it
  does not clear. Keyboard-open and the IME padding are unchanged.
- Escapability untouched: the top-bar "Back to chats" arrow, ChatScreen's
  PredictiveBackHandler and SlidingPaneStack.onPopTo remain the way out.
- No other pill behaviour changed: destinations, selection indicator,
  morph-into-search and every other screen are as before.

Checked for staleness: none of the packaged templates or the packaged authoring
skill references (internal/author/skill/references) mention the destination pill,
so no template or reference needed updating for this Android-only change.

Tests: PipelinesNavTest gains thePillStandsDownOnlyWhileAConversationIsOpen and
theReserveTracksTheDrawnPillSoContentNeitherJumpsNorLeavesAGap.
2026-10-17 16:25:22 +01:00
alan 2ffe87cbba Merge branch 'main' into lane-srv3 2026-10-17 16:20:08 +01:00
alan 4908452a74 retention: report removed runs and follow a symlinked artifacts root
Fix two honesty gaps in run-history retention that the implementer stage
left uncommitted on top of 14175eb:

- Populate RemovedRuns, RemovedRunCount, RemovedArtifactFiles/Bytes and
  Applied right after the row transaction commits, before staging cleanup.
  A cleanup failure must not report a successful row/artifact removal as
  zero removed, and staging leftovers are excluded from SpaceReclaimedBytes.
  A failed VACUUM after removal now reports the artifact bytes actually
  removed while claiming no database pages.
- Stage artifacts through os.Stat instead of os.Lstat so a symlinked
  artifacts root is followed: the report sized that directory, so apply
  removes through it too instead of counting bytes it never deleted.

Tests cover post-commit staging-cleanup failure reporting, staging through a
symlinked artifacts root (including no staging directory left in the link
target), and an honest reclaim failure after removal.

Checked documentation surfaces:
- docs/cli.md: measured example refreshed with the current before/apply/after
  output and the symlink/staging/VACUUM reporting described accurately.
- README.md: retention prose (explicit, never automatic, protected runs,
  artifacts go with the run) is unchanged and still correct.
- internal/author/skill/references/operations.md: operator-only retention
  summary describes the same behaviour; no user-facing surface changed, so
  no reference update was needed.
- Packaged templates: retention is a CLI/store capability with no template
  change, so nothing to update. internal/author/install.go inventory
  unchanged (no reference added or renamed).

Verification: gofmt clean on the touched Go files, git diff --check clean,
go vet ./internal/pipeline clean, and go test ./internal/pipeline -run
'TestRetention' -count=1 passing.
2026-10-17 16:19:39 +01:00
alan 890d267c71 run attention: publish to ntfy and surface what needs the operator
Nothing told the operator that a run was waiting for a person or had failed; they
found out by going looking. A run that needs attention now reaches the ntfy they
already run, and the app answers "what needs me now" in one live, ordered surface.

Server (smallest change, reusing the existing publisher):
- internal/server/notify.go adds notifyRun, called from finishRunState (failed)
  and when a run parks on a human (runner.go runLoop). It publishes to the same
  already-configured `system` destination through the unchanged stage.PublishNtfy,
  so there is no second publisher, topic or service and the token handling is the
  stage's own. runAttentionEvent maps only waiting and failed; queued, running,
  succeeded, canceled and interrupted publish nothing.
- No storms: runner.attentionSent records sequence:event per run before publishing,
  so a run that stays waiting is never republished on a re-request or restart, and
  a stage notify policy that already covers the same event marks it first so the
  run-level default is suppressed. The set is dropped when the run is terminal. A
  delivery failure is logged, never fails the run, and is not retried.
- The payload names the run and pipeline and carries a click action
  pipelines://run/<id> (validated: absolute URL, no userinfo, no fragment, no
  credentials). PublishNtfy gained the optional click parameter; existing callers
  pass "".

App:
- AndroidManifest/MainActivity declare the pipelines://run/<id> deep link
  (singleTop); runIdFromDeepLink parses it and PipelinesApp opens that run once,
  clearing the link. It opens a run; it starts nothing.
- ui/Attention.kt is the pure model (status -> Decision/Failed/Finished or
  nothing, ordered by kind then newest-first) and ui/components/AttentionSurface.kt
  is the floating indicator plus bottom sheet. It is derived from the same run
  events the server already pushes, so an entry appears with no refresh and clears
  when resolved; a finished run clears once looked at, and any entry can be
  dismissed, persisted in SettingsRepository. The existing destinations, pill and
  bottom strip are untouched and no competing navigation surface is added.

Checked before committing:
- Packaged authoring skill references: internal/author/skill/references/
  notifications.md documents the automatic run-attention notifications and the
  app surface. The only packaged "template" carrying notify is that reference; no
  pipeline definition template exists to update and install.go's managed file list
  is unchanged (notifications.md already existed).
- Repository guidelines: docs/ntfy.md gains an "Automatic run-attention
  notifications" section and no longer claims "No block means no notifications";
  the top-level README phone-notifications note now says a waiting/failed run
  notifies automatically; android/README.md gains the dated feature section and
  supersedes the previous section's note that the attention surface was absent.
- docker.md, install docs and the CLI/TUI docs describe mechanisms this change
  does not alter; left as they are.

Tests: go test ./internal/server/... ./internal/stage/... ./internal/author/...
all ok; notify_test.go covers the event mapping and the real HTTP delivery
(destination, topic, click, no duplicate). Android :app:testDebugUnitTest ->
BUILD SUCCESSFUL, 58 suites / 531 tests / 0 failures (new AttentionTest, 13 cases,
covering ordering, appearing from a push, clearing on resolution, dismissal, the
empty case, persistence and the deep link). Device screenshots and the phone's own
notification are visual review's per the brief's device policy.

Scope: android/ plus the smallest server change; no new dependency, no run started
from the app, no installer or Docker change.
2026-10-17 16:11:57 +01:00
alan c5b0de15ba Merge lane-chat4: keep run-title readability and the waiting human decision
Merge lane-chat4 (d13f359, "make a run's title readable: whole in the run
view, two lines in the list") into main (cd87982, "answer a run's waiting
human decision from the phone"). Both intents are kept.

Conflict resolution:
- android/README.md (the only conflicted path): kept both sections, HEAD's
  "Answer a waiting human decision from the phone" first and lane-chat4's
  "Run title readability" second, with nothing removed. Each heading appears
  exactly once.
- StageDetailPane.kt and RunDetailScreen.kt were changed on both sides and
  auto-merged: the staged tree carries the incoming title line budgets plus
  the local DecisionPrompt wiring (the stage pane surfaces a decision only
  for its own stage; the run detail surfaces it above the tabs).
- The remaining incoming files (RunIdentity.kt, RunHistoryScreen.kt,
  RunIdentityTest.kt, RunTitlesTest.kt) and the local files are one-sided and
  taken whole. The staged tree differs from HEAD by exactly the incoming
  diff and from MERGE_HEAD by exactly the local diff, so no side was dropped
  or duplicated.

Checks (JDK 17, ANDROID_HOME=/Users/alan/Library/Android/sdk, Gradle 9.7.1
--no-daemon --offline):
- gradle :app:testDebugUnitTest :app:assembleDebug -> BUILD SUCCESSFUL.
- 59 result XMLs aggregate to 530 tests, 0 failures, 0 errors, 0 skipped;
  RunTitlesTest 4/0 and RunIdentityTest 6/0.
No conflict markers remain.

Staleness check: the incoming work is android/-only. android/README.md is
the topic doc and now carries both sections; no packaged template, the repo
README, the other topic docs, or the packaged authoring skill references
describe this run-title UI, so none needed updating (the delivery reference's
Android build/publish example is unchanged and still accurate).
2026-10-17 16:00:11 +01:00
alan d13f359e7b android: show the run title whole in the run view, two lines in the list
A run's title is derived from its prompt, so it is often long. Give it the
room it needs where the operator reads the run, and a deliberate clamp where
it is one of many. Android only; no new dependency (the declared
material-icons-extended only), no Pipelines server/Go/installer/Docker file
touched, and no run started from the app.

- Run view shows the whole title. The run-summary title line states its
  intent with RUN_VIEW_TITLE_LINES (Int.MAX_VALUE) and TextOverflow.Clip, so
  it wraps over as many lines as it needs and is never ellipsised; the
  fixed-height M3 app-bar copy stays a compact one-line label.
- Runs-list rows grow, then clamp. RunRow's title went from maxLines = 1 to
  RUN_ROW_TITLE_LINES (2): a longer title takes a second line before it
  ellipsises, with the glyph, status chip and meta line still aligned and the
  selection highlight and tap target unchanged.
- Stage-pane context line. StageDetailPane's run-label line went from
  maxLines = 1 to STAGE_RUN_LABEL_LINES (2); the pane is compact context, not
  where the whole title lives.
- Named budgets. ui/RunIdentity.kt holds the three budgets so the choice is
  deliberate at each call site. RunTitlesTest (4 cases) pins them and asserts
  a clamping place is never more generous than the run view; RunIdentityTest
  gained a case that runLabel/runIdentity never shorten a long title.

Checked for stale copies: android/README.md gained a dated section for this
change (its existing "Run title beside the pipeline name" section still holds,
it just did not describe line budgets). The top-level README and docs/ do not
document the app's run-title rendering, and the packaged templates and
internal/author/skill/references/ packaged skill describe Pipelines authoring
and Android APK delivery, not this UI, so none of them needed updating.

Evidence (JDK 17, Gradle 9.7.1 --offline --no-daemon): :app:testDebugUnitTest
BUILD SUCCESSFUL, 57 classes / 513 tests / 0 failures / 0 errors / 0 skipped
(RunTitlesTest 4/0, RunIdentityTest 6/0); :app:assembleDebug BUILD SUCCESSFUL,
app-debug.apk 18,486,624 bytes sha256 2b23762b54f0..., published as this run's
pipelines-debug-wip-2bc00a2.apk and served at
http://10.0.0.75:8080/artifacts/278/4/pipelines-debug-wip-2bc00a2.apk.
2026-10-17 15:49:55 +01:00
alan cd87982a63 Merge lane-app2: keep the lane's reviewed work
Combine the reviewed Android work already on main (conversation reading:
markdown, collapsed reasoning, one identity) with the incoming lane's
"answer a waiting human decision from the phone" change (the waiting
run/step sync, HumanDecision/DecisionPrompt, the decide_run envelope and
the waiting RunState) over merge base d48175a.

The only conflicted file, android/README.md, now carries both sections
exactly once ("Conversation reading: markdown, collapsed reasoning, one
identity" and "Answer a waiting human decision from the phone") with no
bullet or paragraph dropped. The auto-merged Kotlin tree carries both
features; no conflict markers, duplicated blocks or dead code remain. The
resolution also restored the blank line between the two README sections.

Verified on the merged tree (JDK 17 from Homebrew openjdk@17,
ANDROID_HOME=/Users/alan/Library/Android/sdk, offline, no daemon):
- gradle :app:testDebugUnitTest --rerun-tasks -> BUILD SUCCESSFUL; JUnit
  XMLs total 58 suites / 525 tests / 0 failures / 0 errors / 0 skipped.
- gradle :app:assembleDebug -> BUILD SUCCESSFUL;
  app/build/outputs/apk/debug/app-debug.apk present (18,519,392 bytes).

Docs check: android/README.md records the resolved change. No packaged
template, README/topic doc or packaged authoring skill reference describes
the Android decision surface or changed as a result, so nothing there
needed updating. Nothing was deliberately left uncommitted.
2026-10-17 15:47:04 +01:00
alan 14175eba70 retention: explicit run-history and artifact retention
Add `pipelines retention report` (strictly read-only) and
`pipelines retention apply` (explicit, approval-gated removal) with an age
and/or count policy, protected-run rules, atomic single-transaction removal
and honest database space reclaim. Nothing prunes automatically.
2026-10-17 15:45:46 +01:00
alan f782c51c18 android: answer a run's waiting human decision from the phone
A human stage parks its run on a person, and the terminal client could answer
it while the app had no decide request at all. This adds the missing piece so a
waiting run is answerable from the phone.

Protocol/repo:
- PipelinesRepository.decideRun sends the same `decide_run` request the CLI and
  TUI build: stage (optional; the server infers it), option, optional feedback,
  with the exact wire names internal/protocol/message.go declares. Message gains
  the stage/option/feedback fields; no second mechanism is invented.
- A waiting run/step now forces the existing push-driven full get_run
  (runDetailNeedsFullSync), so the waiting step's recorded options/prompt
  surface live with no refresh and no server field added.
- RunState.Waiting (label "waiting", FrontHand glyph, violet palette entry)
  makes the waiting state honest in the list and summary.

UI:
- DecisionPrompt is the one shared surface: a "Waiting for your decision" card
  with a deliberate Decide action, plus the sheet showing the run and waiting
  stage, the author's instructions, every option as written with the label it
  routes to, an optional feedback field, and a Confirm decision button that is
  disabled until an option is chosen. It sits above the run detail's tabs and at
  the top of the waiting stage's pane, reachable from where the operator already
  is.
- Answering applies the returned run detail immediately, so the new stage shows
  without a manual refresh. A refusal keeps the sheet open with the server's own
  message verbatim and silently re-reads the run rather than faking success.
- Pure helpers pendingDecision, DecisionOption, DecisionDraft (the confirm gate)
  and decisionRefusalMessage; Tests: HumanDecisionTest and DecisionTest (13 new)
  plus waiting cases in RunEventsTest and RunStatusTest.

Scope: android/ only. No server/Go/installer/Docker change, no new dependency
(the glyph is from the already-declared material-icons-extended), no run started
from the app, no adb or device use.

Reflected where it belongs: android/README.md gained the dated feature section
for this change. Checked and needing no update: the packaged pipeline templates
(the change touches no pipeline definition), the repository's top-level README
and docs/ topic docs (none enumerates the app's operations or the decide
protocol; the TUI/CLI wording they carry is unchanged), and the packaged
authoring skill references (the decide protocol is unchanged and already
documented; no reference describes this app surface).
2026-10-17 15:38:58 +01:00
alan bd6a89d914 Merge lane-chat4: keep the lane's reviewed work
Combine the reviewed chat work already on main (session model in the
header, agent mirroring, chatHeaderMeta, tagged-label intent) with the
incoming lane's "make the conversation readable" change (markdown/part
rendering, collapsed reasoning, one conversation identity,
openChatsBeside, ChatTranscriptTest) over merge base 5ac196c.

Both intents survive in every conflicted file: android/README.md,
ChatFormat.kt, ChatScreen.kt (session header and conversation header),
ChatStore.kt and the new ChatTranscriptTest.kt. No conflict markers or
duplicated blocks remain.

Verified on the merged tree (JDK 17, ANDROID_HOME=/Users/alan/Library/Android/sdk,
offline, no daemon, --rerun-tasks):
- gradle :app:assembleDebug -> BUILD SUCCESSFUL
- gradle :app:testDebugUnitTest -> BUILD SUCCESSFUL; JUnit XMLs total
  512 tests, 0 failures, 0 errors, 0 skipped (7 in ChatTranscriptTest).

Docs check: android/README.md already records the resolved change, and no
packaged template, README/topic doc or packaged authoring skill reference
describes the Android chat surface, so nothing there needed updating.
2026-10-17 15:32:00 +01:00
alan 2bc00a2a94 android: make the conversation readable — markdown, collapsed reasoning, one identity
Fix the three reading problems in the chat conversation view. Android only;
no new dependency (the declared material-icons-extended only); no server,
Go, installer or Docker file touched and no run started from the app.

- Markdown reaches the transcript. Assistant text already went through
  MarkdownText inside a private composable; name the decision as the pure
  ChatFormat.partRendering(part) (MARKDOWN/REASONING/PLAIN/HIDDEN) and have
  MessagePart consume it. Text outside the renderer's documented subset and
  unknown part kinds still render as their own text (PLAIN); blank parts
  render nothing (HIDDEN).
- Reasoning collapsed by default. ReasoningBlock is now one compact, muted
  line per part (icon, label, chevron) that expands on tap to the muted
  text. Expansion is hoisted to the conversation pane as the pure
  ReasoningExpansion set keyed per stable part key, so a part keeps its
  state across scroll/disposal and every part starts collapsed in a newly
  opened chat. A running turn's streaming reasoning stays collapsed under a
  live "Thinking…" label, signalling progress without competing with the
  answer.
- One identity in the header. ChatFormat.conversationHeader(thread) builds
  the app-bar title plus only context (labelled kind chip from the server
  tag, activity, directory, model); the app bar and the context line read
  the same value. openChatsBeside drops the active chat from the open-chat
  strip so its title is shown once; every other open chat stays one tap
  away and the session list is unchanged.

Tests: new ChatTranscriptTest (7 cases) plus the existing ChatFormatTest —
the markdown subset reaches the renderer from a ChatPart, text outside the
subset and an unknown kind still render, reasoning starts collapsed and
toggles per part, the header names the session once, and the strip offers
only the other open chats.

Checked, and none needs an update: the packaged templates carry no Android
chat surface; the repository guidelines (README, docs/) document the server
and CLI, whose behaviour is unchanged — docs/cli.md's note that Android
rendering of the tag is out of scope for the server change still holds; and
the packaged authoring skill references (internal/author/skill/references/)
describe delivery/verification generally, none of which this UI change
alters. android/README.md records the new behaviour.

Verified: `gradle :app:testDebugUnitTest :app:assembleDebug --no-daemon
--offline --rerun-tasks` → BUILD SUCCESSFUL; JUnit XMLs total 508 tests, 0
failures, 0 errors, 0 skipped. app-debug.apk sha256
0df6899429a8f5632ec568340dddb63a5617b1a04af19f52c6ebb793470a0b23.
2026-10-17 15:14:52 +01:00
alan d48175a4d9 Merge lane-app2: keep the lane's reviewed work 2026-10-17 15:03:22 +01:00
alan 5feebe3684 Merge branch 'main' into lane-app2 2026-10-17 15:03:14 +01:00
alan 9b67e55d70 chat: name the session's model in the conversation header
The conversation header showed only the thread title, so inside a chat there
was nothing saying which model was answering. It now renders a second line
from server-reported values only.

- ChatFormat.kt: add chatHeaderMeta(thread), joining the reported model, the
  session's kind tag and the directory with " · "; blank parts are omitted so
  no model is ever claimed when the server did not report one. Refactor
  sessionTagLabel to a tag-value overload so the list row and the header share
  one tag mapping.
- ChatStore.kt: ChatThread gains the tag field; sessionsLoaded and open fold
  the server's model/agent/tag into already-open threads, and ensureThread
  seeds them, so the header never shows a stale or missing model.
- ChatScreen.kt: the conversation top bar title becomes a two-line column with
  the meta line in the shared pipelinesText().meta role; the create flow states
  plainly that this server has no request for choosing a chat's model.
- No model chooser is shipped. The server forwards no model/agent on
  chat_prompt and exposes no model/agent catalogue, so shipping a picker would
  be a control that does nothing; android/README.md records the exact server
  change it would need.
- Tests: ChatFormatTest covers chatHeaderMeta (reported model/tag/directory,
  and never claiming an unreported model) and the shared tag mapping;
  ChatSessionManagementTest covers the open thread carrying the reported
  model/agent/tag and a list refresh folding a new model in.

Checked before committing:
- Packaged templates: none exist (the author package embeds only skill/SKILL.md
  and references/*.md; no *.tmpl/*.template in the tree) - nothing to update.
- Repository guidelines: android/README.md updated with the change and its
  evidence; the root README and docs/ describe the server and CLI, not the
  Android chat surface - no update needed.
- Packaged authoring skill references (internal/author/skill/references/): none
  describes the Android chat surface - no update needed.

android/ only, no new dependency beyond the declared material-icons-extended.
2026-10-17 15:03:00 +01:00
alan 5ac196c68d Merge lane-srv3: keep the lane's reviewed work 2026-10-17 14:57:52 +01:00
alan b2e920a150 Merge branch 'main' into lane-srv3 2026-10-17 14:57:28 +01:00
alan 7b72b8f20f stage: retry pre-admission harness reach failures and widen repair deadline
Treat a failure to reach the harness before any prompt or tool call is
admitted (connecting or creating the session) as a distinct retryable
reach failure, so a transport blip at the first stage no longer ends a
mutating run; keep post-admission readback/poll/agent failures retried
only on an explicit read-only stage and never replay admitted tool work.
Preserve the true cause when the context is already done (join ctx.Err
with the typed transport error) and report a sanitized unknown provider
error name/status instead of a blanket summary.

Make the isolated format-repair deadline proportional to the stage
timeout (floored, capped and clamped to remaining minus a margin) so a
slow-but-repairable result is recovered without ever extending the stage
deadline; the bounded ladder, value guard, deny-all formatter session,
cumulative usage accounting and no-tool-replay rule are unchanged.

Update docs/model-results.md, docs/pipeline-performance-review.md and the
packaged skill references; add stage, opencode and server fixtures.
2026-10-17 14:51:09 +01:00
alan ff1b6f5415 Merge lane-app2: keep the lane's reviewed work 2026-10-17 14:50:52 +01:00
alan 8e6cb39284 Merge branch 'main' into lane-app2 2026-10-17 14:50:49 +01:00
alan 355fe4e908 chat: search the session list and group it by directory
With a day's sessions the list was a flat, unsearchable wall in recency
order, so the chat the operator wanted was the one that could not be
found, and sessions of one repository were scattered through it.

Narrow the list as the operator types and keep same-repository chats
together, using the control and empty-state patterns the other lists
already use:

- ChatListFilter.kt adds the one pure derivation: sessionMatchesQuery /
  filterChatSessions match a case-insensitive substring over a session's
  title and directory, a blank query narrows nothing, and the survivors
  keep their incoming (recency) order. groupChatSessionsByDirectory groups
  the narrowed list by directory, each group keeping that order and the
  groups ordered by their first (most recent) session, so the top still
  leads with the newest activity.
- ChatState.sessionQuery (set through ChatStore.searchSessions /
  AppViewModel.setChatSessionQuery) is a display narrowing only: the
  server's list, open conversations and the activity marks are untouched.
  filteredSessions is visibleSessions narrowed by the query.
- ChatListPane renders the existing FilterMenu with one OutlinedTextField
  and a Clear search reset (the pipelines/runs filter pattern), shows a
  directory heading per group only when more than one directory is
  present, and renders the shared EmptyState ("No chats match ...") with
  a Clear search action when nothing matches. The trailing New chat
  action is never hidden while the list is narrowed, and every row still
  shows its directory.

Tests (ChatListFilterTest, 9 cases): the match rule over title and
directory, that a narrowing preserves the recency order, grouping by
directory (order by the first session, order kept inside a group, a
single directory yields one group, a blank directory groups too), and
through the store that searching narrows filteredSessions, clearing
restores the full list, the server's list is untouched and a filtered
session still reports its activity mark.

Checked before commit: android/README.md was updated in this change with
the behaviour, tests and evidence. The packaged authoring skill references
(internal/author/skill/references/) document the Pipelines server, its
chat_* protocol surface and authoring, none of which changed - this is a
client-side narrowing over the already-listed sessions - so none needed
updating, and the internal/author/install.go managed reference inventory
is unchanged. No repository template or root/topic doc describes the
Android session list, so none was stale.

android/ only; no dependency added beyond the already-declared
material-icons-extended; no run is started from the app.
2026-10-17 14:50:30 +01:00
alan 7c31a979b5 Merge lane-app2: keep the lane's reviewed work 2026-10-17 14:40:51 +01:00
alan bb486acc11 chat: mark new activity in the session list
With several operator sessions the list gave no sign of where a reply
arrived: an idle chat and one streaming a reply right now looked the same,
so the operator lost the conversation they were in.

Add a per-session read state that the session list derives from data it
already receives, and render it as a three-state activity badge:

- ChatSeenState (ui/chat/ChatSeen.kt) keeps a per-session recency watermark
  (the newest updated_at the operator has read) plus the ids that moved on
  while the app was open. It is persisted as one opaque JSON preference
  (SettingsRepository chat_seen, observed by AppViewModel.observeChatSeen),
  the same way ChatSessionOverrides is, so the marks survive a restart and
  not only a reconnect.
- ChatState.isUnseen marks a background session that carried a live mark
  (a pushed chat_event/permission frame) or, if never opened here, is newer
  than its stored watermark; first sight of a session is seeded to its
  current recency so a pre-existing chat is not reported as new. Opening,
  activating and closing a conversation reads it and clears the mark;
  history for the active chat advances the watermark to the newest server
  message. No server request is added.
- ChatFormat.sessionActivity(running, unseen) is the one pure derivation
  (streaming outranks finished-unseen, which outranks idle) and
  SessionActivityBadge renders it as Streaming/New/Open beside the
  unchanged kind chip and directory line. Most-recently-used order is
  untouched.

Tests (ChatActivityTest): unseen is marked, opening clears it including in
the persisted state, the derivation distinguishes streaming/finished-unseen/
idle, and the seen state survives an encode/decode into a fresh store.

Checked before commit: android/README.md was updated in this change with the
behaviour, tests and evidence. The packaged authoring skill references
(internal/author/skill/references/) describe the Pipelines server and its
chat_* protocol surface, neither of which changed - this is a client-side
derivation over existing frames - so none needed updating, and the
internal/author/install.go managed reference inventory is unchanged. No
repository template or root/topic doc describes the Android session list,
so none was stale.

android/ only; no dependency added; no run is started from the app.
2026-10-17 14:40:02 +01:00
alan 5adc961f88 Merge lane-chat3: keep the lane's reviewed work 2026-10-17 13:36:49 +01:00
alan 829d6d3551 chat: attach files to a message from the composer
Let the operator attach one or more files to the next chat message and send
them with it. The platform multi-document picker returns content URIs; the app
resolves only each file's name, size and MIME (confirming it can be opened) and
holds the attachments per chat, exactly like the draft. Nothing is read or
transmitted until the message is sent.

- Composer: an attach action, a strip of removable chips (image thumbnail or
  file glyph, name, size, remove), and a send that is blocked while any
  attachment is flagged.
- Wire: one shared builder, ChatProtocol.promptRequest(sessionId, text, files),
  carries the attached URIs on the chat_prompt frame, in attachment order and
  omitted for a text-only prompt so that shape is unchanged.
  PipelinesRepository.chatPrompt takes the same list.
- Transcript: a sent turn carries each attachment as a ChatProtocol.PART_FILE
  part, drawn through the existing UserParts -> FilePart display path rather
  than a second rendering.
- Honest failures: an unreadable or over-24-MiB file is attached with its reason
  and blocks the send; a server rejection takes the optimistic bubble back out
  and returns the files flagged with the server's message. Attaching never
  transmits on its own, and attachments clear once the message is sent.

Review follow-ups in the same slice: the composer now uses ui/Format.kt's
humanBytes instead of a duplicate formatter; optimistic user-turn ids come from a
monotonic counter so removing a rejected turn cannot re-mint a live key;
restoreAttachments keeps a file attached between send and rejection; the
thumbnail decode catches Exception rather than Throwable.

Checks made for this commit:
- The change is android/ only; the server, its Go source, the installer and the
  Docker files are untouched, no run is started from the app, and no dependency
  was added beyond the already-declared material-icons-extended.
- Packaged authoring skill references (internal/author/skill/references/): no
  update needed. operations.md documents the brokered chat server, which this
  change does not alter; the server still stores user turns as text and ignores
  the prompt's files, so that reference stays accurate.
- Packaged templates (internal/tui, internal/server) and the root README/topic
  docs: no update needed; none describes the Android chat composer. The
  Android-facing documentation lives in android/README.md, which this change
  updates with the attachment slice, its known server-side gap and its tests.

Tests: ChatAttachmentTest (5 cases), ChatAttachmentStateTest (5 cases) and a new
ChatProtocolTest case cover building the request with attachments (and omitting
them for a text-only prompt), removing one, the unreadable and oversized paths,
which files travel with the prompt, the optimistic turn's file parts, clearing
after send, and the rejected path restoring the files flagged. Verified by the
review stage with gradle --offline --no-daemon :app:testDebugUnitTest
:app:assembleDebug -> BUILD SUCCESSFUL, 487 tests / 0 failures / 0 errors /
0 skipped.
2026-10-17 13:35:56 +01:00
alan d1a859ec7d Merge lane-chat2: keep the lane's reviewed work 2026-10-17 12:46:18 +01:00
alan 664e563fca chat: open a conversation at its newest message and follow it
Opening a conversation used to start at the top, so the operator first had to
scroll down past everything already said to find the current turn. The
transcript now opens at its newest message, follows it while the operator reads
the newest part, and offers a jump-to-latest affordance when they have
deliberately scrolled up instead.

- Opening at the newest message. The transcript's list state is created the
  moment the conversation first has content, with its first visible item set by
  chatFirstScroll (ui/chat/ChatScroll.kt): a position the operator left is
  restored and clamped with the app's shared rule (restoredScrollAnchor), and
  every other conversation starts at its newest item. "A position of their own"
  is explicit now: ChatThread.scroll is nullable, null meaning the operator has
  never left a position here, so a chat left at the very top
  (ChatScrollPosition(0, 0)) is restored rather than mistaken for "new", and a
  list state that never held content saves nothing. Placement is unanimated, on
  the list's first measure, and goes through the one scroll path below.
- One scroll path, changed deliberately. The existing follow scroll, the app
  bar's approval jump and the new jump-to-latest all go through
  LazyListState.scrollToEnd(itemCount, animated); when the newest item sits
  entirely below the fold it is brought in first, and any part still below is
  then closed by exactly that distance (closeBottomGap). An item already partly
  visible is only gap-closed, so following a growing stream never bounces. The
  distance is measured against the transcript's content count
  (chatBottomDistancePx), not the layout's stale count, so an item appended
  ahead of the measure that shows it actually arrives in view.
- Follow while reading the newest part. Only the operator's own drag changes
  following (a DragInteraction.Start stops it, a settling Stop/Cancel resumes it
  at or within the threshold, chatFollowsAt); while it holds, an arriving
  message, a streamed delta, a tool chip, a freshly arrived approval card, a
  grown composer or the appearing keyboard re-follows smoothly. The item count
  is read at use time (rememberUpdatedState) so a captured count cannot go
  stale. Programmatic scrolls never touch the list's interactionSource.
- Threshold. CHAT_FOLLOW_THRESHOLD_DP (ui/theme/Dimens.kt) is 32dp: about one
  comfortable line of text.
- Jump to latest. A small Material 3 SmallFloatingActionButton (the
  already-declared KeyboardArrowDown icon, on the shared gutter token) is offered
  only while the view is not following and there is genuinely something below the
  fold (chatShowJumpToLatest), hidden at the bottom or for an empty transcript;
  tapping it re-engages the follow. A pending permission/approval is still
  brought into view as the existing code did - it is the transcript's last item,
  so the follow brings it in while the operator reads the newest part, and the
  app bar's approval action still jumps straight to it.

android/ only: no dependency added beyond the already-declared
material-icons-extended, no run is started from the app, and no Pipelines
server, Go source, installer or Docker file is touched.

Checks: the packaged authoring skill references need no update - they document
the Pipelines server's own contract, not the Android client, and this change is
app-side only, so nothing in them became stale. There are no packaged templates
in this repository. The repository's topic doc for the client, android/README.md,
is updated in this change with the flow, the threshold, the one scroll path and
what remains unverified on a device.

Verified by the review stage on this tree: gradle --no-daemon
:app:testDebugUnitTest :app:assembleDebug -> BUILD SUCCESSFUL, 50 suites / 458
tests / 0 failures / 0 errors / 0 skipped (including the new ChatScrollTest, 11
cases), and the published APK matches the freshly built app-debug.apk
byte-for-byte.
2026-10-17 12:45:37 +01:00
alan 8644ff98a3 Merge lane-chat2: combine operator chat session management with live run updates
Both sides are reviewed work and both are kept:

- android/app/.../ui/AppViewModel.kt: HEAD's live-run push wiring
  (RunStreamState/_runStream, combine(connectionState, settings.workspace),
  subscribeRuns/streamDown/resync, applyRunEvent, scheduleRunsResync/
  scheduleRunDetailSync, observeRunEvents) together with lane-chat2's chat
  management (ChatStore overrides, observeChatOverrides, refreshChatDirectories,
  startNewChat/selectChatDirectory/cancelNewChat/createNewChat,
  renameChat/removeChat/undoRemoveChat). The only textual conflict was the
  import list; combine (HEAD) plus map and ui.chat.ChatSessionOverrides (lane)
  are all kept and all used. No duplicated definitions.
- android/README.md: HEAD's "Live run updates from the socket" section and
  lane-chat2's "Operator chat sessions: choose the directory, list only your
  own" section are both present once, in file order.
- The rest of lane-chat2's chat files (ChatDirectories.kt, ChatOverrides.kt,
  ChatStore.kt, ChatScreen.kt, ChatFormat.kt, protocol Chat/Message, repositories,
  tests) merge cleanly on top of HEAD's work.

Documentation check: android/README.md is updated by this merge and its new
section is consistent with HEAD's. docs/cli.md and
internal/author/skill/references/operations.md already describe the server's
chat_sessions/chat_create/chat_directories surface this client builds on, and
the authoring skill (SKILL.md, references/) contains no Android-client behaviour
to stale, so nothing there needed changing and no packaged reference or
inventory entry was touched. No server, installer or template change is part of
this merge.

Checks (android/, Gradle 8.11.1, --offline):
- gradle :app:testDebugUnitTest --offline --rerun-tasks -> BUILD SUCCESSFUL;
  test-results report 463 tests, 0 failures, 0 errors across 50 suites
  (including ChatDirectoriesTest and ChatSessionManagementTest).
- gradle :app:assembleDebug --offline -> BUILD SUCCESSFUL (debug APK built).

Not verified here: on-device picker/rendering, which the visual-review stage owns.
2026-10-17 11:45:41 +01:00
alan 311a0156d6 chat: choose a new chat's directory and list only the operator's sessions
Starting a chat now asks where first, and the session list is the operator's
own chats alone, told apart by the server's own tag.

- The create flow is a normal pane of the chat stack, not a modal: it loads
  the server's chat_directories (home first, then the directories of previous
  operator sessions, most recently used first) into the shared ListRow, each
  with its full path, and starts on the operator's home
  (directoryChoices/defaultDirectoryChoice). Back, the app-bar back control,
  the footer Cancel and predictive back all leave it without creating
  anything. chat_create is always sent the chosen directory (HOME_DIRECTORY
  "~" for home, the absolute path for a recent), so a session is never
  created in the server's working directory; the server resolves or rejects
  it and its error is shown in the pane.
- The list renders ChatState.visibleSessions: exactly the server's
  chat_sessions (operator sessions only) with the operator's own local
  changes applied; the app adds no ownership guessing. Each row shows its
  directory and the kind chip derived from the server's tag
  (sessionTagLabel, "operator" -> "Operator"); another tag shows verbatim,
  an untagged session shows no chip.
- The brokered protocol exposes no chat rename or delete (no
  chat_rename/chat_delete type and no session endpoint), so both are
  device-local and persisted with the other settings
  (ChatSessionOverrides, KEY_CHAT_OVERRIDES): rename stores a local title
  that wins on later list loads, and "Remove from list" hides the row and
  closes its conversation with an Undo snackbar ("Removed from this list;
  the chat stays on the server."). Nothing is deleted on the server.
- Messages, streaming replies, tool chips, diff cards, approval cards, stop
  and the reconnect path are unchanged.

android/ only: no dependency added beyond the declared
material-icons-extended, no run is started from the app, and no Pipelines
server, Go source, installer or Docker file is touched.

Checks: the packaged authoring skill references need no update - the server
contract this builds on is already documented in
internal/author/skill/references/operations.md ("Brokered OpenCode chat",
committed with lane-chatsrv) and this change is app-side only, so nothing in
it became stale. There are no packaged templates in this repository. The
repository's topic doc for the client, android/README.md, is updated in this
change with the new flow, the honest local rename/removal and what remains
unverified.

Verified: gradle 8.11.1, JDK 17, --offline --no-daemon, from android/;
:app:testDebugUnitTest :app:assembleDebug -> BUILD SUCCESSFUL, 447 tests in
50 suites, 0 failures, 0 errors.
2026-10-17 11:39:11 +01:00
alan 5fafe75267 Merge finish-z02: keep the lane's reviewed work 2026-10-17 11:15:52 +01:00
alan 6a6c1d65fa android: drive the runs list and run detail from server pushes
Replace the Android app's one-second run poll with the server's
workspace-scoped run_event pushes. The runs list, each pipeline row's
last-run line, the run header and the run detail (status, timeline,
stages, artifacts) now advance from the socket instead of polling or a
manual refresh.

- Wire: Message.kt mirrors internal/protocol/runevents.go (subscribe,
  unsubscribe, run_event; RunEventFrame/RunStepDelta). The frames are
  unsolicited and already arrive on the client's events stream;
  PipelinesRepository.subscribeRuns/unsubscribeRuns add the typed
  command, sent via a new PipelinesClient.sendOnly that does not hold the
  send lock waiting for the running server's unreliable subscribe ack.
- One pure fold: ui/RunEvents.kt folds a frame into the list (in place,
  order preserved) and the open detail with one shared status ladder and
  one shared run-field merge. It is monotonic (a stale or duplicate
  delta is dropped whole), reports needsResync for a run the list does
  not hold instead of inventing a row, and only requests a full get_run
  for a settled step or terminal run.
- Wiring: AppViewModel subscribes once per (re)connect and workspace;
  every (re)subscribe re-reads the list and open detail once, because the
  deployed server's subscribe snapshot is partial, then folds the pushes
  on top. Re-reads are push-driven, coalesced and keyed so no push is
  dropped and no timer remains. LiveBadge (RunStream.kt RunStreamState)
  shows honestly live/reconnecting/not live, confirmed by the ack, a
  push or a successful read and dropped when a read fails.
- ui/RunEventsTest.kt pins the delta sequence as pure cases: created run
  not in the list, step started, step finished, run finished, unknown
  run, duplicate/out-of-order deltas, and a reconnect resync.
- android/README.md records the change, the wire mapping and the
  observed limitation of the running server (partial snapshot, no ack
  within 30s), which the client tolerates without inventing a stream.

Checked where the change belongs: android/README.md gained this entry;
docs/cli.md described the Android app as still polling, which this makes
stale, so that sentence now says the app consumes the pushes while the
TUI still polls. The packaged TUI pipeline templates (internal/tui) do
not touch run-state refresh and need no change, and the packaged
authoring skill references (internal/author/skill/references) document
the authoring workflow, not the Android client's run updates, so none of
them needs updating.

Reviewed and approved by the run's review stage (build, unit tests,
Kotlin compile and lint in android/README.md); no merge/rebase/cherry-pick
was in progress and no conflict was present.
2026-10-17 11:15:21 +01:00
alan 8564c2a676 Merge lane-chatsrv: keep the lane's reviewed work 2026-10-17 11:14:52 +01:00
alan 18398dfa5b chat: give the operator their own sessions, separate from run sessions
chat_sessions used to list exactly the OpenCode sessions the pipelines own,
filtered through pipeline.SessionOwner (run_steps/run_session_owners), so an
operator-created chat was an accident of the run-ownership table and the
operator's working sessions were mixed with the internals of running pipelines.

Add a first-class operator session:

- internal/pipeline/operator_sessions.go: a dedicated operator_sessions table
  (session_id PK, directory, title, tag, created_at, last_used_at) with
  RecordOperatorSession (upsert preserving created_at), a one-statement
  TouchOperatorSession (no-op for a non-operator id), OperatorSessions bounded to
  128 rows most-recently-used first, and OperatorDirectories (bounded MRU,
  deduped). run_steps/run_session_owners and SessionOwner/OwnedSessions are
  untouched.
- internal/server/chat.go: chat_sessions returns operator sessions only - it
  reads the registry once, intersects it with one broker session-list call, fills
  directory/tag/created/updated from the registry, sets busy for a session held
  by another connection, keeps MRU order, and stays fail-closed (empty list, never
  the endpoint's whole list). A pipeline stage session and an untagged row can
  never be listed. chat_create resolves the directory (empty/'~'/'~/...' ->
  operator home; relative or missing rejected before any OpenCode call), calls
  broker.Create(title, resolved) and records the row with the operator tag.
  chat_directories returns home first then bounded (8) deduped recents. A
  successful prompt touches the operator session without affecting pipeline
  prompts.
- internal/opencode, internal/protocol, internal/server/websocket.go and
  message.go: unscoped session list, Create posts {"title":...,
  "location":{"directory":...}} to POST /api/session, additive protocol fields
  (omitempty) and the ChatDirectories request/response, plus the OperatorRegistry
  option defaulting to the first store. One OpenCode transport per server is
  unchanged.

Docs and references: docs/cli.md gains a "Chat sessions" section documenting the
operator-only fail-closed list, directory defaulting/rejection, chat_directories
(home first, deduped, bounded 8) and why a dedicated request was chosen.
internal/author/skill/references/operations.md's stale "Brokered OpenCode chat"
text (chat_create unbrokered, run_steps filtering, "listed the owned scratch
session" evidence) is rewritten to the operator-session registry, the fail-closed
filter, directory defaulting and the corrected live-test wording. No new
reference file, so internal/author/install.go's inventory is unchanged.

Checked for staleness elsewhere: README.md, the docs/ topic pages and the
packaged server/TUI templates carry no chat-session ownership claims, so none
needed updating.

Verified: gofmt -l clean; go vet and go build ./... clean; go test -count=1
./internal/pipeline/... ./internal/protocol/... ./internal/opencode/...
./internal/server/... and the full go test -count=1 ./... pass.
2026-10-17 11:14:25 +01:00
alan 8692561bc7 chat: say 'not implemented yet' instead of 'not yet brokered' 2026-10-17 10:44:06 +01:00
alan 7875762b9a Merge lane-c: keep the lane's reviewed work
Combine the two reviewed versions of the Android artifact gallery/viewer.

- ArtifactViewer.kt: keep lane-c's gallery-wide paged full-screen viewer
  (artifacts/index/configuredServerUrl/onIndexChange overload with paging
  gestures, header, page buttons, share action and video-frame support) and
  re-add HEAD's single-artifact overload (url/name/fetchBytes/onDismiss/video)
  as a thin wrapper so StageVerdict still compiles and works.
- Artifacts.kt: keep lane-c's gallery-owned single viewer + onOpen callback and
  compose HEAD's all-artifacts-as-tiles grid (media tiles open the paged viewer,
  non-media open externally, selection and per-item share/copy preserved).

Checked: no conflict markers remain in any affected path. android/README.md
already carries the new "Page between artifacts in the full-screen viewer
(17 Oct 2026)" section documenting this change; the packaged templates, the
top-level README and topic docs, and the packaged authoring skill references
are not made stale by this Android-client UI change, so nothing further needs
updating.
2026-10-17 02:35:42 +01:00
alan f440b109ac Swipe between artifacts in the full-screen artifact viewer
The full-screen viewer becomes a pager instead of a single image with no
way to reach its neighbours.

- ArtifactGallery now owns the one viewer instance over pagedArtifacts(groups)
  -- the grid's image artifacts in the order the grid draws them -- and each
  tile opens the position it holds in that list via viewerIndexByUrl, so the
  grid and the viewer derive their index from one source (previously a second,
  untested per-tile counter and a per-tile viewer that had no neighbours).
- A horizontal drag or flick in ArtifactViewerBody moves to the previous/next
  artifact: pagedIndex moves by one and clamps at both ends without wrapping,
  a single-item gallery is inert, and canPageAtScale pages only at fit so a
  zoomed image pans via the existing zoomAbout/clampImageOffset as before.
  Previous/next IconButtons (disabled at each end) keep both neighbours
  reachable without a swipe, and the header shows "N of M · type" while the
  open artifact's own content, type icon, name and actions reload per artifact.
- Pure helpers pagedArtifacts, viewerIndexByUrl, pagedIndex, canPageAtScale and
  artifactViewerPositionLabel are added to ArtifactViewer.kt; ArtifactViewerTest
  covers next/previous, clamping at both ends, a single-item and an empty list,
  a zoomed viewer that does not page, the paged order versus the grid's draw
  order, and the per-artifact position label.

Placement check: the Android topic doc android/README.md is updated in this
commit with a section describing the pager, its gesture rule and the recorded
build/test checks. No packaged template and no packaged authoring skill
reference (internal/author/skill/references/*, internal/author/install.go's
inventory) documents the app's full-screen artifact viewer, so none needed
updating.

Only the four files this run changed are staged. The unrelated uncommitted
covered-pane statistics and list-load-phase edits (SlidingPaneStack.kt,
States.kt, Dimens.kt, LoadPhaseTest.kt) and the untracked scratch files in the
worktree belong to other changes and are deliberately left uncommitted.
2026-10-17 02:17:35 +01:00
alan f31f150e52 Merge lane-t2: keep the lane's reviewed work
Combine the two reviewed versions of docs/pipeline-performance-review.md.

- Local (main) review: the exact 201939-byte runs.json capture, the three
  final_result_validation sub-shapes, and the 5-to-4 unresolved busy-wait
  correction.
- Incoming (lane-t2) review: both captures (artifacts/222/2 and
  artifacts/222/4), both stat snapshots (134 succeeded / 3 active and
  135 succeeded / 2 active), plus the server-side rejection, deploy-wait,
  device-lock and refined improvement-ranking analysis.

Checked: no conflict markers remain anywhere in the tree and the two sides are
composed without duplicated headings or dead text. This is a documentation-only
change to a dated analysis document; the packaged templates, the README and
topic docs, and the packaged authoring skill references are not made stale by
it, so nothing further needs updating.
2026-10-17 02:14:41 +01:00
alan 4c088c9638 Merge lane-chat: keep the lane's reviewed work 2026-10-17 02:06:02 +01:00
alan 36fad7d130 Merge lane-go: keep the lane's reviewed work
Combines lane-go's typed omni search, launch-time model overrides, TUI
artifacts view, run-state websocket push, and the "reflect the change where
it belongs" committer rule with the Templates gallery, chat/omni-search and
other reviewed work already on main. The 12 files both sides touched keep
both intents composed rather than dropping either side: the omni search keeps
the typed search contract (CLI `pipelines search` and the TUI popup with type
badges and marked snippets) alongside the run-list quick filter; cli.md and
ui-ux-review.md document both the search rework and the artifacts view;
orchestration.md, harnesses.md and operations.md keep the model-override and
reflect-where-it-belongs guidance; and the protocol/CLI/server/TUI code keeps
the new search, run-event, override and artifacts paths alongside the existing
run, title and help surfaces.

Checks before committing:
- go build ./...  -- pass
- go vet ./...  -- pass
- go test -count=1 ./internal/... ./cmd/...  -- all pass

Doc check before committing: nothing needs updating. The lane's own docs and
references (docs/cli.md, docs/ui-ux-review.md, and the orchestration,
harnesses and operations skill references) already carry the new features.
format.md and the packaged templates already describe the line-oriented result
format and the human decision stage from the earlier lane-go merge. The root
README already describes the omni search popup. Model overrides, the search
command, run events and the artifacts view are runtime/CLI/TUI surfaces that
cli.md documents; no template, README or topic-doc edit is required by this
merge.
2026-10-17 02:04:58 +01:00
alan 30c1ed442e chat: broker OpenCode v2 chat over the owned serve SSE endpoint
The installed OpenCode 2.0.20 exposes the authenticated SSE event firehose at
/api/event and the /api HTTP surface, but Detect selects backend "v2" and Open
returned no owned process/URL, so chat stayed disabled and every chat_* request
was answered with "chat is not configured on this server".

Add opencode.OpenStream/OpenChat: for either backend they start the single owned
opencode serve process, discover the loopback URL and verify the backend health
contract (/api/info for v2, /global/health for v1). main and the live test share
OpenChat so the selection cannot drift. Chat now streams real incremental
session.text.delta/session.reasoning.delta frames via the existing
Connection.EventStream + NormalizeChatEvent, with no polling and no fake
streaming.

- Authenticate the owned endpoint with the per-backend user (opencode for v2,
  pipelines for v1); the v2 server ignores OPENCODE_SERVER_USERNAME.
- Send the V2 prompt shape {"text":...}, which the v1 translation also accepts.
- Skip firehose event types the adapter does not surface before decoding their
  data, so session.instructions.updated (delta is an object) no longer fails the
  stream.

Unit tests cover the per-backend user, the prompt shape/auth, the captured real
V2 event shapes and the selection guards. An opt-in live test drives
chat_sessions/chat_messages/a completed chat_prompt/an interrupted chat_prompt
against the installed OpenCode. Update the packaged operations reference with the
realized capability, dated evidence and deployment state.

Checks before commit: the packaged authoring reference
internal/author/skill/references/operations.md is updated in this change; no new
reference file was added, so internal/author/install.go's managed inventory is
unchanged and the internal/author tests pass. No packaged template describes the
brokered chat surface, and neither README.md nor the topic docs under docs/ (nor
web/) document it, so none of them needed updating.
2026-10-17 01:54:14 +01:00
alan f5610eb4e6 docs: pipeline performance and reliability review 2026-10-17 01:43:46 +01:00
alan c164d08cc5 Merge lane-c: keep the lane's reviewed work
Combines lane-c's Templates gallery and detail view with the chat and omni-search work already on main (lane-t2). The three files both lanes touched keep both intents: AppViewModel.kt keeps refreshTemplates/createFromTemplate alongside the search/chat flows, PipelinesApp.kt keeps both the Templates and Chat destinations, and graph/Artifacts.kt adopts the shared galleryGrid fitting while keeping the tile-gallery refactor.

Doc check before committing: nothing needs updating. This is an android/-only merge. The app's topic doc (android/README.md) already documents the Templates destination (lane-c) and the Chat/omni-search work (lane-t2). The root README and docs/ describe the server CLI/TUI (whose :templates catalog is a separate surface) and are unchanged. The packaged authoring skill references (internal/author/skill/references/) mention the Android client only for APK-delivery mechanics, which this change does not alter, and the packaged templates are server-side and untouched.
2026-10-17 01:42:51 +01:00
alan 515059674d Merge lane-t2: keep the lane's reviewed work 2026-10-17 01:34:02 +01:00
alan 052ece0163 skill: match the answer's length to the question in the conciseness guidance 2026-10-17 01:31:24 +01:00
alan 18db2f913a Add a Templates gallery and detail view to the app
The server's template catalog (the list_templates command) had no surface in
the app. This adds a Templates destination to the shared SlidingPaneStack: a
measured card gallery (name, short description, stage count and its own glyph;
one column narrow, a fitting grid wide) and a detail pane that reuses the
pipeline detail's Summary/Graph/Source tabs, plus a create-from-template action
that submits a create-only draft. Stage counts come from a source the server
parsed (validate); a source that does not parse is still viewable as raw
markdown.

Added: Templates.kt (TemplateEntry/TemplateCard, the grid-column and
stage-count mapping), components/GalleryGrid.kt (the shared measured-gallery
fitting, extracted from the artifact gallery), graph/SourceView.kt
(PipelineSourceView, the one rendered-definition view, extracted from
PipelineDetailScreen), screens/TemplateGalleryScreen.kt,
screens/TemplateDetailScreen.kt, TemplatesTest.kt.
Changed: PipelinesApp.kt (the Templates destination), AppViewModel.kt
(refreshTemplates/createFromTemplate), data/PipelinesRepository.kt
(listTemplates/validateSource/createPipeline), graph/Artifacts.kt (use the
shared galleryGrid), PipelineDetailScreen.kt (use the shared
PipelineSourceView), ArtifactGalleryTest.kt (exercise galleryGrid).

Doc/state check before committing:
- android/README.md (the app's topic doc): updated. Added a Features bullet for
  the Templates destination and a dated "Templates: a gallery and a detail view"
  section, matching the per-feature convention every prior android change uses.
- Packaged templates: not touched. The server's templates are Go-side and the
  brief forbids touching the Pipelines server; this change only renders the
  catalog the server already exposes.
- Packaged authoring skill references (internal/author/skill/references/): not
  updated. They document the Pipelines harness, not the Android app, and this
  change adds no harness runtime behaviour.
- Root README and docs/: not updated. They document the CLI/TUI/server, which
  are unchanged; the Android app is documented in android/README.md.

No conflict was present: no unmerged paths and no unfinished merge, rebase or
cherry-pick, so nothing needed resolving.
Deliberately left uncommitted (other work this run did not touch, not staged):
the worktree's other WIP - components/ListScroll.kt and screens/PaneStats.kt with
their tests, and the uncommitted edits to components/SlidingPaneStack.kt,
components/States.kt, theme/Dimens.kt and components/LoadPhaseTest.kt - plus the
untracked .ui-review-*/ capture artifacts.
2026-10-17 01:30:27 +01:00