Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(swift-ios): show last message age on the thread activity row #14021

Closedsaphid(GitHub profile, opens in a new tab)wants to merge 250+ commits intot3code/rebuild-mobile-app-swift fromrefs/pull/14021/headopened View on GitHub

Review this layer

GitHub shows this PR against t3code/rebuild-mobile-app-swift, so its diff includes every earlier PR in the chain. Review only this layer's change:

This layer's diff: +90 / −68 lines across 6 files; app code +62 / −63, the rest is tests and docs.

Show time since the latest conversation message beneath “Agent is working” at the end of the transcript, and remove the thread-header receipt line added in #10766. Snapshot and connection receipts do not reset the message age; a new user or assistant message that is not queued does. The label wakes only at displayed unit boundaries (second, minute, hour, day), and the activity row disappears when work finishes. The user guide now describes the message age instead of the header receipt.

Delivery: stacked. This branch contains #10758, #10759, #10761, #10762, #10763, #10764, #10765, #10766; merge the chain in order (#10758 → #10759 → #10761 → #10762 → #10763 → #10764 → #10765 → #10766 → #14021 → #10767). Each PR's own change is its top commit(s).

Split from #10766 (2026-09-28). This is the second concern of the original #10766 (its last two commits, squashed because the second undid most of the first), plus the user-guide update. The code is byte-identical to those commits, and the chain top is unchanged apart from that guide paragraph.

Current layout, 9eab0475d:

Current thread: last-message age beneath agent activity

Same native WorkspaceView flow on the previous PR revision 578f1c68c and current 9eab0475d: receive a snapshot, append a conversation message, then finish work. Synthetic data; iPhone 17 Pro Simulator / iOS 26.5, dark mode, full 402×874-point viewport scaled to 390 pixels wide. Recordings play at real time; GIFs sample 12 fps. A three-second hold of the final captured frame makes the idle result readable. No taps are simulated in this event-driven fixture.

Before — prior header receipt presentation. This baseline recording includes transient incomplete redraws; their cause is unconfirmed and this PR does not claim to fix them. The current-head recording below is clean through idle:

Before: prior thread-header receipt presentation

After — age beside transcript activity, then clean idle state:

After: snapshot leaves message age unchanged; new message resets it; completion clears activity

Before clean video · After clean video · Captioned after video · Idle screenshot · Capture/edit receipt

Focused verification: candidate capture plus two message-age tests passed (3 tests, xcodebuild exit 0); matching previous-revision capture passed (1 test, exit 0). Tests cover conversation-message selection, queued/tool/system exclusions, future clock skew, and elapsed-unit formatting. CI passed on that original revision. The clock wakes at displayed unit boundaries. No live-backend or physical-device performance measurement is claimed.

Capture limits: earlier current-head captures contained incomplete redraws and were rejected; the replacement recording-only flow was inspected through completion. Xcode compiler-probe stalls required retries. An earlier capture fixture overfulfilled its navigation expectation; that fixture was corrected before the passing runs.

