#1969

Delete the conversation events stream's wire 1 format

Openaryanranderiyaopened 2d ago

All file:line references are on origin/master at bed1dc2d09 (2026-11-27), read from a clean export of that commit. "Unverified" marks what I could not check.

1. Why

GET /api/v1/conversations/{id}/events has two output formats, chosen by the wire query parameter (wire 1 or 2, default 1: apps/api/app/api/v1/endpoints/conversations.py:233).

  • Wire 1 sends whole items. Each item carries its cards twice: raw as tool_data and folded as timeline. A change to an item re-sends the whole item as a screen_update. A reply's cards arrive as a cards delta that holds the whole card list again. A client that sends no wire gets this.
  • Wire 2 sends each card once, as timeline. A change to an item the connection already holds is a screen_patch frame (set/append/remove at a path, plus base, a patch counter). A reply's cards arrive as a timeline delta of changes. It also supports resume with after=<seq>. It was added in #1945. #1945 measured a 28.5 MB opening frame falling to 11.7 MB, and 31.7 MB live for 60 tool calls falling to 0.27 MB.

Two formats are debt because there are two encoders of one screen. Today wire 1 is ConversationEvent(...).model_dump_json(...) in event_stream.event_lines, and wire 2 is PatchedWire.line in patched_wire.py. Both turn the same projected items into JSON, and nothing but tests keeps them equal. Every new item field, card type or frame has to be encoded, documented and tested twice.

The wire 1 branch also forces the following to stay:

  • tool_data as a deprecated, optional field on three item models and a delta (UnfoldedCards, _unfolded_cards_optional).
  • Four exclude={"tool_data"}-style special cases in PatchedWire.
  • The cards reply delta.
  • A wire label on the metric and a wire field on the request log.
  • A held_cards exclusion (_WIRE_2_ONLY) so a wire 1 reader never sees the key.
  • Duplicated client schemas in TypeScript.

#1958 already moved the last first-party clients (bots resume, voice reads wire 2). The remaining wire 1 users are old browser tabs, plus internal tools that never sent wire. The internal tools are the surprise in section 2.

Related PRs:

  • #1945: wire 2 and after.
  • #1946: request log fields and stream metrics.
  • #1954: MAX_OUTPUT_CHARS cap on a card's output. Not a dependency of this work, but it changes the byte numbers used here.
  • #1958: bots and voice on wire 2. Its body lists what deleting wire 1 involves and the first version of the log query.

2. Who still uses wire 1

I searched apps/web, apps/bots, libs/shared, apps/voice-agent, apps/desktop and packages/cli, plus apps/api scripts and tests, for wire, tool_data, /events, EVENTS_WIRE and every caller of the events route.

Production clients

ClientWire it sendsEvidence
Web (browser)wire=2apps/web/src/features/chat/api/chatApi.ts:275 (new URLSearchParams({ wire: String(EVENTS_WIRE) })); EVENTS_WIRE = 2 at libs/shared/ts/src/conversation/frames.ts:28. Reached through apps/web/src/features/chat/live/connection.ts:102.
Bots (all platforms)wire=2 plus afterlibs/shared/ts/src/bots/api/conversation-events.ts:77 (params: { wire: EVENTS_WIRE, ...after }), called from libs/shared/ts/src/bots/api/index.ts:236.
Voice agentwire=2 plus afterapps/voice-agent/src/conversation.py:326 (`{"wire": EVENTS_WIRE}
Desktop (Electron)sends none itself; it serves its own bundled copy of the web appapps/desktop/src/main/server.ts:118 (../../web/.next/standalone). A desktop build packaged before #1945 contains a web bundle that sends no wire. Every desktop build still installed from before 2026-11-25 is in the same position as an old browser tab.
packages/clinoneNo match for /events, wire or tool_data.

Browser tabs opened before #1945 deployed. #1945 merged 2026-11-25T01:21Z. Such a tab runs the old web bundle until reloaded. It sends no wire and no after, so it is served wire 1. The same applies to desktop builds from before that date (see the table). I could not enumerate these tabs from code; section 3 is how to measure them.

Internal tools that send no wire today (they get wire 1 and parse tool_data)

These matter for deletion. Dropping wire 1 changes what they receive, and three of them read tool_data directly.

CallerFile:lineWhat it does with no wire
Eval live-chat reader (TurnReader, follow)apps/api/scripts/evals/core/live_chat.py:419 (request, sends only after); reads CardsDelta(tool_data=cards) at :248 and item.tool_data at :318Depends on wire 1's raw cards. It has no handler for screen_patch (no match for ScreenPatch or screen_patch in the file). Against wire 2 it would stop seeing cards.
Analytics e2e chat journeyapps/api/scripts/analytics_ops/e2e_journeys.py:280, reader await_reply at :298, which uses TurnReader from live_chat.pySame TurnReader. Covered by mise analytics:e2e.
Browser-stack real test followerapps/api/tests/integration/real/browser/_stack/chat_follow.py:109 (request), :71 reads item.tool_data; also apps/api/tests/integration/real/browser/_stack/stack.py:374 builds a TurnReaderSame dependency.
Events-route real-services testsapps/api/tests/integration/real/test_conversation_events_wire_real.py:173 (_following) and :483 (left_after_opening) pass only caller params; the test at :431 (test_a_client_that_names_no_wire_is_sent_whole_items_with_their_cards) asserts wire 1's tool_data on purposeThe :431 test exists only for wire 1.
driving-gaia skill.agents/skills/driving-gaia/SKILL.md:163 (curl .../events?after=0)Documentation. The curl shows wire 1 output.

Readers that parse tool_data off the wire (the schemas wire 1 forces to stay)

  • libs/shared/ts/src/conversation/entries.ts:264 (UnfoldedCardsSchema; its doc comment says "Wire 1 only"), used at :298 (reply item), :352 (work item), :362 (notice item).
  • libs/shared/ts/src/conversation/frames.ts:17 (import), :59-60 (the cards delta: type: z.literal("cards"), tool_data: UnfoldedCardsSchema).
  • libs/shared/ts/src/conversation/draft.ts:11 (EMPTY_REPLY_DRAFT.tool_data), :27-28 (case "cards").
  • libs/shared/ts/src/conversation/types.ts:20 (ReplyDraft picks tool_data).
  • libs/shared/ts/src/conversation/testing.ts:100, :125, :281 (fixture builders set tool_data: []).
  • libs/shared/ts/src/conversation/frames.ts:22-26 comment says a cards delta is "whole from a server older than wire 2".
  • apps/web/src/features/chat/components/interface/rows/rows.test.ts:52 and apps/web/src/features/chat/live/liveChat.render.test.tsx:277 set tool_data: [] in fixtures. libs/shared/ts/src/conversation/view.test.ts:426 builds a cards delta with tool_data: [].
  • Production web and bot code does not read .tool_data on conversation items. A search of apps/web/src and apps/bots for .tool_data and "tool_data" returned only libs/shared/ts and test files. Rows, the bubble and the tool thread read timeline (#1945 body).
  • The generated client types (libs/shared/ts/src/api/generated/schema.d.ts:8282, :12971, :15165, :19020) carry tool_data? on CardsDelta, NoticeItem, ReplyItem and WorkItem.
  • One TypeScript compatibility branch for an API older than #1958: libs/shared/ts/src/bots/conversation/follower.ts:615-630 (quoteTarget), which reads a quoted message off the screen when quote_platform_message_id is undefined. This is not a wire 1 branch. It is a fallback for an API from before #1958. The API now always sends that field, so the fallback is dead once no older API is deployed. #1958's list names it. Confirm and remove it in this change.
  • libs/shared/ts/src/conversation/fixtures/c41f18c5.frames.json is a recorded wire 1 stream (tool_data at lines 86, 154, 204, 273, 303). It is loaded by libs/shared/ts/src/conversation/testing.ts:2 and by apps/api/tests/unit/services/conversation/test_screen.py:568. See section 4.

REST pages also carry tool_data

ConversationEntriesPage.items: list[ScreenItem] (apps/api/app/models/conversation_models.py:344) serves GET /conversations/{id} (conversations.py:140) and GET /conversations/{id}/entries. Both use the same item models, so they serialize tool_data too. #1945 left this "out of scope". Removing tool_data from the item models (section 4) also removes it from those two responses. apps/web reads timeline, not tool_data, so the web is not affected. An old tab (pre-#1945) may read tool_data from these pages. Unverified (see section 5).

3. The safety check before deleting

Rule: zero wire 1 requests to the events route for at least 7 consecutive days, with the stream still receiving wire 2 traffic every one of those days (so a zero is not just an empty day). #1958 proposed 14 days; the founder asked for 7.

Field names, read from the code (apps/api/app/api/v1/endpoints/conversations.py:245-250, event_stream.py and stream_metrics.py, and libs/shared/py/wide_events.py:248):

  • The events request's http_request line carries conversation.operation = "events" and conversation.wire (1 or 2). Loki's | json flattens these to conversation_operation and conversation_wire.
  • platform is a top-level field on bot requests (for example whatsapp), and activity.surface (flattened to activity_surface: bot, web, ...) is on every request.
  • The line is written by apps/api/app/api/v1/middleware/logging.py (_emit, line 200) when the response finishes, not when it opens. So a stream that is still open has no line yet. Run the query with a window that ends hours after the last client was seen.
  • Metric: gaia_conversation_events_stream_bytes_total{wire,surface} (apps/api/app/services/conversation/stream_metrics.py:50-57).

LogQL (Loki, datasource uid loki). Count by wire, surface and platform, last 7 days. Wire 1 must be absent from the result:

sum by (conversation_wire, activity_surface, platform) (
  count_over_time(
    {stack="gaia-prod", service_name="gaia-backend"} |= "http_request" |= "/events"
    | json | conversation_operation="events" [7d]
  )
)

Wire 1 only, one value per day for the last 7 days (run as a range query with step of 1 day, or instant with [1d] repeated). The result must be empty or 0 for every day:

sum(count_over_time(
  {stack="gaia-prod", service_name="gaia-backend"} |= "http_request" |= "/events"
  | json | conversation_operation="events" | conversation_wire="1" [1d]
))

Also check that no events line lacks the field (that would hide a wire 1 request that failed before the field was set). This should be 0 for every day after 2026-11-25:

sum(count_over_time(
  {stack="gaia-prod", service_name="gaia-backend"} |= "http_request" |= "/events"
  | json | conversation_operation="events" | conversation_wire="" [1d]
))

PromQL (Prometheus, datasource uid prometheus). Wire 1 bytes over 7 days, must be 0 for every surface; and the wire 2 traffic that proves the metric is live:

sum by (wire, surface) (increase(gaia_conversation_events_stream_bytes_total[7d]))

Every series is created at zero when the API starts (stream_metrics.py:60-65), so wire="1" always shows a series; the test is that its value is 0, not that it is absent.

Today's counts (queried 2026-11-27 04:32 IST, which is 2026-11-26 23:02 UTC)

I ran these through the Grafana MCP tool against prod.

  • First events request line that has conversation.wire at all: 2026-11-25T19:11:45Z (the first deploy that carried #1946; the line is a wire: 2 iMessage bot request, commit 2bc80740). Earlier requests did not log the wire, so nothing before that instant can say whether wire 1 was used.
  • Last 24 hours, events requests by conversation_wire: wire 2 = 63 (bot imessage 10, bot telegram 6, bot whatsapp 21, and 26 with no activity_surface label: 6 with no platform, imessage 3, telegram 6, whatsapp 11). Wire 1 = 0. Lines with an empty conversation_wire = 0.
  • Last 7 days: 622 events lines with an empty conversation_wire (478 activity_surface=bot, 144 without), all before 2026-11-25T19:11Z; and 84 with conversation_wire=2. Wire 1 = 0.
  • sum by (wire, surface) (increase(gaia_conversation_events_stream_bytes_total[1d])): wire 1 is 0 for every surface (bot, desktop, voice, web, worker). Wire 2: bot 102,601,451 bytes, web 110,513 bytes, desktop 0, voice 0, worker 0.

Two reasons these numbers are not enough to delete today:

  1. The clean window is about 1.3 days long (since 2026-11-25T19:11Z). The 7-day rule cannot pass before 2026-12-02 19:11Z, assuming nothing changes.
  2. Volume is small: 63 events requests in the last 24 hours, and web wire 2 traffic is 110 KB in a day. A run of zeros over so little traffic is weak evidence for tabs that people open once a week. This is why the rule asks for wire 2 traffic on each of the 7 days, and why section 5 asks for a direct test of the old tab.

4. Exactly what to delete

Make it one PR. Wire 2 becomes the only format, and wire stops being a parameter. The default becomes wire 2 behaviour (see the old-tab case in section 5). The line numbers below are origin/master bed1dc2d09.

API (apps/api)

  • app/constants/conversation.py:137-143: delete EventsWire (ITEMS = 1, PATCHES = 2). Check that IntEnum is still needed by other classes in that file before dropping its import.
  • app/api/v1/endpoints/conversations.py:
    • :7 import EventsWire.
    • :233-235 the wire Query parameter (default EventsWire.ITEMS).
    • :241 the sentence "wire names the newest frame shapes the client reads."
    • :248 the "wire": wire.value entry in the log.set(conversation=...).
    • :257 and :260 the wire argument to event_lines and metered.
    • Keep after.
  • app/services/conversation/event_stream.py:
    • :25 import EventsWire, :51 import PatchedWire (still used, see below).
    • :414-415 _WIRE_2_ONLY and its comment ("a reader built before wire 2 refuses a key it does not know").
    • :459 the wire: EventsWire = EventsWire.ITEMS parameter, :461 the docstring clause "in the client's wire", :466 the patched = PatchedWire() if wire is EventsWire.PATCHES else None switch, and :473-477 the unpatched branch (ConversationEvent(frame=shown).model_dump_json(exclude=_WIRE_2_ONLY)). event_lines always calls PatchedWire().line(shown).
  • app/services/conversation/patched_wire.py:
    • Drop the _UNFOLDED = {"tool_data"} mechanism (:32, :37, :59, :101) once tool_data is no longer a serialized field. The exclude= arguments disappear.
    • :75 case ReplyDeltaFrame(payload=CardsDelta(timeline=timeline)) is the point where the internal CardsDelta becomes the wire TimelineDelta. Decide whether the step's internal frame keeps being called CardsDelta (timeline only) or is renamed; see the CardsDelta note below.
    • Update the module docstring (:1) and the class docstring: it describes "wire 2" and should simply describe the stream.
  • app/services/conversation/stream_metrics.py:
    • :14 import, :38 _LABELS = ("wire", "surface"), :44 and :54 the documentation strings ("by wire and surface"), :62-65 the loop over EventsWire, :69 and :76 the wire argument and label values. Drop the wire label; keep surface. This renames no metric. It does remove a label, so the 7-day safety query in section 3 is only valid before this ships. Update dashboards or alert rules that group by wire (unverified: none found in tools/alert-rules, which has only the /events latency tests).
  • libs/shared/py/wide_events.py:248: delete the wire: Literal[1, 2] field of ConversationContext, and fix its comment above (:245-247: "the wire it wrote, ...").
  • app/core/lifespan.py:28, :82: create_events_stream_series() stays, but it iterates only surfaces afterwards. apps/api/tests/unit/core/test_lifespan.py:191 asserts ("2", "web") and must change.
  • libs/shared/py/conversation_wire.py:
    • :176-177 UnfoldedCards, :180-184 _unfolded_cards_optional.
    • :238 ReplyItem.tool_data.
    • :267-273 CardsDelta: its tool_data field and json_schema_extra. Its timeline field is what PatchedWire diffs, so the class is the internal step-to-encoder message until you decide otherwise.
    • :295-296 the ReplyDelta union includes CardsDelta; once the wire never carries it, the published schema (OpenAPI/TS) must stop listing it (see the generated files below).
    • :345-347 the comment "On wire 2, for a work item sent here ..." on held_cards; the key is now always allowed, so _held_cards_optional (:331-335) can stay as it is (it keeps the key optional when empty), but the comment must stop saying wire 2.
  • app/models/conversation_screen_models.py:24 (import), :59 (WorkItem.tool_data), :72 (NoticeItem.tool_data).

The server's own use of tool_data is the hard part. tool_data is not only a wire field. It is the server's read model for building the timeline and for live work. Reads found: app/services/conversation/screen_patches.py:129-132 (_with_live_cards: cards = (*item.tool_data, *live.tool_data) then writes "tool_data": cards back), app/services/conversation/screen.py:395-396, :446, :462, :492, :494, :510, :527 (the projection builds items with tool_data=... and timeline=tool_timeline(...) from it), and app/services/conversation/step_attempt.py:184 (CardsDelta(tool_data=cards, timeline=tool_timeline(cards))). #1958 describes the deletion as "tool_data on ReplyItem, WorkItem and NoticeItem as a wire field", so the minimum is to stop serializing it. Pick one and say which in the PR:

  • (a) keep the cards on the in-memory item but exclude them from serialization (Field(exclude=True)), so screen_patches.py:129 and the projection keep working, and no REST page or stream carries it; or
  • (b) remove the field and carry the cards beside the item in the projection and in screen_patches.

Either way, the REST pages (GET /conversations/{id}, /entries) stop carrying tool_data too. Name that in the PR description.

Published schema and generated clients

Regenerate with mise api:types; do not edit by hand. Expected diff:

  • apps/api/openapi.json: the four tool_data blocks marked "deprecated": true (lines 4598-4600 in CardsDelta, 14440-14442 in NoticeItem, 19269-19271 in ReplyItem, 26364-26366 in WorkItem); the EventsWire schema (:8712) and the wire query parameter (:32236-32244, default 1); CardsDelta itself if it no longer appears in the ReplyDelta union.
  • libs/shared/ts/src/api/generated/schema.d.ts: tool_data? at :8282, :12971, :15165, :19020; EventsWire at :10140-10144 and :19322; the wire? query parameter at :23453; the doc line at :1288.

TypeScript (libs/shared/ts, apps/web, apps/bots)

  • libs/shared/ts/src/conversation/entries.ts:264 (UnfoldedCardsSchema) and its three uses at :298, :352, :362.
  • libs/shared/ts/src/conversation/frames.ts:17 (import), :58-62 (the "cards" member of ReplyDeltaSchema, declared at :56), :22-26 (comment mentioning a server older than wire 2), :28 EVENTS_WIRE and the comment above it.
  • libs/shared/ts/src/conversation/draft.ts:11 and :27-28 (the "cards" case); the exhaustive never check (:36) then still holds because the union lost the member.
  • libs/shared/ts/src/conversation/types.ts:20: remove "tool_data" from the Pick of ReplyDraft.
  • libs/shared/ts/src/conversation/testing.ts:100, :125, :281, and the matching test fixtures apps/web/src/features/chat/components/interface/rows/rows.test.ts:52, apps/web/src/features/chat/live/liveChat.render.test.tsx:277, libs/shared/ts/src/conversation/view.test.ts:426.
  • libs/shared/ts/src/conversation/index.ts:21 exports EVENTS_WIRE; delete the export with the constant.
  • The client parameter: apps/web/src/features/chat/api/chatApi.ts:24 (import) and :275 (build ?wire=2), libs/shared/ts/src/bots/api/conversation-events.ts:12 and :77, apps/voice-agent/src/conversation.py:42 and :326, apps/voice-agent/src/constants.py:24-25 and :76 (the __all__ entry). Remove the wire argument everywhere in the same PR (FastAPI ignores unknown query parameters, so a client that still sent it would keep working; delete it anyway so the sources agree).
  • apps/web/e2e/screen-timeline.ts:104: the tolerated-console-error regex ends in \/events\?wire=2\)$. Update it to the URL the web sends after the change, or the 404-on-new-conversation log line stops matching and the web-e2e-screen lane fails on a console error.
  • libs/shared/ts/src/bots/conversation/follower.ts:615-630: remove the screen-lookup fallback in quoteTarget, keep reply.quote_platform_message_id. Check apps/bots/__tests__/shared/conversation for tests that exercise the fallback ("an API from before it").
  • libs/shared/ts/src/conversation/fixtures/c41f18c5.frames.json: a recorded wire 1 stream. It is also read by the Python test at apps/api/tests/unit/services/conversation/test_screen.py:568. Re-record it as wire 2 or strip tool_data, and update both consumers together. fixtures/wire2-run.frames.json is generated by test_patched_wire_fixture.py (apps/api/tests/unit/services/conversation/test_patched_wire_fixture.py:56) and stays, perhaps renamed.

Internal tools that must move to wire 2 first (or in the same PR)

  • apps/api/scripts/evals/core/live_chat.py: TurnReader reads item.tool_data (:97, :318) and CardsDelta.tool_data (:248) and ignores screen_patch. Move it to read timeline and apply patches. shared.py.conversation_patch.with_changes (libs/shared/py/conversation_patch.py:18) is the applier the voice agent uses. Its callers: scripts/analytics_ops/e2e_journeys.py:55 and :298 (await_reply), apps/api/tests/integration/real/browser/_stack/stack.py:40 and :374, apps/api/tests/unit/evals/test_live_chat.py.
  • apps/api/tests/integration/real/browser/_stack/chat_follow.py:71 reads item.tool_data; same fix.
  • Eval and analytics consumers read cards to count tool calls (called_tools, live_chat.py:124). Check what the timeline gives them versus raw cards. This is the largest unknown in the change.

Tests and fixtures that exist only for wire 1

  • apps/api/tests/integration/real/test_conversation_events_wire_real.py:431-444 test_a_client_that_names_no_wire_is_sent_whole_items_with_their_cards: delete. Rename the file, since "wire" no longer names a choice.
  • apps/api/tests/unit/api/test_conversation_events_endpoint.py: :95-108 (wire 2 versus plain, plain["tool_data"]), :111 (the parametrized {"wire": 3} and {"wire": 0} refusals; {"after": -1} stays), :143-150 (the ({}, 1, FRESH) "wire 1" case), :198-220 (@pytest.mark.parametrize("wire", [1, 2])).
  • apps/api/tests/unit/services/conversation/test_event_stream.py:431-446 (held_cards only on wire 2), :495-536 (_lines(..., EventsWire.ITEMS) and update["item"]["tool_data"] == [_CARD]).
  • apps/api/tests/unit/services/conversation/test_stream_metrics.py:22 and :25-55 (the ("1", "2") series set and EventsWire use).
  • apps/api/tests/unit/services/conversation/test_patched_wire.py: drop tool_data assertions; keep the rest.
  • apps/api/tests/unit/core/test_lifespan.py:191.
  • apps/voice-agent/tests/test_conversation.py:124 (docstring says "wire 2 patch"; harmless, rename).
  • Search for other uses of tool_data as a screen item field. The files in the grep (for example test_screen.py, test_step_attempt.py, test_comms_runner.py) are mixed with the log models' tool_data, which is a different field and stays.

Docs

  • apps/api/CLAUDE.md:49: rewrite the wire=<1|2> paragraph. Wire 2 is the only format.
  • .agents/skills/driving-gaia/SKILL.md:163-167: the curl example and the "Resume" bullet; show the real format.
  • libs/shared/py/conversation_wire.py module docstring (:1) and any "wire 2" wording.

Must NOT be deleted

  • tool_data on the log models (app/models/conversation_log_models.py:209, :285, :329), on StreamPayload/ToolDataEvent (app/models/conversation_frame_models.py:35, :80, :85), FoldedCards.tool_data (app/services/conversation/tool_cards.py:83) and the tool_data card entries on the chat stream. These are the stored log and the internal fold, not the events wire.
  • PatchedWire and item_changes.py (wire 2's encoder).
  • held_cards, after, EventsResume, the conversation.resume, opening_frame_bytes and frames request fields, and the metrics' surface label.

5. What must not break, and the proof

Run only the lane each item names. Bring up real services with scripts/ci/test-services.sh up for the real-services tests, and run test files one at a time with mise test:one <file>.

WhatHow to prove it
Web chat renders live and on reload from wire 2 onlyweb-e2e-screen (ci.yml web-e2e-screen, SUITE: web:e2e-screen, sim stack: apps/web/e2e/screen-during-work.spec.ts, screen-over-time.spec.ts, screen-surfaces.spec.ts, helpers screen-timeline.ts, screen-fixtures.ts, screen-flows.ts). Run it once locally. Unit tests alone do not prove this.
Bots keep working, including restartbot-harness-e2e (ci.yml) and the scenarios in apps/bots/harness/scenarios/ (bot-restart-during-work.yaml, bot-restart-mid-reply.yaml, bot-restart-before-reaction.yaml, bot-stop-during-work.yaml, approval-*.yaml, reply-naming-a-file.yaml). Also pnpm --filter ./apps/bots exec vitest run __tests__/shared/conversation and mise test:bots (golden conformance suite apps/bots/__tests__/harness/conformance.test.ts).
Voice reads the streammise ci:local --only voice-tests (apps/voice-agent/tests/test_conversation.py). Not proven by this: a real LiveKit room (#1958 also did not run one).
Events route over real HTTP, Mongo and Redismise test:one apps/api/tests/integration/real/test_conversation_events_wire_real.py with USE_REAL_SERVICES=1. Its byte bounds (a wire 2 open within 1.1x the bytes of its tool outputs, a 30-call live run within 1.2x) must still hold.
Route unit tests, stream metrics, lifespanmise test:one apps/api/tests/unit/api/test_conversation_events_endpoint.py apps/api/tests/unit/services/conversation/test_event_stream.py apps/api/tests/unit/services/conversation/test_stream_metrics.py apps/api/tests/unit/services/conversation/test_patched_wire.py apps/api/tests/unit/services/conversation/test_patched_wire_fixture.py apps/api/tests/unit/core/test_lifespan.py
TS applier and the pairing with the Python encoderpnpm --filter ./libs/shared/ts exec vitest run src/conversation (view.test.ts replays the committed wire2-run.frames.json that test_patched_wire_fixture.py writes)
Published schemamise api:types, commit the result, then mise ci:local --only api-schema. The api-schema lane fails on drift. Also mise ci:local --only api-schema-types (it rejects a hand-written type named after a schema).
Evals and analytics journeys after moving TurnReadermise test:one apps/api/tests/unit/evals/test_live_chat.py, and mise analytics:e2e (needs POSTHOG_E2E_PROJECT_TOKEN and POSTHOG_E2E_PERSONAL_API_KEY; if it cannot run locally, say so in the PR).
Browser stack testsapps/api/tests/integration/real/browser/ follow the events stream with after; #1958 could not run them locally (they need Chrome, Obscura and Caddy). Run them or name them as untested locally.
Type and lintmise run lint:py, mise ci:local --only custom-lints,lint-imports, mise run lint, mise run type-check.

The old-tab case (a client that still sends no wire after deletion)

After deletion the route has one format. A client that sends no wire (a pre-#1945 browser tab, a pre-#1945 desktop build) is served wire 2 frames: items without tool_data, screen_patch frames, timeline reply deltas, and possibly held_cards. That client's parser was written against wire 1.

What it does with these frames is unverified. The current web build treats a frame it cannot read or apply as a reason to reopen on the whole screen (#1945 body). A pre-#1945 build was never tested against screen_patch or a missing tool_data. Possible outcomes: it renders nothing for cards, it errors on an unknown frame kind, or it reconnect-loops against the API. A reconnect loop would be the worst because each open costs a full screen.

Before merging, test it directly:

  1. Build the web app at d85016a7de^ (the parent of #1945).
  2. Run it against an API that includes this change (sim stack: mise infisical -- dev --sim).
  3. Open a conversation with tool calls, run a message, and record: what renders, any console error, and the request count on /events over one minute.
  4. Write the result in the PR body.

If it loops, give such a client an explicit refusal instead of silent wrong frames. For example, the route could answer a request with no wire parameter with a 4xx and a body that tells the client to reload. That also fails the internal tools in section 2 that send none until they are moved, which is the intended outcome. Only do this if step 3 shows a loop. If the old tab degrades safely (stale cards, no loop), accept it and say so.

I recommend removing wire entirely. The alternative, keeping wire and defaulting it to 2, keeps a parameter that selects nothing.

Redis-held frames written by the previous deploy

The events stream's Redis frames live for a day (EVENTS_STREAM_TTL_SECONDS = ONE_DAY_TTL, app/constants/conversation.py). Wire models forbid unknown keys (extra="forbid", libs/shared/py/conversation_wire.py:16). A CardsDelta frame published before the deploy carries tool_data. Once the field is removed from the model, reading that frame back raises a validation error. _vouches handles an unreadable frame as FULL_UNREADABLE (event_stream.py:359-367), so a resume falls back to the whole screen. Whether a live follow that replays such a frame breaks is unverified. Check it with a frame written before the change and read after it.

6. Rollout and rollback

Order:

  1. Move the internal tools (TurnReader users, chat_follow.py, the real-services tests) and delete the wire argument from the web, bot and voice clients. These changes do not need a deploy order: all production clients already send wire=2, and FastAPI ignores a query parameter it does not declare.
  2. Deploy the API first. It stops serving wire 1 and stops accepting wire. Deploy the clients after: the web (Cloudflare deploy), bots and voice-agent images. A new client against an old API still works if both ends still accept wire=2, and an old client against the new API gets wire 2 whichever parameter it sends. If the clients go first, they ask for a wire the old API still serves.
  3. After the API deploy, read the same Loki query as in section 3 for the next days. Wire 1 cannot appear, so look instead at the old-tab outcome: /events request counts per client (user_agent) and any rise in resume of full_unreadable.
  4. The open streams are cut by the API deploy, as for every deploy; clients reconnect from their head (after).

Rollback: revert the PR and redeploy the API. The route then serves wire 1 again for a client that sends no wire, and the wire parameter returns. No data migration is involved: the log and Mongo entries are untouched, and the Redis stream frames are rebuilt by the running steps. The web, bot and voice clients keep sending wire=2 or nothing, so they work either way if you revert only the API. The one irreversible step is deleting the recorded fixture; keep it in git history. If a client release must also be rolled back, do it in the reverse of the deploy order (clients, then API).

7. Acceptance criteria

  • Loki shows zero conversation_wire="1" events requests for at least 7 consecutive days, ending no earlier than 2026-12-02, with wire 2 requests on each of those days and zero events lines with an empty conversation_wire since 2026-11-25. The queries and their results are pasted in the PR.
  • sum by (wire, surface) (increase(gaia_conversation_events_stream_bytes_total{wire="1"}[7d])) is 0 for every surface, pasted in the PR.
  • The pre-#1945 web build was run against the new API, and its behaviour (render, console errors, /events request count over one minute) is in the PR body. If it loops, the route refuses a client with no wire with a message.
  • EventsWire, the wire parameter, the unpatched branch of event_lines, _WIRE_2_ONLY, _UNFOLDED, UnfoldedCards and _unfolded_cards_optional no longer exist. grep -rn "EventsWire\|UnfoldedCards\|_unfolded_cards_optional\|_WIRE_2_ONLY\|_UNFOLDED" apps libs returns nothing.
  • tool_data is not serialized on ReplyItem, WorkItem, NoticeItem, the events stream, GET /conversations/{id} or GET /conversations/{id}/entries. The cut is documented in the PR (option (a) or (b) in section 4).
  • The cards reply delta is gone from the wire, the Python models, the TypeScript schemas and draft.ts.
  • libs/shared/ts has no UnfoldedCardsSchema and no EVENTS_WIRE. No client sends a wire query parameter (grep -rn "wire" chatApi.ts conversation-events.ts conversation.py shows none).
  • The wire label is gone from gaia_conversation_events_* and conversation.wire from the request log. Dashboards and alert rules that grouped by wire are updated (searched tools/alert-rules and the Grafana dashboards; list what was found).
  • The eval live-chat reader (TurnReader), e2e_journeys.py and chat_follow.py read wire 2 (timeline plus patches), with tests, and the eval's tool-call counts match what they were on wire 1 for the same scripted run.
  • follower.ts quoteTarget no longer has the screen-lookup fallback, and its fallback tests are removed.
  • c41f18c5.frames.json is re-recorded or stripped, and both consumers (testing.ts, test_screen.py) pass.
  • apps/web/e2e/screen-timeline.ts:104 matches the URL the web sends, and web-e2e-screen is green.
  • bot-harness-e2e, mise ci:local --only voice-tests, test_conversation_events_wire_real.py and mise ci:local --only api-schema pass, and mise api:types leaves no diff.
  • apps/api/CLAUDE.md:49 and .agents/skills/driving-gaia/SKILL.md:163-167 describe the single format.
  • The PR body names what was not run locally (for example mise analytics:e2e, the browser stack tests, a live LiveKit room, a real chat platform), as #1945, #1946 and #1958 did.

Activity

0

No activity yet.