Skip to content

Show provider activity in chat turn tails - #19055

Merged
brennanb2025 merged 8 commits into
mainfrom
brennanb2025/chatui-8c-provider-activity-text
Sep 6, 2026
Merged

brennanb2025 merged 8 commits into
mainfrom
brennanb2025/chatui-8c-provider-activity-text

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​580 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​575
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​426 $\color{#cf222e}{\Huge{\mathbf{−}}}$​44 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​382

ELI5

The chat tail now shows a short description of what Codex or Claude is actually doing instead of only showing “Working…”. These updates stay ephemeral, so the transcript remains clean.

What Changed

  • Derived bounded activity copy from Codex MCP progress, item starts, and reasoning-summary frames.
  • Derived bounded activity copy from Claude task, status, control-progress, and tool-progress frames.
  • Routed latest-wins activity through the existing structured session subscription as an optional field.
  • Suppressed activity that repeats the active or most recently settled tool label.
  • Cleared activity at turn settlement while preserving the existing “Working…” fallback.

Why

#19044 added the turn-scoped tail, but provider-authored status frames were intentionally excluded from journal rows to avoid protocol noise. This keeps that transcript-cleanliness boundary while giving the tail a separate ephemeral signal.

This PR is stacked on and builds on #19044.

Linked Issue

Builds on #19044; no separate issue was supplied.

Visual Proof

Codex real activity:

Codex activity

Claude real activity:

Claude activity

Codex settled with the tail cleared:

Codex settled

Claude settled with the tail cleared:

Claude settled

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • macOS hidden Electron/CDP, session act8c: Codex showed Drafting a response and Running a command; Claude showed Working on: Read activity length constant and Requesting a response.
  • Confirmed the fallback still appeared before usable activity and after an unusable tool-progress frame.
  • Confirmed activity-only transitions did not add provider-frame rows: Codex journal counts were 3 → 4 → 4 while activity changed, and Claude stayed at 5 across fallback/requesting transitions.
  • Confirmed both turns settled and removed the tail.
  • pnpm test <13 focused files>: 105 tests passed, including the cross-version agent-session wire harness.
  • pnpm tc:node
  • pnpm tc:web
  • npx oxlint <changed paths>
  • pnpm exec oxfmt --check <changed paths>

AI Disclosure

N/A — internal contributor.

Review

Please review the ephemeral state lifecycle, provider text bounding, and mixed-version behavior.

The activity copy is bounded and filtered for protocol noise, but is not secret-redacted: it renders provider text as-is, matching how reference agent hosts surface derived status copy.

Agent skill upstream boundary

  • Not applicable.

Notes

  • Wire compatibility: this adds only optional activity data to the existing agentSession.subscribe snapshot/batch/reset JSON events. It adds no opcode or capability; older clients ignore the field, and newer clients retain the existing fallback when older hosts omit it.
  • SSH and folder workspaces use the same execution-host-owned structured session publication path; no filesystem or local-only assumption was added.
  • No platform-specific logic was added. Linux, Windows, SSH, and folder-workspace UI flows were not manually exercised.
  • PR author: @BrennanKB5

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after behavior and settlement screenshots are attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Full pnpm lint and pnpm build deferred to CI; focused lint, typechecks, and tests pass

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — two minor lifecycle edge cases worth a look, noted inline.

Reviewed changes

  • Provider activity derivation — provider-frame-activity.ts derives bounded, redacted activity copy from Codex (item/started, item/mcpToolCall/progress, reasoning summary deltas) and Claude (task_*, status, control_request_progress) frames, with a defensive allowlist/redaction pass over provider display fields.
  • Activity routing — translators call the new optional sink.setActivity?.(), coalesced in the event sink and published as an optional activity field on snapshot/batch/reset events (additive, mixed-version safe).
  • Subscriber state — AgentSessionSubscribers tracks latest-wins activityBySession and re-attaches it on open/checkpoint/reset.
  • Renderer projection — selectStructuredAgentTurnActivity prefers provider activity and suppresses text that repeats a recent tool label; the reducer carries activity on the session state.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

...(handoff ? { handoff } : {}),
...(backgroundTasks !== undefined ? { backgroundTasks } : {})
...(backgroundTasks !== undefined ? { backgroundTasks } : {}),
...(publishedActivity !== undefined ? { activity: publishedActivity } : {})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The per-subscriber reset path here drops activity when the publish that triggered it carried none — publishedActivity is undefined for journal-only publishes (activity undefined, emitCheckpoint false). The reducer's replacePage maps a missing field to activity: null, so the client clears live activity even though the host still holds it in activityBySession. The public reset() / snapshot() / open() paths all attach activityField(sessionId); this branch is the outlier.

Technical details
# Reset emitted from `deliver` drops live activity

## Affected sites
- src/main/native-chat/agent-session-wire/structured-agent-session-subscribers.ts:252 — reset branch only spreads `activity` when `publishedActivity !== undefined`.

## Required outcome
- A reset emitted from `deliver` preserves the current activity (or falls back to `activityBySession`), matching `reset()`/`snapshot()`/`open()`.

## Suggested approach (optional)
- In the `!result.ok` branch, spread `publishedActivity ?? this.activityBySession.get(subscriber.sessionId)` (or `...this.activityField(subscriber.sessionId)`).


export class AgentSessionSubscribers {
private readonly bySession = new Map<string, Map<string, Subscriber>>()
private readonly activityBySession = new Map<string, AgentSessionTurnActivity>()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

activityBySession is only evicted when settlement clears it (setActivity(null)) or a newer value overwrites it; close()/drop() never prune it. A session evicted mid-turn leaves a bounded entry (turnId + ≤160-char text) behind for the process lifetime, and a later open() snapshot (activityField) re-surfaces that stale state. Worth pruning on last-subscriber drop or session eviction.

Merge Sim added 3 commits September 6, 2026 11:29
A Codex reasoning summary streams as a bold headline followed by body text.
Folding the whole summary into the tail leaked literal ** markers and body
prose; only the first non-empty line is activity copy, and an unterminated
bold header mid-stream is unwrapped too.

Redaction used a hyphen for GitHub token prefixes (they use an underscore),
and missed fine-grained GitHub tokens, AWS access key ids, JWTs, URL
userinfo passwords, and bare token= values.
A bold headline still streaming has no closing marker yet; holding the
previous activity copy until it lands avoids flashing a half word.
…c-provider-activity-text

# Conflicts:
#	src/renderer/src/components/native-chat/native-chat-turn-activity.test.ts
#	src/renderer/src/components/native-chat/native-chat-turn-activity.ts
#	src/renderer/src/components/native-chat/use-structured-agent-session.ts
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/chatui-8b-working-activity-line to main September 6, 2026 18:43

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this delta — the redaction widening and reasoning-headline handling are correct and well-tested. The two minor lifecycle edge cases flagged in the prior review remain open (unchanged by these commits).

Reviewed changes

  • Reasoning headline extraction — reasoningHeadline now holds the previous activity copy while a bold headline streams in unclosed, then emits only the completed single-line headline, avoiding both half-rendered **…** markup and flicker in the tail.
  • Widened secret redaction — corrected the GitHub token prefix to the underscore form (ghp_/gho_/ghu_/ghs_/ghr_, previously a wrong hyphen), and added github_pat_, AWS AKIA access keys, JWTs, URL userinfo credentials, and token= key-value secrets.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 1e31340d-1833-4d22-b8c1-d8904db58c16

📥 Commits

Reviewing files that changed from the base of the PR and between a88c6fe and 8cc2ad7.

📒 Files selected for processing (5)
  • src/main/codex/codex-structured-journal-translation.ts
  • src/main/native-chat/agent-session-wire/provider-frame-activity.ts
  • src/main/native-chat/agent-session-wire/provider-turn-activity-routing.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-subscribers.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-subscribers.ts
📝 Walkthrough

Walkthrough

The change adds ephemeral provider-authored turn activity for Codex and Claude. Provider frames are normalized, redacted, bounded, and mapped to activity text. Activity flows through the event sink, subscriber transport, coalescer, and reducer without advancing journal rows. The renderer selects matching activity and filters repeated tool labels. Tests cover extraction, routing, transport, state projection, and rendering.

Merge Risk: 🟡 Moderate · up to a88c6

Provider activity may expose credentials or private material in chat turn tails. Redaction must cover every activity-text return path before this is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 20 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: displaying provider activity in chat turn tails.
Description check ✅ Passed The description is complete and relevant. It covers the motivation, implementation, testing, visual proof, compatibility, and checklist items. It references issue #19044 as the related stacked PR, alt…
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 73fad21c-b957-4fb8-8f55-0882a762fe12

📥 Commits

Reviewing files that changed from the base of the PR and between 0c33f58 and e396b56.

📒 Files selected for processing (20)
  • src/main/claude/claude-structured-journal-translation.ts
  • src/main/codex/codex-structured-journal-translation.ts
  • src/main/native-chat/agent-session-wire/provider-frame-activity.test.ts
  • src/main/native-chat/agent-session-wire/provider-frame-activity.ts
  • src/main/native-chat/agent-session-wire/provider-turn-activity-routing.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-attach-context.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-attach-orchestration.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-event-sink.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-event-sink.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-handoff.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-subscribers.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-subscribers.ts
  • src/renderer/src/components/native-chat/native-chat-turn-activity.test.ts
  • src/renderer/src/components/native-chat/native-chat-turn-activity.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session.ts
  • src/shared/agent-session-wire.ts
  • src/shared/structured-agent-session-coalescer.test.ts
  • src/shared/structured-agent-session-coalescer.ts
  • src/shared/structured-agent-session-reducer.test.ts
  • src/shared/structured-agent-session-reducer.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

.replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, '[redacted]')
.replace(/(:\/\/[^\s/:@]+:)[^\s@/]+@/g, '$1[redacted]@')
.replace(
/\b(api[_ -]?key|access[_ -]?token|token|secret|password|authorization)(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|\S+)/gi,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- provider-frame-activity.ts ---'
cat -n src/main/native-chat/agent-session-wire/provider-frame-activity.ts | sed -n '1,175p'
printf '%s\n' '--- provider-frame-activity.test.ts ---'
cat -n src/main/native-chat/agent-session-wire/provider-frame-activity.test.ts | sed -n '1,120p'

Repository: stablyai/orca

Length of output: 12160


Sensitive Data Exposure (CWE-200): Exposure of Sensitive Information to an Unauthorized Actor

Reachability: External · Exploitability: Moderate

Redact underscore-delimited credential fields.

private_key=... and client_secret=... bypass the current redaction pattern and can reach visible activity text. Add both field names and test both forms.

Proposed fix
-      /\b(api[_ -]?key|access[_ -]?token|token|secret|password|authorization)(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|\S+)/gi,
+      /\b(api[_ -]?key|private[_ -]?key|client[_ -]?secret|access[_ -]?token|token|secret|password|authorization)(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|\S+)/gi,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/\b(api[_ -]?key|access[_ -]?token|token|secret|password|authorization)(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|\S+)/gi,
/\b(api[_ -]?key|private[_ -]?key|client[_ -]?secret|access[_ -]?token|token|secret|password|authorization)(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|\S+)/gi,

Reference agent hosts render provider-derived status text unredacted;
this table was the only one of its kind and its GitHub pattern matched
no real token. Bounding and the reasoning-headline extraction stay.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 675f97d9-f959-4d07-842c-0b26654a986d

📥 Commits

Reviewing files that changed from the base of the PR and between e396b56 and a88c6fe.

📒 Files selected for processing (2)
  • src/main/native-chat/agent-session-wire/provider-frame-activity.test.ts
  • src/main/native-chat/agent-session-wire/provider-frame-activity.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.

}
const characters = Array.from(unwrapped)
if (characters.length <= MAX_PROVIDER_ACTIVITY_LENGTH) {
return unwrapped

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
sed -n '1,135p' src/main/native-chat/agent-session-wire/provider-frame-activity.ts
printf '\n-- redaction references in the bounded area --\n'
rg -n -i 'redact|credential|bearer|jwt|secret' src/main/native-chat/agent-session-wire src/shared/agent-status-field-normalization.ts

Repository: stablyai/orca

Length of output: 5574


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '-- activity consumers and tests --'
rg -n -C 4 'codexProviderFrameActivity|claudeProviderFrameActivity|providerActivityText|turn tail|activity' \
  src/main/native-chat/agent-session-wire/provider-frame-activity.ts \
  src/main/native-chat/agent-session-wire/provider-frame-activity.test.ts \
  src/main/native-chat/agent-session-wire/provider-turn-activity-routing.ts \
  src/main/native-chat/agent-session-wire/provider-turn-activity-routing.test.ts 2>/dev/null || true

Repository: stablyai/orca

Length of output: 21525


Sensitive Data Exposure (CWE-200): Exposure of Sensitive Information to an Unauthorized Actor

Reachability: External · Exploitability: Moderate

Restore secret redaction before returning provider activity.

Provider messages, reasoning headlines, and task descriptions reach setActivity without secret redaction. Apply redaction before both return paths, and restore credential regression cases in src/main/native-chat/agent-session-wire/provider-frame-activity.test.ts.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this delta — removing the bespoke secret redaction is a defensible tradeoff. The two minor lifecycle edge cases from the prior review remain open (unchanged by these commits).

Reviewed changes

  • Dropped bespoke secret redaction — redactSecrets and its redaction tests were removed; providerActivityText now returns the bounded, protocol-filtered display copy verbatim.

ℹ️ Removing redaction is consistent with the ephemeral-signal design

The activity copy never reaches the journal or SQLite: AgentSessionSubscribers.publish fans it out as an optional activity field while leaving journal.cursor() untouched, which publishes latest turn activity without advancing or adding journal rows asserts explicitly. It is bounded to MAX_PROVIDER_ACTIVITY_LENGTH and derived only from provider display fields (reasoning headline, task description, MCP progress message), never raw tool output. Any secret it could echo originates in the user's own session and is already visible in their transcript, and the field only flows to the user's own paired clients — the residual exposure is tool-authored mcpToolCall/progress text, which is likewise local and ephemeral. Rendering as-is is therefore a reasonable tradeoff.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this delta — the bounded reasoning-headline reader, its lifecycle resets, and the explicit reconnect clearing are correct and well-tested. The two minor lifecycle edge cases from the prior review remain open, unchanged by these commits.

Reviewed changes

  • Bounded reasoning-headline reader — createCodexProviderActivityReader accumulates only the current Codex reasoning-summary headline (capped at 2 × MAX_PROVIDER_ACTIVITY_LENGTH + 16), replacing the previous items.streams.snapshot(...) call so token deltas never materialize the growing transcript.
  • Reader reset at lifecycle boundaries — the Codex translator recreates the reader on restoreThread, ended, turn start, and turn completion for the primary thread, so stale reasoning state is discarded at every session/turn seam.
  • Explicit activity clear on reconnect — activityField and the deliver checkpoint branch now emit activity: null instead of omitting the field, so a reconnecting subscriber explicitly clears any stale live activity.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron QA (hidden CDP)

SHA under test: 8cc2ad7484cd62c376a269823e32c5cd4c8bde02
First pass launched at a88c6fe773; HEAD moved to the reconnect/headline-bound fix, so the owned Electron process was recycled and Codex activity + reconnect-clear were re-run on 8cc2ad7. Real Codex/Claude structured chats, isolated profile, ORCA_BACKGROUND_LAUNCH=1, CDP 9334 / renderer 5176. No OS interaction. Full report: /tmp/pr19055-electron.md.

Codex — Working fallback

Codex Working fallback

Codex — real activity (Running a command distinct from the tool row)

Codex Running a command

Codex — settlement (tail cleared)

Codex settled

Claude — real activity (Requesting a response)

Claude Requesting a response

Claude — settlement (tail cleared)

Claude settled

Reconnect on 8cc2ad7 (no stale activity tail)

Reconnect no stale activity

Codex rerun on 8cc2ad7 — Drafting a response

Codex Drafting a response rerun

Codex rerun on 8cc2ad7 — settled

Codex settled rerun

Journal: Codex 10 items / Claude 6 items; providerFrameCount=0; activity copy not present as transcript rows.

SSH: optional activity on existing subscribe JSON. Structured launch still requires executionHostId === 'local', so a throwaway Linux SSH target would not create this pane. Docker is available; CLIs/credentials/relay plus that client route are the gap.

Mobile: no mobile files in the diff.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Evidence precision (screenshot 11)

Screenshot 11 is restart after settlement, not a mid-turn reconnect-clear:

  • The hidden app was stopped and relaunched after Codex and Claude turns had already settled.
  • Restored tabs were Done with settled transcripts and no activity tail.

That does not prove missed-clear while the same turn remains active. That precise case is covered by automated subscriber regressions, not by this screenshot.

Live Codex on 8cc2ad7484 (Working… → Drafting a response → Running a command → settle) and live Claude on the first pass (Requesting a response → settle) remain the activity/settlement evidence.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review complete — code clean at 8cc2ad7484

Completed a scoped review/fix loop and independent readiness audits at the start and end. The second code review returned clean, and the final readiness code verdict is PASS with no proven remaining in-scope issues. No feature expansion or unrelated refactor was added.

Pushed three meaningful fixes in 8cc2ad7484cd62c376a269823e32c5cd4c8bde02:

  • Removed full accumulated-stream copying from activity processing. A deterministic 300-token regression measured 300 snapshot calls before, zero after. The reader retains only a bounded current headline and stops publishing its body.
  • Made later reasoning summary parts replace the earlier headline, with lifecycle resets.
  • Published explicit null activity in reconnect checkpoints so a missed clear cannot leave stale copy.

Validation: 71 focused tests plus 13 cross-version structured-session tests passed (84 total); node and renderer typechecks, focused lint, commit hooks, and whitespace checks passed. The new regression tests were verified to fail against the original implementation.

Rendered evidence: the Grok worker used hidden Electron/CDP, an isolated profile, real provider sessions, and the native-chat composer. Screenshots are attached in the QA comments. Codex was rerun on the final commit through Working → Drafting a response → Running a command → settlement with the tail cleared. Claude Requesting a response → settlement was tested on the earlier commit; its translator was unchanged by the fixes. Both settled chats restored without stale tails on the final commit. First-pass journal inspection found no activity-copy or provider-frame rows.

Coverage limits: restart-after-settlement is not proof of a missed clear during the same active turn; that case, reasoning-headline boundaries, and exact tool-label suppression have automated coverage. Claude task-start copy/tool-progress fallback were not observed live. Windows, Linux, direct SSH, native mobile, and separate folder-workspace UI were not exercised. Direct SSH structured-chat launch is already restricted by the existing local-only launch route; this PR does not change that restriction. Full build/lint remain CI responsibilities.

QA app processes and ports were verified clear, and the owned temporary profile/repo were removed. The incidental local lockfile modification was excluded from the pushed fix. No merge was performed.

@brennanb2025
brennanb2025 merged commit f7d5216 into main Sep 6, 2026
28 checks passed
brennanb2025 pushed a commit that referenced this pull request Sep 7, 2026
Main's #19055 added a `subAgentActivity` arm to the provider activity table,
which is reached only through `publishActivity`. The roster's admission returned
above that call, so every `subAgentActivity` item bypassed it and a fan-out that
reports nothing else left the turn tail stuck on the previous frame's text.

`publishActivity` already no-ops on a refused admission and on a non-primary
thread, so routing the roster's admission through it is safe.

Also corrects a docstring the frames extraction copy-pasted onto
`settleOversizedNotification`.
brennanb2025 added a commit that referenced this pull request Sep 7, 2026
#18773)

* feat(native-chat): show Codex subagent activity instead of opcode rows

Codex spawns subagents and reports their lifecycle, but Orca rendered only
gray `codex · item:subAgentActivity` opcode rows. Build the real display: one
summary row per spawn group with a live working count and token usage.

State is accumulated from `subAgentActivity.kind` alone. A live probe against
app-server 0.152.1 showed `agentsStates` arrives empty even in a real subagent
run, and that every activity item is delivered twice (item/started and
item/completed), so every transition is idempotent and terminal states latch.

Children never receive `thread/started`, so there is no nickname, role, or
depth to read; the row labels from the trailing segment of `agentPath`.

Two sweeps keep a row from claiming work forever: the parent turn's terminal
event settles still-running children, and session start marks a pre-restart
roster unverifiable rather than exited, since Codex resume replays no
non-message items and no event can ever settle them.

The roster rides a new NativeChatBlock variant paired with a plain-text twin.
A journal item kind could not be used: that union is closed, and an unknown
kind parses as malformed, which is the corrupt-journal class that can hide the
chat tab. Block types are explicitly admissible when unknown, so an older
client drops the block and renders the sentence.

MessageRow moves out of NativeChatMessageList to keep both files under the
max-lines budget without a disable.

* feat(native-chat): give the subagent summary row its bot glyph

The row led with a glyph that swapped on state — a check once every child
completed, a group icon otherwise — so a group appeared to change identity
the moment it settled. Per the approved mock, the glyph names the category
and never moves: state is carried by the status dot and the tone of the
words beside it.

Use lucide `bot`, the same glyph the individual `subAgentActivity` rows take
in the eight-category vocabulary, so the summary reads as their parent. Slot
and glyph are the mock's 16px/14px, muted by default, and the svg is
`aria-hidden` — the headline is what a screen reader announces, so the icon
never stands alone.

* fix(native-chat): correct the Codex subagent roster's build, journal write, and failure reporting

* Restore the exhaustive block handling that adding `subagent-group` to
  `NativeChatBlock` broke. `formatWorkerTranscriptMessage` and `boundBlock`
  both fell through to `image-ref` field access, so `tsc -p` failed for the
  CLI and node projects and `build:cli` could not emit. Both now guard on
  `image-ref` explicitly and give the roster block its own branch.

* Stop the roster's publish from evicting its own append. The sink queue
  coalesces by `coalescingKey` alone with no op-kind check, so passing the
  append's key to `tryPublish` spliced the queued append out and the row
  never reached the journal — permanently, since `lastSerialized` was
  already set. `tryPublish()` now takes no argument, matching every other
  call site. The regression test's fake sink honours the key, which the
  previous fake did not.

* Keep `collabAgentToolCall` substantive. Only the MultiAgentV2 path emits
  `subAgentActivity`, so a V1 turn has no roster row; suppressing its collab
  tool calls too would have left a V1 fan-out showing nothing at all.

* Surface a settled failure while siblings still work. The summary now
  reports the worst adverse outcome independently of the group verdict, so
  the row shows `3 working +1 failed` with a failed-coloured dot instead of
  a neutral pulsing dot. The plain-text twin names it too.

* Treat `/morpheus` as a child. Only `/root` is the turn itself; the old
  segment-count test silently dropped a valid single-segment agent.

* Refresh token-usage recency on update so an active thread is not evicted
  as the oldest entry, and scope the `agentsStates` comment to the V2 path.

* fix(native-chat): stop the subagent roster announcing a new duration every second

The roster row is an `aria-live="polite"` region and it contains the elapsed
clock, which reticks once a second for as long as the fan-out runs. A screen
reader therefore reads out a fresh duration every second, burying the state
changes the live region exists to report — the headline, the verdict, and the
`+1 failed` alert.

No other live region in the transcript does this. `NativeChatToolRun`'s live
button holds only the active tool label, and in `NativeChatWorkingStatus` the
variant that shows a duration is precisely the one with no `aria-live`.

Hide the clock from the accessibility tree only while it is moving. Once the
group settles the duration is fixed, so it stays readable and costs no
announcements.

* fix(native-chat): retry a refused roster publish, and stop two wrong readings

Four defects from a third review pass over the Codex subagent roster.

`write()` set `lastSerialized` before the append and rolled it back only when
the APPEND was refused. A refused PUBLISH left it set, so an identical replay
short-circuited and the revision was never published again. The repo's own
pattern is the opposite: `codex-structured-item-streams.ts` advances
`checkpointLengths` only once the append AND the publish are both accepted.
Roll back on either half.

That alone did not cover the sweep, which is the LAST event a group ever gets:
its `changed` guard skips the write on a retry because every child has already
latched, stranding the settled roster's final revision. Write when the previous
attempt was refused part-way, too.

`formatWorkerTranscriptMessage` read `block.agents` as its exhaustive fallback.
The journal schema deliberately admits block types this build does not know and
`client.call` casts the RPC result instead of validating it, so a newer remote
host's block reached that line and threw `agents is not iterable`, taking down
the whole `worker read`. It printed a harmless `[image omitted]` before. Match
`subagent-group` explicitly and degrade the unknown case.

The elapsed clock measured to `now` whenever no child carried a terminal
timestamp. That is exactly the roster restored from the journal after the host
died: the reconciler latches `unverifiable` without a `settledAt`, so a child
that ran four seconds reported the time since the crash as its run length, on a
row that is not even counting. Show no duration when none is known.

Also restores package.json to origin/main: the merge had deleted one of main's
two duplicate `bench:terminal-partial-escape-tail` keys. Behaviour-preserving
(JSON is last-wins and the deleted line was the dead one), but unrelated to this
PR and better left to its own change. No gate rejects duplicate JSON keys.

The new refusal tests also cover the append-side rollback, which had none.

* fix(native-chat): stop the subagent roster vanishing from every settled turn

`NativeChatToolRun` bailed out for a completed turn whose activity disclosure
is collapsed before it reached the branch that draws a roster-only run. That
guard exists to push TOOL activity behind the turn-status disclosure, and it
fires on exactly the shape a spawn group has: a roster message carries no tool
blocks, so `selectActiveToolCall` returns null and `isSettled` is true, while
the list passes `expandOverride={expandedTurnIds.has(turnKey)}` — false until
the reader opens that turn — and `activeTurnIsWorking={false}`.

That is the default state of every finished turn in the transcript, so the one
compact row this feature exists to leave behind ("Ran 3 subagents") disappeared
the moment its turn ended. Worse, `MessageRow` counts a spawn group as
renderable specifically so the row survives, then rendered a wrapper around a
component that returned null — the empty ghost bubble its own guard is written
to prevent.

Order the roster branch before the disclosure guard. A roster has no tool
activity to hide, and the guard's reasoning ("a failed child command looked
like the whole response was still running") does not reach it. Runs that do
carry tool blocks still fall through to the guard unchanged, and in practice a
roster never shares a message with them: it is its own `role: 'system'` journal
row and `isToolOnlyMessage` is false for it, so `foldToolMessages` never merges
tool blocks into it.

Also drop childless groups when building the rows, so `subagentRows.length`
stays an honest test of "something will draw" — the roster-only branch returns
a margin-bearing wrapper on the strength of it, and a group with no children
renders null.

Both tests fail with their fix reverted; the existing NativeChatToolRun suite
still passes, so the completed-turn disclosure behaviour is unchanged.

* test(native-chat): cover the subagent roster at the message-list level

Every defect this feature has shipped so far lived in the assembly between
rows, and the row-level suites kept passing through all of them. Loop 4's
regression — a settled roster swallowed by the completed-turn disclosure —
was found by reading the code, not by a test, and an independent visual-proof
run observed the same symptom in the real UI and routed around it rather than
reporting it. `NativeChatToolRun` rendered alone is handed `expandOverride`
and `activeTurnIsWorking` by the test author, so it agrees with whatever the
caller was assumed to pass.

Drive the real component instead. The roster is its own `role: 'system'`
journal row carrying the producer's two blocks (structured + plain-text twin),
so what reaches the DOM depends on `foldToolMessages`, the turn-key mapping
and the disclosure state `NativeChatMessageList` owns — none of which a row
test exercises.

Three cases, on one assembled transcript that holds tool calls AND a roster:
  - a settled turn with activity collapsed, the resting state of the whole
    transcript, still shows the row (fails with loop 4's reorder reverted);
  - tool activity stays behind that disclosure and appears only on expand,
    and expanding draws no second roster (fails with the guard removed);
  - a working turn reads as a live spawn.

The first also pins that the plain-text twin is dropped rather than printed
beside the row it stands in for.

Timestamps are explicit and ascending: the list re-sorts by (timestamp, id),
so rows sharing a millisecond tie-break alphabetically and the user turn can
sort last, stranding the roster outside its own turn and reconciling live
children to `unverifiable`.

No production code changed.

* fix(native-chat): make "counts as renderable" and "actually draws" agree for a spawn group

`MessageRow` counts any `subagent-group` block as renderable, but
`NativeChatSubagentRun` renders null for a childless roster. A group with
`agents: []` therefore mounted a row that drew nothing — an empty div that still
costs the transcript one `gap-5` slot. The Codex producer never writes one (every
`write()` call site operates on a group that already holds an entry), but the
block schema admits `agents: []` with no `.min(1)`, and the wire is where such a
shape would arrive.

Narrow `subagentGroupBlocks` — whose only production caller IS that renderable
check — to the groups that will draw, behind a named `isRenderableSubagentGroup`
that `NativeChatToolRun` now shares in place of its own copy of the predicate, so
the two guards cannot drift apart again. A childless group carrying its
plain-text twin now prints the twin, which is what the twin is for; a bare one
skips the row entirely.

Also correct four comments that had stopped describing the code:
  - the roster header called `agentsStates` "always empty", contradicting the
    probe note in `codex-subagent-activity.ts` — it is empty on the MultiAgentV2
    path that emits these items, and the V1 path does populate it;
  - `tokensByThread` was documented "retained UNCONDITIONALLY" while
    `handleTokenUsage` LRU-caps it 65 lines below;
  - the sweep is not "the LAST event a group ever gets": neither `settleTurn` nor
    `settleSession` removes the group, so a later `thread/tokenUsage/updated`
    naming a swept child still writes it. The retry condition is right; only its
    stated reason was wrong;
  - the `subAgentActivity` classification is not reached "for every event — and
    every one of them arrives twice". `handleSubagentItem` intercepts those items
    before `items.handle`, so the live path never consults the catalog;
    `restoreThread` replays them straight through, and is the real consumer.

Comment-only apart from the childless-group guard.

* fix(cli): stop `worker read` printing the subagent roster sentence twice

The producer ALWAYS writes a roster block beside a plain-text twin carrying the
same sentence, for clients that cannot draw the block. The renderer honours that
contract from one side — it draws the block and drops the twin. The CLI honoured
neither side: it printed the twin as prose AND rendered the block as
`[subagents] <same sentence>`, so a real roster message read

    [system] Ran 2 subagents (1 failed)
    [subagents] Ran 2 subagents (1 failed)

Take the mirror of the renderer's rule, which is the cleaner half for a text
client: the twin IS the sentence, so print it and drop the block it stands in
for. A block that arrives WITHOUT its twin — a shape the wire admits and no
producer writes — still stands in for itself, because dropping it
unconditionally would lose the roster entirely. Either way the sentence prints
exactly once, off the same `subagentGroupFallbackText` helper both sides use.

Unreachable through `readWorkerTranscript` today, whose provider rollout decoder
never emits a `subagent-group` block — but the formatter is the CLI's contract
for any transcript source, and the shape is already producible.

The test pinned a TWIN-LESS group, a body `codexSubagentGroupBody` never writes:
it asserted the exact double-print this fixes was correct output, and would have
blessed either behaviour. Rebuild the fixture as the producer's real two-block
row, with the sentence taken from the shared helper rather than hardcoded so it
cannot drift, and assert the sentence appears exactly once. The twin-less shape
keeps a test of its own, labelled as the wire-only fallback it is.

Also record why `settleTurn` keys on the RAW `turnId` while `groupFor` remaps
off-primary activity onto the primary's active turn. The asymmetry is
load-bearing, not an oversight: were `settleTurn` to remap, a child thread
ending its own turn would sweep the parent group and settle every still-working
sibling to `unverifiable`. The lookup missing is the intended no-op.

* fix(native-chat): add the subagent roster's localization keys and narrow its twin filters

The roster row called 16 `components.native-chat.subagents.*` keys that were
never added to the catalog, failing the localization gate. Synced en.json; the
English strings are the component's own inline fallbacks, so nothing renders
differently.

Also tightens the twin/block handoff on both readers. The renderer dropped
every text block once a roster was present, which is safe only because Codex
writes a roster as its own message — the block is provider-agnostic, so a lane
folding prose in beside one would have lost it on desktop while mobile kept it.
And both readers decided "the twin is already printing" by recomputing the
sentence and comparing bytes, which a roster from a newer build never matches:
its unknown state normalizes to `unverifiable` here, so the CLI printed the
roster twice with two different verdicts. Both now recognize a twin by shape.

* test(native-chat): pin the roster twin recognizer against prose

Both readers use it to decide the twin is already printing, so a false positive
eats a message's real prose and a false negative prints the roster twice.

* docs(codex): restore the roster's evictionated trigger to its KNOWN LIMITATION

The previous rewrite dropped both triggers the old comment named and kept only
the restart one, but eviction is the reachable half: `groupFor` caps `groups` at
MAX_CODEX_SUBAGENT_GROUPS and drops the oldest-INSERTED entry (it returns an
existing group without re-inserting, so this is not LRU), which can evict a
still-live group in-process. The row identity is keyed on the group id alone, so
the next activity item rebuilds that row from one child — the same N-to-1
rewrite, with no restart, and with the sweep skipped so the children never latch
`unverifiable`. Also softens "every real turn id is freshly minted" to the
provider assumption it is: turn ids are read verbatim off provider frames and
nothing in this repo mints or asserts them.

* docs(codex): justify the subagent wire notes from the live probe alone

The roster and disposition comments explained themselves in terms of a
provider-internal path taxonomy rather than anything this repo can observe.
Restate them from the evidence Orca actually has: the live app-server probe
saw `agentsStates` arrive empty, so nothing reads it; and `collabAgentToolCall`
stays substantive because nothing guarantees a session reports subagent work as
`subAgentActivity` at all — one that only emits the collab tool call gets no
roster row, and suppressing that too would leave its fan-out blank.

Same behaviour, same tests; comments and one test name only.

* fix(native-chat): stop the roster's durable twin from claiming live subagents

The spawn-group row is written once and revised in place, but the row itself
is durable and replayed on every reconnect. Its plain-text twin — the only
thing a client that cannot draw the block ever sees — froze a live count into
that row: `Kicked off 4 subagents — 2 working`. The desktop renderer never
shows it, and reconciles the block's `working` to `unverifiable` outside the
live turn. A text-only reader does neither. When the writing process dies
mid-flight the turn-end sweep never runs, so the sentence keeps asserting two
running children forever, with nothing left that could re-check them. That is
the collapse `docs/reference/ssh-execution-boundary.md` forbids: loss of
contact reported as a live state.

Fix it at the source rather than per client: the durable sentence now states
only what survives its process — that the group was spawned, plus whatever
outcome had latched. `Kicked off` vs `Ran` stays, because it reports whether an
outcome was recorded at write time; saying `Ran` while children were in flight
would assert they exited, the same error inverted. The adverse count stays so a
failing fan-out still reads as failing. Reconciliation stays in the renderer,
where the block still needs it.

The twin recognizer keeps matching the legacy `— N working` shape: journals
already hold those sentences and their rows replay forever, so dropping the
branch would print every one of them twice, once as the block and once as prose
the reader meant to drop.

Also align the two functions that read `agentPath`. The root check compared the
raw string while the label normalized separators, so `/root/` was both the turn
itself and a child of it — a phantom row labelled `root` inflating the group by
one. Compare normalized segments instead, keeping `/morpheus` a child. And a
trailing segment with nothing visible in it survives the empty-segment filter
and would draw a nameless row, so it now reads as no label and falls back to the
placeholder.

* fix(codex): key the subagent label collision ordinal on what the row draws

`codexSubagentLabel` tested the trailing segment trimmed but returned it
untrimmed, and `claimLabel` keys its collision ordinal on that string. Two
children at `/root/read` and `/root/ read ` therefore both drew as `read`
with no ordinal — the one thing the ordinal exists to prevent. Return the
trimmed segment so labels that render identically collide.

Also correct the legacy-clause note on the twin recognizer. It claimed shipped
journals hold the old `— N working` sentence; the feature is unreleased, so the
only journals holding one are dev worktrees of this branch. The branch still
earns its place — those rows replay too, and it adds no false-positive surface
the bare shape does not already carry — but the stated reason was wrong.

* test(native-chat): retire the subagent-visibility guards now the roster renders

Two tests from the sibling item-coverage PR asserted that subagent items stay
on the generic gray row, explicitly gated on "until a real renderer exists".
This branch is that renderer, so both guards fire on merge — the handoff they
were written to mark rather than a regression.

They now pin the other side of it: subAgentActivity is suppressed because the
spawn-group roster renders it, and collabAgentToolCall deliberately stays
visible, since nothing guarantees a session reports subagent work as
subAgentActivity at all.

Git merged both files without conflict; only running the suite surfaced this.

* fix(native-chat): let a subagent swept at turn end still report what it did

The turn-end sweep marks still-running children `unverifiable`, and the
producer latched on any state that was not `working` — so `unverifiable`
latched too. A subagent that outlived its turn then reported `completed`, the
latch refused it, and a child that finished successfully read as one we never
saw finish, permanently.

One predicate was doing two jobs. `isTerminalSubagentState` is right for
counting — `unverifiable` is not working — and wrong for latching, because
`unverifiable` records that we stopped being able to see the child, not what
it did. Split them: a child's own verdict latches, the sweep's guess does not.

The reverse stays refused. Nothing returns to `working` once we have given up
on it, so a straggler progress tick cannot re-light a settled row.

Neither the latch nor the sweep was wrong alone, and both were tested; the
defect lived only in their interaction, and only when a subagent outlives its
turn — which the probe that drove this design never produced, because the
parent it captured waited on its child.

* fix: drop the @pnpm/exe lockfile drift a merge staged

`git add -A` swept up the pnpm-lock.yaml mutation that every pnpm invocation
leaves in this repo. Nineteen lines, thirteen of them @pnpm/exe, and it fails
sixteen unrelated CI checks — native smoke, typecheck, packaging, xterm patch
sync — none of which name the lockfile.

* fix(native-chat): restore the item fall-through an inline dropped

Inlining the subagent routing helper lost its null check: the roster returning
null means it did not claim the item, and the translator must keep looking.
Returning unconditionally once any thread item parsed swallowed every ordinary
item — twelve settlement tests, none of them about subagents.

* fix(orchestration): rebind the subagent block arm to the renamed bound state

Main renamed clipMetadata's second parameter from a warnings set to a
TranscriptBoundState. The subagent-group arm still passed `warnings`, and git
merged both sides without a conflict because the lines never overlapped — the
rename and the new arm are in different hunks. Typecheck was the only thing
that could catch it, and did.

* fix(codex): publish the turn tail for a subagent item the roster claims

Main's #19055 added a `subAgentActivity` arm to the provider activity table,
which is reached only through `publishActivity`. The roster's admission returned
above that call, so every `subAgentActivity` item bypassed it and a fan-out that
reports nothing else left the turn tail stuck on the previous frame's text.

`publishActivity` already no-ops on a refused admission and on a non-primary
thread, so routing the roster's admission through it is safe.

Also corrects a docstring the frames extraction copy-pasted onto
`settleOversizedNotification`.

* fix(native-chat): bound the subagent roster on every boundary that carries it

The spawn-group arm was the one collection in the worker-transcript payload with
no cap, and the one block type mobile's `sanitizeBlock` forwarded verbatim. The
producer's `MAX_CODEX_SUBAGENTS_PER_GROUP` does not reach either boundary: the
journal schema declares no maximum on `agents`, and a remote host may run a build
with a different cap. Both transports now cap the roster and bound `id`, `label`
and the open `state` string; `label` and `id` also take the standard inline bound
on the journal write path, where every other provider string already does.

A token count is now persisted onto its entry at write time. `write` rebuilt
`tokens` from the LRU-capped thread map on every write, so an eviction silently
retracted a count the durable row had already shown.

Adds the first coverage of the three roster caps, including the group eviction
that rewrites a row from N children down to one.

* fix(native-chat): keep the roster drawn beside tool calls and its clock honest

The roster-only escape is keyed on `blocks.length === 0`, so a spawn group
sharing its message with tool-call blocks fell through to the settled-turn guard,
which returned bare null and took the roster with it — the exact regression the
escape above was written to avoid, after the message row had already counted the
group as renderable. Unreachable for Codex today; the block type is deliberately
provider-agnostic, so it is live for the Claude lane.

The elapsed clock also froze at a sibling's timestamp on a partial sweep: in a
group where one child completed and another is unaccounted for, the ended turn
left `working === 0` with the completed child's `settledAt`, and the row showed
that child's duration as the group's run length. No clock is drawn while any
child is `unverifiable` with no terminal timestamp.

* perf(native-chat): bound the roster's provider strings without digesting them

`boundInlineText` computes a sha256 and a Buffer BEFORE it checks the length,
so the roster paid two digests per child on every write even when nothing was
truncated — and `write()` runs on every claimed activity item (each delivered
twice) and again from `handleTokenUsage`, which streams. A same-process A/B over
a 64-child group: 76.5 us/write before, 2.0 us/write after (plain, unbounded row
is 1.2 us).

The cap changes with the mechanism. 16 KB is the tool-output bound; both readers
of this row already clip the same fields to 512, so the producer was admitting
~2 MB per durable roster row for consumers to throw ~97% of away. One
`MAX_SUBAGENT_FIELD_CHARS` now serves the producer and both readers, and the
marker is an ellipsis rather than the tool-output truncation sentence — `id` is
the roster key and the renderer's React key.

Also raises the orchestration arm's per-group bound from 20 to the producer's
64, matching the mobile arm: a 21-64 child group is routinely producible here,
so that arm clipped children and warned while its sibling clipped none. The
slice and warning stay as the transport's own defence against a remote host with
a larger cap.

* fix(orchestration): suppress one roster block per twin, not all of them

`hasTwin` was a single boolean over the whole message, so a message carrying two
`subagent-group` blocks and one plain-text twin printed one sentence and dropped
the second roster with no marker. Count the twins and claim one per group
instead. Not reachable from this branch's producer, which writes one group per
journal item, but the surrounding reasoning is explicitly about wire shapes the
producer never writes and this is the adjacent one it missed.

* fix(native-chat): loop-3 fixes to the Codex subagent worklog

Five defects loop 2's own fixes introduced.

Twin claiming was order-blind: the count-based claim silenced whichever
roster block came first, so a lone twin belonging to a LATER group erased
an earlier group's roster and printed the later sentence twice. Exact-text
claims are now settled for every group before any leftover twin is claimed
by position; the positional fallback stays for a newer build's frozen twin,
which can never equal a recomputed sentence.

`boundSubagentField` sliced UTF-16 units and could leave a lone high
surrogate in a durable row, and the clip removed exactly the tail that told
two children apart — `id` is the renderer's React key and `claimLabel`
writes its repeat ordinal at the end. It now backs off a split pair and
reserves the child index inside the bound, so both readers' re-clip cannot
cut the disambiguator off again.

`MAX_SUBAGENT_FIELD_CHARS`'s doc claimed a `groupId` bound the producer
never applies; the doc now says so and why. The worker-transcript metadata
cap is a separate literal again: it governs message ids, turn ids, tool-call
names and image urls, so a roster-motivated change must not move it.

* fix(native-chat): never infer a lost subagent from a turn boundary

QA drove a real Codex session with three live `spawn_agent` children and sent
a mid-turn correction. The roster row immediately read "Ran 3 subagents /
3 unverifiable" with no clock, while all three were still running — they
reported `completed` 57-87s after that turn ended.

Both sites rested on the same false premise: that a turn ending means no
event will ever settle a child. Children outlive their turn and keep
reporting into the same group.

- Renderer: drop `reconcileSubagentRoster`. Nothing plumbed to the component
  distinguishes a row written by a dead host from a turn that merely ended —
  journal render items carry no epoch, and a new epoch deletes the rows of the
  one it supersedes — so the row now draws the state the journal recorded.
  Under-claiming beats over-claiming.
- Main: stop sweeping on `turn/completed`. That sweep wrote `unverifiable`
  into the DURABLE journal, which mobile reads with no reconciliation.
  `turn/completed` is Codex's only turn-end notification, so an abort cannot
  be told apart from a clean finish; the safe default is not to sweep.

`settleSession` — the provider actually being gone — is unchanged and is now
the only sweep. `unverifiable` stays non-latching so a late verdict still lands.

* test(native-chat): pin the roster at the seam the QA defect came from

The mid-turn correction opens a new turn, so the fan-out's row stops being
the current turn and the list hands the roster `activeTurnIsWorking={false}`.
Asserted through the list, not the component, because that prop is what
carried the wrong claim.

* fix(native-chat): settle a roster the dying host never got to sweep

`settleSession` only fires when the provider goes away while this process is
alive. If the host itself dies, nothing sweeps and nothing reconciles on
restore, so a `subagent-group` row persisted as `working` claimed live children
forever — the mirror of the defect the previous commit fixed, and the same
`ssh-execution-boundary.md` violation in the other direction.

Reconciled host-side, at journal open, not in the renderer: mobile shows only
the durable text twin and reconciles nothing, so a renderer-only fix would
leave it claiming live children indefinitely. Opening the journal is also the
one moment a host can honestly say the previous writer is gone.

- `staleSubagentRosterRevisions` rewrites every child still reading `working`
  to `unverifiable` and regenerates the twin from the same summary, so the
  block and the sentence cannot disagree.
- No terminal timestamp: the child stopped being observable at an unknown
  moment, and stamping the reopen would report the downtime as its run length.
- Revises in place under the parsed identity, so a reopen upserts the row
  rather than appending a duplicate, and a second reopen writes nothing.
- Skipped on a corrupt load: that journal is still owed a rebuild from provider
  history, and content past the repair's free sequence retires the demand.

Reconciles journal ROWS, not roster state — the producer's in-process group map
is untouched, so the roster's known seeding limitation is unchanged, as is
`canReplaceSubagentState`: `unverifiable` still does not latch.

---------

Co-authored-by: Merge Sim <sim@local>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* feat(chat): show turn-scoped activity tail

* fix(chat): keep turn activity broad

* feat(chat): surface provider activity in turn tail

* fix(chat): keep reasoning headline as activity and widen redaction

A Codex reasoning summary streams as a bold headline followed by body text.
Folding the whole summary into the tail leaked literal ** markers and body
prose; only the first non-empty line is activity copy, and an unterminated
bold header mid-stream is unwrapped too.

Redaction used a hyphen for GitHub token prefixes (they use an underscore),
and missed fine-grained GitHub tokens, AWS access key ids, JWTs, URL
userinfo passwords, and bare token= values.

* fix(chat): wait for a complete reasoning headline

A bold headline still streaming has no closing marker yet; holding the
previous activity copy until it lands avoids flashing a half word.

* refactor(chat): drop bespoke secret redaction from activity copy

Reference agent hosts render provider-derived status text unredacted;
this table was the only one of its kind and its GitHub pattern matched
no real token. Bounding and the reasoning-headline extraction stay.

* Bound provider headline updates and clear activity on reconnect

---------

Co-authored-by: Merge Sim <sim@local>
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