Skip to content

Fix minor and cosmetic v2 issues found by the simulation test run - #338

Merged
ivanfenenko merged 38 commits into
mainfrom
fix/sim-run-minor-issues
Oct 2, 2026
Merged

ivanfenenko merged 38 commits into
mainfrom
fix/sim-run-minor-issues

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #337 (merged; this PR now targets main). This PR fixes the minor and cosmetic findings from the same simulation test run, where both apps were driven against the opencode v2 (beta) simulation server.

Timeline chips and rendering

  • B2-2: read chips and Explored detail rows show the file (v2 path). Detail rows now open their read or search output, and a multi-tool group's subtitle reads "N tools".
  • B2-3: custom and MCP tools show the input title, with the live metadata.title progress while running. The tool name stays in the detail sheet.
  • B2-4: a shell command that exits non-zero shows the error state and "Exited with code N".
  • B2-6: running and pending chips show elapsed time (m:ss).
  • B2-7: a new-file write shows +N.
  • B3-3: the iOS question chip says "Asked N questions".
  • B1-3: a table renders while it's still streaming (shared markdown parser).
  • B5-3: loading older messages keeps the scroll anchor. On Android the pinned-to-bottom check measured from the wrong end of the list; iOS re-anchors after rows settle.
  • Compaction follow-up: the summary sheet renders as markdown.

