Skip to content

Normalize typed provider runtime ingestion#1475

Open
juliusmarminge wants to merge 2 commits intomainfrom
t3code/typed-runtime-ingestion
Open

Normalize typed provider runtime ingestion#1475
juliusmarminge wants to merge 2 commits intomainfrom
t3code/typed-runtime-ingestion

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Mar 27, 2026

Summary

  • Normalize provider runtime event handling to read typed payload fields directly instead of legacy record helpers.
  • Preserve runtime.error activities by ingesting the typed payload.message field.
  • Update runtime turn completion handling to use typed payload.state and payload.errorMessage fields.
  • Add coverage for recording runtime.error activities from typed payloads.

Testing

  • bun fmt
  • bun lint
  • bun typecheck
  • bun run test

Note

Medium Risk
Changes how provider runtime events are parsed for session state and activity logging, which can affect error/turn status projection and user-visible diagnostics. Scope is localized and covered by updated tests, but mistakes could silently misclassify turn outcomes or drop error details.

Overview
Provider runtime ingestion now treats runtime events as typed data. ProviderRuntimeIngestion drops the legacy “payload as record” parsing helpers and reads event.payload fields directly for turn.completed (state + error message) and runtime.error (message).

Behavioral change: runtime.error is always converted into a thread activity using payload.message (and session lastError), rather than conditionally emitting only when a message could be extracted.

Tests update the harness to normalize legacy turn.completed events (status/errorMessage → typed payload) and add coverage asserting runtime.error activities persist the typed message.

Written by Cursor Bugbot for commit 6774415. This will update automatically on new commits. Configure here.

Note

Normalize typed provider runtime event ingestion by reading directly from typed payload fields

  • Removes helper utilities (asString, runtimePayloadRecord, runtimeTurnState, runtimeTurnErrorMessage, runtimeErrorMessageFromEvent) in ProviderRuntimeIngestion.ts that defensively extracted values from untyped payloads.
  • turn.completed session status and lastError now read directly from event.payload.state and event.payload.errorMessage.
  • runtime.error activities are now always emitted using event.payload.message; previously no activity was emitted if the message was absent.
  • The test harness in ProviderRuntimeIngestion.test.ts normalizes legacy turn.completed events (with top-level status/errorMessage) into the typed payload shape before publishing.
  • Behavioral Change: runtime.error no longer falls back to a default string for runtimeErrorMessage; if event.payload.message is absent, no error message is set.

Macroscope summarized 6774415.

- Read `turn.completed` and `runtime.error` data from typed payloads
- Preserve runtime error activities when payload message is present
- Add regression coverage for runtime.error activity ingestion
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

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

Run ID: d4df5b82-a3ac-452a-88af-c10bbf7f319c

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/typed-runtime-ingestion

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

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 27, 2026
- add a type guard for legacy `turn.completed` runtime events
- normalize legacy payloads with typed `ProviderRuntimeEvent` shapes
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