Skip to content

W16AAPPLE-112: Collapse a turn's thinking and tool steps once it finishes, as Codex does - #81

Open
extraLaj wants to merge 318 commits into
openonion:mainfrom
extraLaj:w16a/80-W16AAPPLE-112
Open

extraLaj wants to merge 318 commits into
openonion:mainfrom
extraLaj:w16a/80-W16AAPPLE-112

Conversation

@extraLaj

Copy link
Copy Markdown

Part 80 of 91 in the W16A-APPLE (UNSW COMP3900) series, one PR per ticket, in the order the work was merged.

Order: Merge after #80. Until that is merged, this PR also shows the earlier parts. Please merge in order with Create a merge commit (not squash or rebase), so each later PR narrows to its own ticket.

This ticket only: w16a/79-W16AAPPLE-99...w16a/80-W16AAPPLE-112

Changes: 178 files changed, 2282 insertions(+), 903 deletions(-)

Commits:

  • W16AAPPLE-112: collapse finished turn steps and restyle chat to the design
  • W16AAPPLE-112: fix ktlint import order and unused imports
  • W16AAPPLE-112: address review feedback

🤖 Generated with Claude Code

Henry Chen and others added 30 commits October 10, 2026 22:51
Resolve W16AAPPLE-13 "Exec"

Closes W16AAPPLE-13

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!12
resolving sparse connectivity issues regarding reconnection

Closes W16AAPPLE-90

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!19
Resolve W16AAPPLE-20 "Oip conformance checklist"

Closes W16AAPPLE-20

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!22
Add RelayFailoverTest. It breaks the relay connection partway through a
reply and checks that the app reconnects through the relay, resumes the
same session from the last message it saw, and shows and saves the rest
of the reply exactly once. Cases covered:
- the connection drops without warning
- the relay restarts
- the relay is down for a few attempts, then comes back
- the relay is back before the agent's host
- the agent's host disconnects mid-reply
- the relay stays down past the retry limit, then the network comes back
- the reply finishes while the relay is down
- the relay closes normally (code 1000): the app waits for the user to
  reconnect, as the ConnectOnion web client does, then the reply resumes

The relay is faked in the test; how it rejects a connection was checked
against the real relay at oo.openonion.ai.

Move the fake host out of ProcessDeathResumeTest into
testing/FakeOipHost.kt so both tests share it, and add the new test to
the regression suite.

Known issue: when the agent's host disconnects mid-reply, an "agent
offline" message is left in the chat after the reply resumes
(W16AAPPLE-93).
Two tests failed in the pipeline but not locally:

- The app checks every 100 ms whether its connect call has reached
  Connected. On a slow runner the test broke the relay before that
  check ran, so the app treated it as a failed first attempt and opened
  a fresh connection on its own (a redial before the user asked, and a
  reconnect with no last_msg_id). The test now waits for the connect
  call to finish before breaking anything.
- The fake network was a StateFlow, so turning it off and straight back
  on could reach the app as a single "on", and it never retried. It is
  now a SharedFlow, so the app sees both changes.
Every frame used to reach the app while it was connected, so nothing
was ever replayed after a reconnect. In each recovery case the agent
now finishes its tool call while no socket is open, so the host only
buffers the tool_result. After the reconnect the test checks it is
forwarded once, over the new connection, and shows and is saved once,
before the rest of the reply is sent live.
W16AAPPLE-26: Automated relay-failover reconnection test

Closes W16AAPPLE-26

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!20
Resolved w16AAPPLE-18-Handle-SESSION_STATUS

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!21
When the Host drops off the relay mid-reply, the relay answers the
app's next frame with ERROR "Agent not connected" and drops the socket.
The app had already connected, so it treated this as a business error
on a live session and added "This agent is offline..." to the
conversation, where it stayed after the reconnect resumed the reply.

That ERROR on a live socket is now only logged. The drop that follows
already starts the reconnect, which is the status the user sees, and
the ConnectOnion web client never adds an ERROR to the conversation.
Other errors on a live session (e.g. insufficient credits) still are.

