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).
This commit is contained in:
2026-10-17 15:38:58 +01:00
parent d48175a4d9
commit f782c51c18
16 changed files with 979 additions and 66 deletions
+83
View File
@@ -5861,3 +5861,86 @@ Not verified in this pass: the header meta on a device and the create-flow note
the brief keeps implementation verification to the build and the unit tests, and
visual review owns the operator's Pixel 9 Pro XL. No packaged skill reference was
touched: this is an app-UI change and no reference describes the chat surface.
## Answer a waiting human decision from the phone (17 Oct 2026)
The last piece of the original goal the app was missing: a run parked on a person
is now answerable from the phone. `android/` only; nothing in the Pipelines
server, its Go source, the installer or the Docker files was touched, no
dependency was added (the new glyph comes from the already-declared
`material-icons-extended`), no run was started from the app and no server field
was added.
- **The same `decide` request the terminal uses.** `Protocol.DECIDE_RUN`
(`decide_run`) with `stage`, `option` and optional `feedback`, exactly the fields
`internal/protocol/message.go` carries and the TUI's Enter builds
(`internal/tui/decision.go`); `PipelinesRepository.decideRun` sends them and
returns the resumed run's detail. There is no second mechanism.
- **Surfaced through the existing push path, with no server change.** A waiting
transition already arrives as a `run_event` with `status: waiting` and a waiting
step delta. The compact delta omits the waiting step's `output` — where the
author's options and instructions are recorded — so `runDetailNeedsFullSync` now
also fetches the full run on a waiting run/step; that fetch fills the recorded
evidence and the decision appears live, with no refresh. `RunState` gained
`Waiting` (violet, `FrontHand`, its own label) so the runs list and the run
summary show "waiting" instead of the unknown fallback. `lastWaitingStep`,
`waitingOptions`, `waitingPrompt` and `humanOptions` mirror `tui.lastWaitingStep`,
`protocol.WaitingOptions`/`WaitingPrompt` and `stage.HumanOptions`.
- **Where it is reachable.** A prominent "Waiting for your decision" card with a
Decide action sits above the run detail's tabs (on any tab — opening the run is
enough) and at the top of the waiting stage's pane; both open the same sheet. It
is not wired to a submenu, and an attention surface (another item) renders the
same shared `DecisionPrompt`/`pendingDecision` component.
- **The sheet.** It shows the run and the waiting stage, the author's recorded
instructions, every option exactly as written (its edge key) with the label it
routes to (`deploy → SUCCESS`), an optional feedback field and a deliberate
`Confirm decision` button. Selecting an option only selects it; the button stays
disabled until one is chosen, so a stray tap cannot answer by accident.
Answering applies the returned run immediately, so the run's new stage is shown
without a manual refresh.
- **Refusals are honest.** A refusal (the run moved on, the stage changed, another
client answered first) keeps the sheet open with the server's own message
verbatim, and the run is re-read silently so the app stops offering a decision
that is gone — never a silent failure and never a faked success.
Pure helpers: `pendingDecision` (the step's recorded evidence first, the pinned
graph as the fallback), `DecisionOption`, `DecisionDraft` (the deliberate-confirm
gate) and `decisionRefusalMessage`.
Tests (13 new): `HumanDecisionTest` (6 — the recorded options/instructions,
non-string tolerance, the sorted non-error-edge fallback, the last waiting step
and the `decide_run` envelope with its exact wire names) and `DecisionTest` (7 —
the waiting run's stage/options/targets/instructions, non-waiting runs, the graph
fallback, the prompt fallback, stage inference, the confirm gate with optional
feedback, and the verbatim refusal message). `RunEventsTest`'s sync rule gained
the waiting cases and `RunStatusTest` the waiting status mapping.
Evidence (implementer pass, macOS, cached Gradle 8.11.1 at
`~/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1/bin/gradle`,
JDK 17 from Homebrew `openjdk@17`,
`ANDROID_HOME=/Users/alan/Library/Android/sdk`, every command
`--no-daemon --offline`):
- `gradle :app:testDebugUnitTest --offline --no-daemon --console=plain` →
`BUILD SUCCESSFUL`; the JUnit XMLs total **57 suites / 518 tests / 0 failures /
0 errors / 0 skipped** (up from 55 suites / 505 tests).
- `gradle :app:assembleDebug --offline --no-daemon --console=plain` →
`BUILD SUCCESSFUL`; `app/build/outputs/apk/debug/app-debug.apk` is 18,519,392
bytes, sha256
`4086e6dab453dba81fd0e2f023b0c6713600a68f78d95ada073e0df785b971a1`
(`--rerun-tasks --no-build-cache`, reproduced byte-for-byte by a second full
rebuild; an incremental package is not byte-reproducible), published to this
run's artifacts directory as `pipelines-debug-wip-d48175a.apk` (`d48175a` =
`git rev-parse --short HEAD`; the tree is uncommitted WIP on top of it) and
served at
`http://10.0.0.75:8080/artifacts/277/1/pipelines-debug-wip-d48175a.apk`
(`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18519392`); `10.0.0.249` served it too.
Not verified in this pass: the on-device sheet/feedback/refusal behaviour and the
screenshots — the brief keeps implementation verification to the build and the
unit tests, and visual review owns the operator's Pixel 9 Pro XL. The "attention
surface" named in the brief is not present in this tree, so the decision is
reachable from the run detail and its stage and the shared component is ready for
it. No packaged skill reference was touched: the decide protocol is unchanged and
already documented, and this is an app-UI change.