Repository navigation
Conversation
A concrete top-level `_meta` on a v2 upsert replaced the whole stored object, so every writer had to know every other writer's keys: Agents lost keys sent on earlier reports, and a proxy adding one key erased the Agent's metadata. Apply the update's three-state rule one level down instead. Omitted `_meta` leaves metadata unchanged and `null` clears it; an object patches by top-level key, where omitted keys stay, a key set to `null` is removed, and other values replace that key whole without merging. This covers tool call, terminal, message, session info, compaction, subagent, and session message upserts. Other `_meta` fields, including `plan_update`, are unchanged, and so is v1. Add the v2 Metadata Patches RFD, define the rule and its replay requirements in the v2 extensibility docs, and update related guides, RFDs, and schema descriptions. Add `apply_meta_update` and use it in `ToolCallUpdate::apply_update` and `TerminalUpdate::apply_update`.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v2 upserts now apply a concrete top-level
_metaas a key-level patch instead of replacing the whole stored object. This is the same three-state rule the update already applies to its own fields, one level down:_metaleaves the stored metadata unchanged;nullclears it.nullis removed, and any other value replaces that key whole. Nested objects are not merged, and_meta: {}changes nothing.This adds the v2 Metadata Patches RFD, which covers motivation, replay rules, v1 compatibility, conformance cases, and an FAQ.
Why
Unlike the other patch fields,
_metahas several independent writers. Replacing the whole object made each writer responsible for every other writer's keys:_metaerased the Agent's stored metadata.Scope
The rule applies to the top-level
_metaof:tool_call_update, including a permission request'stool_callsubjectterminal_updateuser_message,agent_message,agent_thoughtsession_info_update,compaction_updatesubagent_updateandsession_messageEvery other
_metafield is unchanged, includingplan_updateand thesession/updateenvelope'sparams._meta(the place for data about a single notification). v1 is unchanged.Review notes
null, or send_meta: nulland then the new object. The two-update form isn't atomic.null.rawInput/rawOutputalready make the same trade-off.session_message,subagent_update, andcompaction_updatestill replace_metawhole. The subagents and compaction RFDs now say so.apply_meta_updateis new public API in the v2 module. It lets clients that store message, session-info, or compaction state reuse the rule.