Verification

  • Focused tests at this head (2e25d10a9e's code; FeatureMessageAgeTests, FeatureThreadReceiptTests, NativeTranscriptTimelineTests, FeatureRootModelTests, NativeRetryIdentityTests, iOS Simulator): 23 XCTest and 126 Swift Testing tests passed.
  • Full T3CodeTests at the chain top (68d92c2752): 343 XCTest cases passed (1 skipped). Swift Testing ran 892 tests; the only 2 failures are UsageModelsTests currency formatting, which fail identically on unmodified 157476f1fb.
  • Split check: GPT-6 Astra (codex exec -m gpt-6-astra -c model_reasoning_effort="xhigh" --sandbox read-only) confirmed that the chain top's code is identical to the pre-split top, that this layer's code diff is byte-identical to the two original commits, and that the user guide matches each layer's UI. Its one finding (#10766 did not compile on its own) was fixed, and a re-check returned ready.

Model and harness: GPT-6 / Codex (original change). Split, guide update and verification: Claude Opus 5.5 / Claude Code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. @@ -1010,15 +1202,18 @@
      1202+ let threadID = key.threadID
      10101203 if pendingSubmissionsByID.values.contains(where: {
      10111204 $0.threadID == threadID && $0.creation != nil
      10121205 }) {
      10131206 await stopOutboxDrain()
      1207+ defer { scheduleOutboxDrain() }
      10141208 let queued = pendingSubmissionsByID.values.filter { $0.threadID == threadID }
      1209+ var discardedAll = true
      10151210 for submission in queued {
      10161211 if !(await discardQueuedSubmission(submission)) {
      1212+ discardedAll = false
      10171213 scheduleOutboxRetry()
      10181214 }
      10191215 }
      1216+ guard discardedAll else { throw FeatureStopStatusUnavailableError() }
      10201217 if pendingThreadsByID[threadID] == nil,
      10211218 snapshot.threads.contains(where: { $0.id == threadID }) {
      1022- await perform {
      1023- try await client.cancelTurn(threadID: threadID)
      1024- }
      1219+ try await client.cancelTurn(threadID: threadID)
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High Root/FeatureRootModel.swift:1219

      cancelClaimedTurn can cancel a newer turn instead of the claimed key.turnID when a pending creation appears in snapshot while its outbox entry is being removed. This path calls client.cancelTurn(threadID:) without an expected turn ID, so pass expectedTurnID: key.turnID to reject the cancellation if the turn changed.

      Suggested change
      1219- try await client.cancelTurn(threadID: threadID)
      1219+ try await client.cancelTurn(threadID: threadID, expectedTurnID: key.turnID)
      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/swift-ios/Features/Root/FeatureRootModel.swift around line 1219:
      
      `cancelClaimedTurn` can cancel a newer turn instead of the claimed `key.turnID` when a pending creation appears in `snapshot` while its outbox entry is being removed. This path calls `client.cancelTurn(threadID:)` without an expected turn ID, so pass `expectedTurnID: key.turnID` to reject the cancellation if the turn changed.
      @@ -6122,11 +7057,6 @@
      61227057 let messages = thread.messages.map {
      61237058 mapMessage($0, environmentID: environmentID)
      61247059 }
      6125- let workIsLive = thread.session?.status == "starting"
      6126- || thread.session?.status == "running"
      6127- || backgroundLiveness(threadID: thread.id, environmentID: environmentID) == .working
      6128- let activities = thread.activities.compactMap {
      6129- NativeActivityNotice.message($0, createdAt: parseDate($0.createdAt))
      6130- }
      6131- + collapsedWorkLogs(thread.activities, sessionIsLive: workIsLive)
      6132- return (messages + activities).sorted { $0.createdAt < $1.createdAt }
      7060+ // Older pages contain earlier turn windows, but carry current session
      7061+ // metadata. That metadata must not revive their historical tool rows.
      7062+ return NativeTranscriptTimeline(
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium App/NativeFeatureClient.swift:7062

      Historical pagination renders a completed-looking work-log row for a start-only tool.started activity instead of omitting it. renderedHistoryMessages passes sessionIsLive: false, and NativeTranscriptTimeline freezes active work in finishActiveWork(), so current-session activity carried by older pages becomes a stale transcript row; preserve the inactive-path behavior that drops active-only work before rendering history.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/swift-ios/App/NativeFeatureClient.swift around line 7062:
      
      Historical pagination renders a completed-looking work-log row for a start-only `tool.started` activity instead of omitting it. `renderedHistoryMessages` passes `sessionIsLive: false`, and `NativeTranscriptTimeline` freezes active work in `finishActiveWork()`, so current-session activity carried by older pages becomes a stale transcript row; preserve the inactive-path behavior that drops active-only work before rendering history.
    3. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This is a large Swift iOS runtime and UI overhaul rather than a narrowly scoped display fix, introducing new cancellation semantics, transport reconciliation, transcript reconstruction, and presentation lifecycle behavior across production paths. Unresolved threshold-level correctness findings add further risk to the central client and stop flow.

      Not approved because:

      • 2 blocking correctness issues found at or above your repo's Minimum Blocking Severity
      Adjust the Minimum Blocking Severity for this repo — including turning it Off — in [Settings](https://app.macroscope.com/pingdotgg/settings#Repos). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. @t3dotgg heads-up: #10766 had two concerns, so it's now split.

      • #10766 keeps thread receipts and chronological tool history (retitled).
      • #14021 (new, stacked directly on #10766) carries the last-message age on the activity row. It's the same code as #10766's last two commits squashed, plus a user-guide update. The chain top's code is unchanged; GPT-6 Astra xhigh (read-only) confirmed that, and CI is green on the new heads.

      New merge order: #10758 → #10759 → #10761 → #10762 → #10763 → #10764 → #10765 → #10766 → #14021 → #10767. #12655 stays independent.

      Each PR's GitHub diff includes the whole chain below it, so every description now starts with a link to that layer's own change:

      PROwn changeLines
      #10758layer diff+992/−29
      #10759layer diff+522/−31
      #10761layer diff+2558/−464
      #10762layer diff+123/−2
      #10763layer diff+1257/−42
      #10764layer diff+711/−56
      #10765layer diff+4060/−25
      #10766layer diff+807/−330
      #14021layer diff+90/−68
      #10767layer diff+290/−77
    5. Note

      This comment is posted by Julius' dot

      The linked six-file layer diff explains the message-age change, but the complete PR targets 285d2ab and diverges from it at 901db89, including the Swift client foundation, workflow, and earlier repairs. Please confirm the intended upstream baseline for this whole stack and restack it there, or explain the intended cumulative integration. That is needed to assess the complete PR under one problem; the isolated top-layer diff cannot establish that by itself. Leaving this open pending clarification.

    6. Note

      🤖 GPT-6.1-Sol responding on behalf of Theo

      Closing this to keep the SwiftUI rewrite aligned with React Native. This adds a last-message-age label to the thread activity row. React Native has no equivalent label, and the receipt header this replaces is absent from the current SwiftUI branch.

      For reconsideration, show a concrete parity defect on the current branch and submit only the correction.

      See the contribution scope guidance.

Sign in to join this conversation.