The RelayFailoverTest case is no longer a known issue.
ConnectToAgentUseCase judged a connect attempt by checking every 100 ms
whether the state was Connected. A connection that reached CONNECTED and
dropped before the next check was counted as failed, so the use case
reset the session and connected again on its own, without last_msg_id.
After a normal (code 1000) close it reconnected instead of waiting for
the user.

The repository already tracked whether this attempt reached CONNECTED.
It is now exposed as hasConnectedThisAttempt and is the verdict, so a
drop straight after connecting is left to the connection's own
reconnect.
W16AAPPLE-93: keep the relay's agent offline error out of the chat

Closes W16AAPPLE-93

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!25
W16AAPPLE-94: count an attempt that reached CONNECTED as connected

Closes W16AAPPLE-94

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!26
Added NetworkDropTest, which cuts the network mid-reply and checks the
app backs off, reconnects once it's back, and gets the missed frames
replayed with nothing doubled. Covers the socket failing straight away
and going silent until the ping times out.

Moved the setup shared with RelayFailoverTest into RelayResumeTestBase.
W16AAPPLE-25: test recovery from a dropped network

Closes W16AAPPLE-25

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!27
W16AAPPLE-92 - Failed image and file messages should appear as a retry option at the end of the chat

Closes W16APPLE-92

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!24
Henry and others added 29 commits November 10, 2026 18:34
W16AAPPLE-44: push notifications when waiting for approval

Closes W16AAPPLE-44

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!77
Resolve W16AAPPLE-78 "Deep link domain"

Closes W16AAPPLE-78

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!76
Resolve W16AAPPLE-111 "Qr straight to invite"

Closes W16AAPPLE-111

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!75
Resolve W16AAPPLE-98 "Direct agent address"

Closes W16AAPPLE-98

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!79
Resolve W16AAPPLE-89 "Conversation switch filing"

Closes W16AAPPLE-89

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!78
…ain'

Resolve W16AAPPLE-39 "Switch between agent and workroom"

Closes W16AAPPLE-39

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!80
Resolve W16AAPPLE-34 "Provider messages artifacts"

Closes W16AAPPLE-34

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!83
…esign

A turn's thoughts, tool calls, intent and answered approvals now fold into
one block. While the turn runs it shows a live "Working… 12s · step 5"
header over its newest steps; once finished it collapses to a "Worked for
16s · 7 steps" summary above the answer, which opens on tap and keeps that
choice while the user stays in the chat. History loads collapsed, a turn
with no answer stays open, and approvals waiting on the user are never
folded away.

The chat screen is restyled to the design: user messages in a tinted
bubble, agent replies as plain text with a copy/time/usage footer, a
rounded composer with Stop in the send slot mid-run, the status dot on the
top bar's status line, no "Beginning of conversation" label, day dividers
only when a chat spans days, and Inter (bundled, OFL) as the app font.

Tests cover running vs finished turns and TalkBack on the summary;
screenshot baselines are re-recorded for the new font.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- docs: design-system.md's Type section, Radii and test table now describe
  bundled Inter (reversing W16AAPPLE-49, ~1.7MB in the APK, OFL licence
  in assets) and the composer's 22dp radius; regression-suite.md agrees.
- USER_GUIDE.md and README.md describe the new chat: the round Stop
  button, "Queue a follow-up…", the live "Working…" steps and the
  "Worked for … · N steps" summary and how to open it. The chat
  screenshots in screenshots/ are now rendered by UserGuideScreenshotTest
  in the new look, plus a new turn-steps-summary.png.
- Saved scroll positions on a step that has since folded restore to its
  step block (TurnStepGroups.foldedInto) instead of falling back to an
  index that now points elsewhere.
- A turn waiting on a live Work Room run or an unanswered question counts
  as running, so it is not summed up as "Worked for …" mid-run.
- Tests now catch the breaks that went unnoticed: a Work Room approval
  folded away, a mid-run choice keeping a finished turn open, day
  dividers on a one-day chat, and the scroll restore; each fails when its
  behaviour is reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
removed unused field and related code

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!81
W16AAPPLE-112: collapse finished turn steps and restyle chat to the design

Closes W16AAPPLE-112

See merge request coursework/comp3900/26t3/capstone-projects/3900-w16a-apple/project!85
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.

4 participants