Drive the composer's stop control and IME action from one derivation

While a turn was in flight the trailing composer button became the stop
control, but the text field's keyboard send action still checked only
canSend, so a prompt could be sent from the IME during a run even though
the visible control had become stop.

Add ChatFormat.composerAction(thread) -> ComposerAction.Send/Stop as the
single pure derivation and read it from both the trailing button and the
keyboard action, so the two controls can no longer disagree.
ChatFormatTest.composerControlIsStopWhileARunIsInFlightAndSendOtherwise
covers Send when idle and Stop while running. android/ only; no new
dependency.
This commit is contained in:
2026-10-16 16:26:16 +01:00
parent 609721d53b
commit 305714c30f
4 changed files with 54 additions and 5 deletions
+27
View File
@@ -2764,6 +2764,33 @@ Evidence (macOS, JDK 17, Gradle 9.7.1 `--offline`,
returned `HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18240566`, and a streamed `GET | shasum -a 256` matched.
### Follow-up: one tested composer action (16 Oct 2026, run 143)
The stop control was still chosen by an inline `if (thread.running)` in the
composer, and the text field's keyboard send action only checked `canSend`, so a
prompt could still be sent from the IME while a turn was in flight even though the
visible control had become stop. `ChatFormat.composerAction(thread)`
(`ComposerAction.Send`/`Stop`) is now the single pure derivation the trailing
button and the keyboard action both read, so the two controls can no longer
disagree; `ChatFormatTest.composerControlIsStopWhileARunIsInFlightAndSendOtherwise`
covers it. `android/` only; no new dependency.
- Re-verified: `gradle :app:assembleDebug :app:testDebugUnitTest --offline` →
`BUILD SUCCESSFUL`, **266 tests, 0 failures** (the new composer-action case).
- **APK publish.** `app/build/outputs/apk/debug/app-debug.apk` (18,249,033 bytes,
sha256 `a9ce0cc8829513ee37fa5abaafa765307d5574f7cbd2b9cf0bc32392d0c1461e`) copied
to `~/.local/share/pipelines/data/artifacts/143/1/pipelines-debug-wip-609721d.apk`.
`curl -I http://10.0.0.249:8080/artifacts/143/1/pipelines-debug-wip-609721d.apk`
returned `HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18249033`; a streamed `GET | shasum -a 256` matched.
- Not driven on a device in this pass: the constraint that the stop control be
exercised on an emulator only conflicts with this run's device note that only the
operator's Pixel (adb serial `58281FDCG000JF`) is available and no emulator may be
run, so the evidence here is the unit tests and the build rather than a fresh
screenshot. The earlier `emulator-5556` captures
(`.stop_check/stop_control_running.png`, `.stop_check/stop_control_stopped.png`)
still show the running/stopped control states.
Not verified in this pass: the live brokered server (separate lane), streaming
against real OpenCode, and attachments — unchanged from the passes above.