States, docks, forms and errors

  • B2-5: a delivered prompt shows as a bubble right away. Live prompts get the agent/model that REST records, so the meta line is the same live and after reopening (1147cb6e).
  • B3-1: short reply errors ("Couldn't send your reply. Try again." plus the server's reason); raw details go to the diagnostic log.
  • B3-2 / B3-4: forms honour maxItems / minItems / custom, and a plain field shows the form title as its header.
  • B3-5: a user Stop or Deny is shown as a neutral "Interrupted" status, not as an error toast.
  • B3-6: a muted note "Response cut off (length limit)" or "Interrupted" under the reply.
  • B3-7 / B2-7 / B2-8: the permission dock can be hidden to reach the composer, and a "Review permission request" pill brings it back. "Always" sends decision: "always" when the request includes save patterns. Edit/write requests list file +N −N. On Android, commands and paths are monospace, the composer is fully opaque, and the diff viewer opens at the top.
  • B3-8: icon buttons carry their accessibility label on the clickable node.
  • Review follow-up: a compaction is now tracked from the moment it starts, so a finish, or a busy→idle cancel, that arrives before the POST returns is handled. Exactly one success notice is shown (eb5e375d).

Home, session and composer

  • B1-2: Android Home shows the Idle pill, matching iOS and the design-system docs.
  • B2-9: a screen that is leaving releases only its own Ready focus, so watched sessions and forks no longer stay "Ready".
  • B4-4: on v2 the composer waits for the compaction to finish before reporting success, and shows "Session compacted." when usage is unknown, instead of "0% → 0%".
  • B4-6: v2 synthetic inbox items, such as Plan mode's reminder, are hidden.
  • B4-7: the server's "default" variant counts as Default, and variants are ordered by effort.
  • K2: project listing on v2 uses GET /api/project.
  • Composer label: the idle send button is labelled "Send".
  • iOS: a compacted session no longer stays on "Syncing…": a network frame identical to the cache now confirms the cache.

New design-system pieces, with gallery entries on both apps: a Message Note, an Interrupted status on Tool Chip and Tool Call Card, and a Review Permission pill.

Checks

  • Android: ./gradlew :app:testDebugUnitTest, 1677 tests, 0 failures. :app:assembleDebug succeeds.
  • iOS: full OpenCode MobileTests target, 1603 tests, 0 failures. The app builds.
  • CI: android-checks and ios-checks pass.
  • On-device verification against the simulation server, using debug builds on the iOS simulator and the Android emulator. Every finding's repro steps were re-run on both platforms, and all 23 minor/cosmetic findings and both follow-ups are fixed.
    • The first pass found B2-5 only partly fixed: on Android, a steer after a server-injected prompt had no meta line. Fixed in 1147cb6e and re-verified on 1147cb6e.
    • Spot checks of earlier fixes (explore, Allow once, the compaction card, markdown-stream) found no regressions.
  • Findings report with before/after screenshots for every fix (LAN artifact server): http://ivan-m2.local:8787/2026-10-02/1404-simulation-test-findings-all-fixed/

Risks / Follow-ups

  • Found during the final device check, not fixed here: (1) a compaction the server reports as failed ("Nothing to compact yet") still shows a green "Context compacted" row; (2) after a compaction, a prompt's meta line and the variant chip can differ between live and after reopening.
  • v1 user stops are recognised from the error text, so a wording change in opencode would bring the red styling back.
  • Android's whole composer is now opaque, not only the permission dock.
  • Android stops auto-following once the user scrolls more than 32 dp up, even while a long reply is still streaming.
  • "Always" is offered only when the request has save patterns.

🤖 Generated with Claude Code

ivanfenenko and others added 30 commits October 1, 2026 22:50
v2 text and reasoning events carry no part id, only an ordinal that
restarts at 0 in every assistant message. Both event adapters built the
live id as `text-<ordinal>`, so every step of a turn produced `text-0`.
The chip timeline merges a turn's assistant messages into one body and
keys paragraphs and their markdown by part id, so step texts were
duplicated, swapped or lost until a cold relaunch.

Live ids are now `<assistantMessageID>:<kind>:<ordinal>`, and the REST v2
projection numbers text and reasoning per kind the same way, so a reload
replaces live parts in place. v1 part ids are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
v2 has no assistant message.updated, so the adapters synthesize partial
infos without `time`. Timeline order sorts by time.created and puts
untimed rows last, so a live reply sorted below the next prompt: the new
prompt rendered above the previous reply, and the two replies became
adjacent and were merged into one chip-timeline block.

- step.started now stamps the assistant info with the event time.
- The store keeps the cached time (or the REST-seeded message's time)
  when a partial info omits it.
- A queued v2 prompt (`waiting`) is appended when enqueued and moved to
  its delivery position when delivered, so steer/queue follow-ups land
  after the reply that was running when they were sent.

v1 infos always carry time and never `waiting`, so v1 behavior is
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An authoritative merge kept every cached live info for messages the
reload returned, and the store builds a message from its cached info
before the REST copy. After a background catch-up, a v2 prompt whose
delivery the app missed stayed `waiting` (hidden in the queued bar), so
the two replies around it became adjacent and merged into one block;
partial v2 assistant infos also hid the REST times.

The merge now drops cached infos; REST messages carry the full info and
later live infos layer on top again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The beta server's POST /api/session/{id}/permission/{requestID}/reply
requires {"decision": "once" | "always" | "reject"} and rejects the old
{"reply": ...} body with 400 "Missing key decision". Rename the v2 DTO
field on both apps; Allow once maps to "once", Deny to "reject". The v1
permission route and the v2 form reply body are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A v2 fork carries "fork": {"sessionID": <source>, "boundary": ...} and no
parentID, but both session adapters fell back to fork.sessionID for
parentID. Every fork then read as a subagent child: hidden from Home and
locked with "Child sessions cannot be prompted". Map parentID only from
the real parentID field.

The server announces a fork only as session.forked, whose parentID is the
fork source. Project it as session.created (without parentID) so Home
refreshes and shows the fork live.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
After an opencode server restart, the first GET /api/model can return
before the server's catalog is ready (an empty list). The server emits
provider.updated / model.updated about 100 ms later, but the composer
never refetched, so Session Chat stayed on "No usable models are
available" until the user tapped Model.

The Session Chat composer now refetches the catalog when either event
arrives, on both apps for parity (Android had the same gap and only
avoided it through timing). A newer catalog request always wins over an
older one. An event-driven refresh that fails keeps a catalog that has
already loaded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
v2 announces a committed revert only as `session.revert.committed {to}`;
neither app handled it, so the reverted prompt, its reply and everything
after stayed in the timeline. Both adapters now project it, and the
message store drops `to` and every later message (a REST catch-up runs
when `to` is outside the loaded window). v1 keeps its per-message
`message.removed`.

The reload could not heal it either: the tail-acceptance guard scored the
cached window, reverted rows included, against the REST tail, judged the
shorter server tail stale and kept the cache, also after a cold relaunch
(iOS stayed on Syncing…). Local rows the tail lacks inside its window are
now left out of that comparison. iOS also kept every cached row past the
newest overlap; like Android it now keeps only rows newer than the tail's
newest message. Older-than-window rows and paged history are untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The v2 REST projection turned a `compaction` item's summary into a text
part; the chip timeline then merged that assistant row into the previous
reply, so the `## Objective …` markdown read as part of it. Live, the
compaction events carried no message id (v2 sends `inputID` on started
and nothing on ended), so their parts were dropped and nothing showed.

The summary now rides on the compaction part. An assistant (v2) message
with a compaction part renders a "Context compacted" card ("Compacting…"
while running) whose summary opens in the tool detail sheet, and it never
merges with neighbouring assistant rows. Live, `compaction.started`
creates the item (inputID, else the envelope id as msg_), `ended` /
`failed` complete it with the summary, and deltas are dropped. The
running part also lets the existing presence check show Compacting….
The session cache keeps compaction parts. v1 compaction (a part on the
user message plus a summary reply) renders as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The sending app reloads REST after every POST, so its follow-ups reach
the store as inbox items merged into the tail rather than as live infos.
Three gaps made that copy diverge from the watching app:

- The v2 inbox DTO read a flat `timeCreated`, but `Session.Inbox.User`
  nests it as `time.created`, so every materialized prompt had time 0
  ("1:00 AM") and sorted above the first prompt.
- The iOS store rebuilt REST-seeded messages with live parts without
  their pickup state, so a waiting prompt showed as a bubble.
- The authoritative reload drops cached infos, so on delivery the store
  no longer knew the prompt had been waiting and never moved it after
  the reply that ran meanwhile; the two replies then merged.

Delivery now also checks the REST copy's pickup state on both apps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a server restart the app asked GET /api/model while the server was
still loading (an empty answer), and the server's model.updated /
provider.updated fired before the app's SSE stream reconnected, so the
event-driven refetch never ran and Session Chat stayed on "No usable
models are available".

The composer now also refetches after server.connected /
stream.reconnected, and an empty answer is retried with a 1 s / 2 s /
4 s backoff. A refresh that comes back empty keeps a catalog the
session already has. Same on both apps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fork dialog's Open (and Commands > New) push the new session through
Session Chat's child-session destination, which always built the pushed
SessionListItem with `parentID: session.id`. The fork therefore opened
as a child of the session it was forked from and showed "Child sessions
cannot be prompted." even though the server reports it as top-level.

ChildSessionNavigationTarget now carries its own parentID: subagent
child taps pass the current session, while fork and new-session targets
leave it nil, and both destinations build the item from the target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DefaultSyncCoordinator changed a key's state under the lock but yielded it to
observers after unlocking, so a fast failing load could publish .stale before
the earlier .syncing publish ran and leave observers on .syncing. This made
SyncCoordinatorTests.loaderFailureRetriesWithBackoffUntilSuccess flaky in CI
(also seen on an earlier PR). States are now yielded in the same critical
section as the change, and observe() yields its first value under the lock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…live elapsed, new-file counts (B2-2, B2-3, B2-4, B2-6, B2-7, B3-3)

- Read chips and Explored rows use the v2 `path` input; explore members open their output.
- Custom/MCP tool chips show the live progress title (v2 metadata.title), then the
  input title; the tool name stays the detail sheet title.
- A shell run with a non-zero metadata.exit shows as failed with its exit code.
- In-flight chips (subagents, held tools) show live m:ss elapsed time.
- A write of a new file counts its content lines as additions.
- iOS question chips say "Asked N questions" like Android.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Compaction cards mark their summary as markdown; the tool detail sheet parses it off
the main thread and shows it with the rendered-markdown component, falling back to
plain text for tool output.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Match iOS and the Session List design-system docs: Idle renders as an
info-tone pill and status dot instead of being hidden.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A leaving Session Chat cleared focus unconditionally, so after "Back to
main session" or opening a fork the old screen's dispose/onDisappear
unfocused the session now on screen, and its finish was stamped Ready.
Release focus only while the leaving session still owns it, and arm the
leave-while-busy watch when focus moves straight to another session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
session.inbox.enqueued items of type "synthetic" were projected as a
plain user text part, so the live row showed the system-reminder as a
user bubble. Mark that text part synthetic on both adapters so it is
hidden like REST-projected synthetic messages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fort (B4-7)

v2 records model.variant "default" when no variant was chosen, which the
composer reported as an unavailable remembered variant. Treat it as the
Default variant unless the model names a variant "default". Keep v2's
variant order (low, medium, high) and sort v1's unordered variant map by
reasoning effort instead of alphabetically.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Project listing only called v1 /project, which returns 500 on v2. Route
listProjects by protocol in both project repositories and map v2's
canonical root to the project worktree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
"Send as Steer"/"Send as Queue" only describe Send while work is
running; an idle session announces a plain "Send" on both platforms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
v2 POST /compact returns at enqueue time, so both apps cleared
Compacting… and posted "Context compacted" before any summary existed.
compactSession now says whether the server finished (v1 summarize) or
only enqueued (v2); for v2 the composer stays Compacting… until the live
compaction item completes, reports success only when it carries a
summary, and clears quietly if the session goes idle without one. The
context delta is dropped when usage is unknown (0% -> 0%).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On reopen, a network frame identical to the cache-seeded one was dropped
as a no-op without confirming the cache, so Syncing… stayed up. This hit
compacted v2 sessions every time: the compaction item has no completed
time, so the tail is never settled and the tail-identity confirm path
never fires. Treat that skipped frame as a cache confirmation on both
platforms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…2-5)

v2 `session.inbox.delivered` projects to a user info with no parts, and
the live publish gate only lets part, removal and streaming changes
through. The prompt stayed in the Up next strip (and "No messages yet")
until the first assistant part arrived. The store now reports a pickup
state change and the engine publishes it.

The sender sees its queued prompt as an inbox item without agent or
model, then only a partial live info, so the delivered bubble had no
"Build · Model · Variant" line. Inbox items now inherit the newest
message's agent and model (what the server records on delivery), and a
partial live info keeps the base copy's agent, model and variant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The composer Stop button's "Abort active work" lived on the inner Icon,
so whether the clickable node exposed it depended on merging; one
uiautomator capture listed Stop with no text or content-desc. Icon-only
OpenCodeButton variants now set the label and Role.Button on the
clickable node and leave the icon decorative.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failed permission and question/form replies showed raw transport text:
iOS printed the server's JSON body, Android printed Ktor's "Bad
response: HttpResponse[…URL…]" string and dropped the body (v1 replies
even failed as decode errors).

