Skip to content

fix(server): preserve tool lifecycle identity - #7151

Open
maria-rcks wants to merge 1 commit into
ui-refresh/composerfrom
ui-refresh/tool-activity
Open

fix(server): preserve tool lifecycle identity#7151
maria-rcks wants to merge 1 commit into
ui-refresh/composerfrom
ui-refresh/tool-activity

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • Carries provider item IDs into top-level toolCallId lifecycle identity for started, updated, and completed tool events.
  • Preserves start status and provider command data so later completion events can be folded into the correct activity.
  • Normalizes direct, Claude, and OpenCode command shapes during activity projection.

Screenshots

Not applicable. This is a server-only lifecycle projection change; its visible web consumer is demonstrated in #7152.

Why

This is the sensitive server layer that was hard to approve inside the original UI PR. It is intentionally above every independent UI layer. The stack can merge through #7150 without taking this change.

Review notes

  • Started-event provider data is newly retained in persisted activity payloads.
  • No contracts change is required.
  • Mobile still ignores tool.started; the new web behavior is implemented in feat(web): group live tool activity #7152.

Validation

  • Activity payload projection tests
  • Provider runtime ingestion tests
  • Affected-package typechecks
  • Changed-file lint and formatting checks

Stack order

  1. feat(web): unify workspace navigation #7153 workspace and navigation
  2. feat(web): redesign usage insights #7147 Usage
  3. feat(web): refresh pull request details #7148 Pull Requests
  4. feat(web): improve terminal workspace controls #7149 terminal
  5. feat(web): attach composer state drawers #7150 composer
  6. fix(server): preserve tool lifecycle identity #7151 tool lifecycle projection, this PR
  7. feat(web): group live tool activity #7152 tool activity UI

Built with GPT-5.6-sol in the Codex harness.


Note

Medium Risk
Changes orchestration activity shape and snapshot collapsing for tool lifecycle rows; grouping can shift for existing threads when runtime item ids are present, but scope is server projection/ingestion with tests covering the new paths.

Overview
Provider runtime ingestion now maps provider itemId to top-level toolCallId on item.started, item.updated, and item.completed activities. Started and completed payloads also carry status and provider data where they were missing before (started events now persist command input, not just title/detail).

Activity payload projection adds projectCommandValue so slimmed command rows get a single data.command from top-level command, Claude input.command, or OpenCode state.input.command. toolLifecycleIdentity prefers payload.toolCallId (then legacy data.toolCallId) before falling back to type/title/detail, so snapshot deduping and client folding align on the same id when the runtime supplies one.

Behavioral note: streams that only matched on title/detail may group differently once toolCallId is present.

Reviewed by Cursor Bugbot for commit a21dd5a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Preserve tool lifecycle identity by propagating top-level toolCallId in activity payloads

  • ProviderRuntimeIngestion.ts now includes a top-level toolCallId on item.started, item.updated, and item.completed activity payloads when event.itemId is present; started and completed events also carry status and data.
  • ActivityPayloadProjection.ts introduces projectCommandValue to normalize the command string from data.command, data.input.command, or data.state.input.command, replacing a direct field check.
  • toolLifecycleIdentity now prefers a top-level payload.toolCallId over the nested payload.data.toolCallId when computing which rows to retain per tool call.
  • Behavioral Change: lifecycle deduplication now keys on the top-level toolCallId when present, which may change which activity rows are retained as the newest per tool call.

Macroscope summarized a21dd5a.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cb4c3891-1736-43d9-95ff-b2d17a714d7b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.4 KiB 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 7.8 KiB
Codex Live turn WebSocket decoded 55.0 KiB 66.4 KiB
Codex Live turn messages 16 21
Claude Total thread wire 13.4 KiB 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.5 KiB 7.8 KiB
Claude Live turn WebSocket decoded 55.8 KiB 66.4 KiB
Claude Live turn messages 16 21

Baseline: unavailable · PR result: a21dd5a · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 109.4 KiB
  • Claude decoded thread snapshot: 110.1 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 16, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved a21dd5a

This is a self-contained bug fix that improves how tool lifecycle identity is extracted and preserved in the orchestration layer. Changes are well-tested and limited to internal activity projection logic with no external API or schema impact.

You can customize Macroscope's approvability policy. Learn more.

@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from 41b012a to 2032446 Compare August 16, 2026 01:24
Comment thread apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from 2032446 to 4ee0341 Compare August 16, 2026 01:32
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch 2 times, most recently from 68825d8 to e1a4e26 Compare August 16, 2026 01:44
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from e1a4e26 to 4565c3e Compare August 16, 2026 01:49
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch 2 times, most recently from 6fcc75e to 46c389f Compare August 16, 2026 01:57
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from 46c389f to cf5bf33 Compare August 16, 2026 01:59
Comment thread apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts Outdated
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from d25f98f to 56adc28 Compare August 16, 2026 04:39
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch 2 times, most recently from 64ad44b to 2b5942c Compare August 17, 2026 16:14
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from 2b5942c to ce306d2 Compare August 17, 2026 19:18
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 17, 2026
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from ce306d2 to 404a007 Compare August 17, 2026 19:35
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch 2 times, most recently from 3777cdf to 9fb61a0 Compare August 17, 2026 20:02
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from 9fb61a0 to c95612a Compare August 17, 2026 20:10
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch 2 times, most recently from 58b7d7a to 514525d Compare August 17, 2026 20:23
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from 514525d to b0e62c1 Compare August 17, 2026 20:30
@maria-rcks
maria-rcks force-pushed the ui-refresh/tool-activity branch from b0e62c1 to b29dc55 Compare August 17, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant