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_dataand folded astimeline. A change to an item re-sends the whole item as ascreen_update. A reply's cards arrive as acardsdelta that holds the whole card list again. A client that sends nowiregets this. - Wire 2 sends each card once, as
timeline. A change to an item the connection already holds is ascreen_patchframe (set/append/removeat a path, plusbase, a patch counter). A reply's cards arrive as atimelinedelta of changes. It also supports resume withafter=<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_dataas a deprecated, optional field on three item models and a delta (UnfoldedCards,_unfolded_cards_optional).- Four
exclude={"tool_data"}-style special cases inPatchedWire. - The
cardsreply delta. - A
wirelabel on the metric and awirefield on the request log. - A
held_cardsexclusion (_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_CHARScap 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
| Client | Wire it sends | Evidence |
|---|---|---|
| Web (browser) | wire=2 | apps/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 after | libs/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 agent | wire=2 plus after | apps/voice-agent/src/conversation.py:326 (`{"wire": EVENTS_WIRE} |
| Desktop (Electron) | sends none itself; it serves its own bundled copy of the web app | apps/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/cli | none | No 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.
| Caller | File:line | What 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 :318 | Depends 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 journey | apps/api/scripts/analytics_ops/e2e_journeys.py:280, reader await_reply at :298, which uses TurnReader from live_chat.py | Same TurnReader. Covered by mise analytics:e2e. |
| Browser-stack real test follower | apps/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 TurnReader | Same dependency. |
| Events-route real-services tests | apps/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 purpose | The :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(thecardsdelta: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(ReplyDraftpickstool_data).libs/shared/ts/src/conversation/testing.ts:100,:125,:281(fixture builders settool_data: []).libs/shared/ts/src/conversation/frames.ts:22-26comment says acardsdelta is "whole from a server older than wire 2".apps/web/src/features/chat/components/interface/rows/rows.test.ts:52andapps/web/src/features/chat/live/liveChat.render.test.tsx:277settool_data: []in fixtures.libs/shared/ts/src/conversation/view.test.ts:426builds acardsdelta withtool_data: [].- Production web and bot code does not read
.tool_dataon conversation items. A search ofapps/web/srcandapps/botsfor.tool_dataand"tool_data"returned onlylibs/shared/tsand test files. Rows, the bubble and the tool thread readtimeline(#1945 body). - The generated client types (
libs/shared/ts/src/api/generated/schema.d.ts:8282,:12971,:15165,:19020) carrytool_data?onCardsDelta,NoticeItem,ReplyItemandWorkItem. - 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 whenquote_platform_message_idisundefined. 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.jsonis a recorded wire 1 stream (tool_dataat lines 86, 154, 204, 273, 303). It is loaded bylibs/shared/ts/src/conversation/testing.ts:2and byapps/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_requestline carriesconversation.operation = "events"andconversation.wire(1 or 2). Loki's| jsonflattens these toconversation_operationandconversation_wire. platformis a top-level field on bot requests (for examplewhatsapp), andactivity.surface(flattened toactivity_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.wireat all: 2026-11-25T19:11:45Z (the first deploy that carried #1946; the line is awire: 2iMessage bot request, commit2bc80740). 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 noactivity_surfacelabel: 6 with noplatform, imessage 3, telegram 6, whatsapp 11). Wire 1 = 0. Lines with an emptyconversation_wire= 0. - Last 7 days: 622 events lines with an empty
conversation_wire(478activity_surface=bot, 144 without), all before 2026-11-25T19:11Z; and 84 withconversation_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:
- 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.
- 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: deleteEventsWire(ITEMS = 1,PATCHES = 2). Check thatIntEnumis still needed by other classes in that file before dropping its import.app/api/v1/endpoints/conversations.py::7importEventsWire.:233-235thewireQueryparameter (defaultEventsWire.ITEMS).:241the sentence "wire names the newest frame shapes the client reads.":248the"wire": wire.valueentry in thelog.set(conversation=...).:257and:260thewireargument toevent_linesandmetered.- Keep
after.
app/services/conversation/event_stream.py::25importEventsWire,:51importPatchedWire(still used, see below).:414-415_WIRE_2_ONLYand its comment ("a reader built before wire 2 refuses a key it does not know").:459thewire: EventsWire = EventsWire.ITEMSparameter,:461the docstring clause "in the client's wire",:466thepatched = PatchedWire() if wire is EventsWire.PATCHES else Noneswitch, and:473-477the unpatched branch (ConversationEvent(frame=shown).model_dump_json(exclude=_WIRE_2_ONLY)).event_linesalways callsPatchedWire().line(shown).
app/services/conversation/patched_wire.py:- Drop the
_UNFOLDED = {"tool_data"}mechanism (:32,:37,:59,:101) oncetool_datais no longer a serialized field. Theexclude=arguments disappear. :75case ReplyDeltaFrame(payload=CardsDelta(timeline=timeline))is the point where the internalCardsDeltabecomes the wireTimelineDelta. Decide whether the step's internal frame keeps being calledCardsDelta(timeline only) or is renamed; see theCardsDeltanote below.- Update the module docstring (
:1) and the class docstring: it describes "wire 2" and should simply describe the stream.
- Drop the
app/services/conversation/stream_metrics.py::14import,:38_LABELS = ("wire", "surface"),:44and:54the documentation strings ("by wire and surface"),:62-65the loop overEventsWire,:69and:76thewireargument and label values. Drop thewirelabel; keepsurface. 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 bywire(unverified: none found intools/alert-rules, which has only the/eventslatency tests).
libs/shared/py/wide_events.py:248: delete thewire: Literal[1, 2]field ofConversationContext, 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:191asserts("2", "web")and must change.libs/shared/py/conversation_wire.py::176-177UnfoldedCards,:180-184_unfolded_cards_optional.:238ReplyItem.tool_data.:267-273CardsDelta: itstool_datafield andjson_schema_extra. Itstimelinefield is whatPatchedWirediffs, so the class is the internal step-to-encoder message until you decide otherwise.:295-296theReplyDeltaunion includesCardsDelta; once the wire never carries it, the published schema (OpenAPI/TS) must stop listing it (see the generated files below).:345-347the comment "On wire 2, for a work item sent here ..." onheld_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)), soscreen_patches.py:129and 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 fourtool_datablocks marked"deprecated": true(lines4598-4600inCardsDelta,14440-14442inNoticeItem,19269-19271inReplyItem,26364-26366inWorkItem); theEventsWireschema (:8712) and thewirequery parameter (:32236-32244, default1);CardsDeltaitself if it no longer appears in theReplyDeltaunion.libs/shared/ts/src/api/generated/schema.d.ts:tool_data?at:8282,:12971,:15165,:19020;EventsWireat:10140-10144and:19322; thewire?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 ofReplyDeltaSchema, declared at:56),:22-26(comment mentioning a server older than wire 2),:28EVENTS_WIREand the comment above it.libs/shared/ts/src/conversation/draft.ts:11and:27-28(the"cards"case); the exhaustivenevercheck (:36) then still holds because the union lost the member.libs/shared/ts/src/conversation/types.ts:20: remove"tool_data"from thePickofReplyDraft.libs/shared/ts/src/conversation/testing.ts:100,:125,:281, and the matching test fixturesapps/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:21exportsEVENTS_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:12and:77,apps/voice-agent/src/conversation.py:42and:326,apps/voice-agent/src/constants.py:24-25and:76(the__all__entry). Remove thewireargument 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 theweb-e2e-screenlane fails on a console error.libs/shared/ts/src/bots/conversation/follower.ts:615-630: remove the screen-lookup fallback inquoteTarget, keepreply.quote_platform_message_id. Checkapps/bots/__tests__/shared/conversationfor 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 atapps/api/tests/unit/services/conversation/test_screen.py:568. Re-record it as wire 2 or striptool_data, and update both consumers together.fixtures/wire2-run.frames.jsonis generated bytest_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:TurnReaderreadsitem.tool_data(:97,:318) andCardsDelta.tool_data(:248) and ignoresscreen_patch. Move it to readtimelineand 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:55and:298(await_reply),apps/api/tests/integration/real/browser/_stack/stack.py:40and:374,apps/api/tests/unit/evals/test_live_chat.py.apps/api/tests/integration/real/browser/_stack/chat_follow.py:71readsitem.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-444test_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)andupdate["item"]["tool_data"] == [_CARD]).apps/api/tests/unit/services/conversation/test_stream_metrics.py:22and:25-55(the("1", "2")series set andEventsWireuse).apps/api/tests/unit/services/conversation/test_patched_wire.py: droptool_dataassertions; 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_dataas a screen item field. The files in the grep (for exampletest_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 thewire=<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.pymodule docstring (:1) and any "wire 2" wording.
Must NOT be deleted
tool_dataon the log models (app/models/conversation_log_models.py:209,:285,:329), onStreamPayload/ToolDataEvent(app/models/conversation_frame_models.py:35,:80,:85),FoldedCards.tool_data(app/services/conversation/tool_cards.py:83) and thetool_datacard entries on the chat stream. These are the stored log and the internal fold, not the events wire.PatchedWireanditem_changes.py(wire 2's encoder).held_cards,after,EventsResume, theconversation.resume,opening_frame_bytesandframesrequest fields, and the metrics'surfacelabel.
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>.
| What | How to prove it |
|---|---|
| Web chat renders live and on reload from wire 2 only | web-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 restart | bot-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 stream | mise 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 Redis | mise 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, lifespan | mise 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 encoder | pnpm --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 schema | mise 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 TurnReader | mise 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 tests | apps/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 lint | mise 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:
- Build the web app at
d85016a7de^(the parent of #1945). - Run it against an API that includes this change (sim stack:
mise infisical -- dev --sim). - Open a conversation with tool calls, run a message, and record: what renders, any console error, and the request count on
/eventsover one minute. - 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:
- Move the internal tools (
TurnReaderusers,chat_follow.py, the real-services tests) and delete thewireargument from the web, bot and voice clients. These changes do not need a deploy order: all production clients already sendwire=2, and FastAPI ignores a query parameter it does not declare. - 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 acceptwire=2, and an old client against the new API gets wire 2 whichever parameter it sends. If the clients go first, they ask for awirethe old API still serves. - 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:
/eventsrequest counts per client (user_agent) and any rise inresumeoffull_unreadable. - 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 emptyconversation_wiresince 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,
/eventsrequest count over one minute) is in the PR body. If it loops, the route refuses a client with nowirewith a message. -
EventsWire, thewireparameter, the unpatched branch ofevent_lines,_WIRE_2_ONLY,_UNFOLDED,UnfoldedCardsand_unfolded_cards_optionalno longer exist.grep -rn "EventsWire\|UnfoldedCards\|_unfolded_cards_optional\|_WIRE_2_ONLY\|_UNFOLDED" apps libsreturns nothing. -
tool_datais not serialized onReplyItem,WorkItem,NoticeItem, the events stream,GET /conversations/{id}orGET /conversations/{id}/entries. The cut is documented in the PR (option (a) or (b) in section 4). - The
cardsreply delta is gone from the wire, the Python models, the TypeScript schemas anddraft.ts. -
libs/shared/tshas noUnfoldedCardsSchemaand noEVENTS_WIRE. No client sends awirequery parameter (grep -rn "wire" chatApi.ts conversation-events.ts conversation.pyshows none). - The
wirelabel is gone fromgaia_conversation_events_*andconversation.wirefrom the request log. Dashboards and alert rules that grouped bywireare updated (searchedtools/alert-rulesand the Grafana dashboards; list what was found). - The eval live-chat reader (
TurnReader),e2e_journeys.pyandchat_follow.pyread 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.tsquoteTargetno longer has the screen-lookup fallback, and its fallback tests are removed. -
c41f18c5.frames.jsonis re-recorded or stripped, and both consumers (testing.ts,test_screen.py) pass. -
apps/web/e2e/screen-timeline.ts:104matches the URL the web sends, andweb-e2e-screenis green. -
bot-harness-e2e,mise ci:local --only voice-tests,test_conversation_events_wire_real.pyandmise ci:local --only api-schemapass, andmise api:typesleaves no diff. -
apps/api/CLAUDE.md:49and.agents/skills/driving-gaia/SKILL.md:163-167describe 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
0No activity yet.