- Android keeps the error body on v2 failures (HttpBodyResponseException
  -> SessionError.Http.body) and v1 replies check status before decoding.
- ServerErrorMessage pulls a meaningful `message` from the body and drops
  request-schema errors (InvalidRequestError / multi-line decoder paths).
- InteractionReplyError renders "Couldn't send your reply. Try again." or
  "Couldn't send your answer. Too many selections for form field: …".
- Details (status, body) go to the diagnostic log.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (B3-2, B3-4)

Neither app read a form field's `minItems` / `maxItems`, so a
`maxItems: 1` multiselect took both picks under "Select all that apply"
and the server rejected the submit. Forms also offered "Type your own
answer" unless a field said `custom: false`, and a field with only a
title showed that title twice while the form title was never shown.

- The form adapter maps minItems/maxItems onto QuestionInfo, only allows
  custom answers when the field has `custom: true`, and heads a plain
  field with the form title (question-tool fields keep title/description).
- With maxItems 1 a second pick replaces the first; at the cap further
  picks are ignored; Submit needs min..max picks.
- The composer hint reads "Select one", "Select up to N", "Select at
  least N" or "Select N to M". Gallery: "Up to 2" question scenario.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A user Stop or Deny surfaced as a red "Step interrupted" toast on both
apps (also on the one that didn't press Stop), and the cancelled tool got
the same red ✗ chip and red error line as a genuine failure.

- Tool parts carry isInterrupted: v2 `error.type: "aborted"` (live
  tool.failed and REST), v1 abort/reject error text; kept through store
  merges and the transcript cache.
- New design-system status Interrupted on Tool Chip and Tool Call Card:
  neutral label, stop glyph, muted "Stopped" / "Declined" text; gallery
  and previews updated. The paragraph error line skips interrupted chips.
- `session.error` with `aborted` / `MessageAbortedError` no longer raises
  the error toast. Real errors keep the red styling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ivanfenenko and others added 4 commits October 2, 2026 12:49
A `finish: "length"` reply looked identical to a complete one, and an
interrupted reply lost every sign of it once the toast faded.

- Messages carry stopReason (Length / Interrupted): v1 info `finish` and
  `MessageAbortedError`, v2 REST `finish` / `error.type: "aborted"`, v2
  live step.ended `finish` and an aborted step.failed. Partial infos keep
  it, REST copies fill it, and the transcript cache stores it.
- An assistant body that ended early gets a StopNote block after merging
  (the merged run takes its last message's reason), rendered with the new
  design-system Message Note: "Response cut off (length limit)" or
  "Interrupted", muted. Gallery entry and previews on both platforms.
- An interrupted reply no longer shows the abort error as its body text.
- The provider-error-with-retry case is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-7, B2-7, B2-8)

- Always: an "Always" action sends `always` (v1) / `decision: "always"`
  (v2) when the request offers save patterns, and the dock lists what it
  would save ("Always allows: git status *, …").
- Edit/write requests list their files as `path +N −N` from
  `metadata.files[]` (v2) or `filepath` + `diff` (v1).
- Hide (B3-7): a chevron collapses the dock without answering; the prompt
  composer comes back with a "Review permission request" Action Pill
  (new variant) that reopens it. Nothing is rejected; a new request
  shows the dock again. Questions stay queued behind the permission.
- Android (B2-8): commands and paths use the monospace code style like
  iOS, and the composer chrome is opaque, removing the faint rectangle
  that timeline rows drew through the 95% fill.
- Gallery: Permission "Edit" scenario, all Action Pill variants.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The viewer scrolled to the first hunk on open (animateScrollTo plus a
bring-into-view request), leaving "+++ b/README.md" under the top bar.
It now opens at the top like iOS and follows the selected hunk only
after the user navigates with the hunk pill.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7949000. Configure here.

… race)

The pending compaction record was created only after POST /compact
returned Enqueued, while the timeline treated the session as compacting
from the start. A live finish in that window cleared Compacting… with no
success notice, and busy-then-idle could never be seen, leaving
Compacting… up. The post-enqueue re-check also passed busy = false.

Both apps now create the record with isCompacting in runCompact. A
timeline finish before the POST returns is remembered and resolved when
it does: Enqueued (v2) posts success if it had a summary, Finished (v1)
keeps its own single success path. "Ended without a summary" waits for
enqueue confirmation, busy seen earlier still counts, and the re-check
uses the last known busy flag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko
ivanfenenko marked this pull request as ready for review October 2, 2026 11:32
ivanfenenko and others added 2 commits October 2, 2026 13:47
The Explored detail (and a context-only tool group) used the first
tool's argument as its subtitle, so a glob + grep + 2 reads group read
"**/*.ts". One explore tool keeps its argument; several now read
"4 tools", since the title already counts each kind and every row keeps
its own argument.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
v2 user items carry no agent or model; REST gives each the running agent
and model of the timeline items before it. Live, the meta line came from
whichever base copy happened to exist, so a steer after a server-injected
prompt had none until its turn ended, and injected prompts got it on one
app but not the other.

The message store now keeps that running value per session in arrival
order: seeded from REST, advanced by an assistant when its content starts
(step.started now carries agent and model) and by live agent/model
switches (projected as a client-only message.context event). A v2 prompt
is stamped with it when delivered; a delivered REST copy still wins over
the stamp.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Base automatically changed from fix/sim-run-major-issues to main October 2, 2026 20:47
#337 was squash-merged as 3f9c697, whose tree is identical to this branch's
ancestor 7a481d9. Every conflict therefore resolves to this branch's side; the
merged tree equals 1147cb6 (already verified by CI and the full test suites).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko
ivanfenenko merged commit f9bc042 into main Oct 2, 2026
@ivanfenenko
ivanfenenko deleted the fix/sim-run-minor-issues branch October 2, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant