routine: event-span-agent-ids (2026-05-25)#12
Draft
jim4226 wants to merge 1 commit into
Draft
Conversation
Claude Code v2.1.145 (2026-05-19) ships agent_id and parent_agent_id on OTEL spans so multi-agent traces can be partitioned by invocation without relying on timestamp ordering. The same need arises in CSIS when the Coordinator spawns concurrent Verifier invocations (V3 debate, P1.3) or replication pairs (V4, P1.4): the Auditor has to correlate which cert came from which invocation, not just which role. Add both fields to Event as Optional[str] with None defaults. Existing JSONL files without the fields deserialize cleanly (Pydantic v2 uses the default). emit() gains keyword-only agent_id/parent_agent_id args; callers that don't supply them get None, so every existing call site is unchanged. Adds two regression tests: one that round-trips span-annotated events through disk and verifies chain integrity, one that confirms legacy JSONL (fields absent) deserializes with None defaults. https://claude.ai/code/session_01PnhitjmmouJzNbN5zwxVfU
This was referenced May 25, 2026
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.
Summary
Adds
agent_idandparent_agent_idoptional fields toEventincsis/substrate/event_log.py, mirroring the OTEL span fields shipped in Claude Code v2.1.145. The Coordinator can now tag each agent invocation with a UUID; sub-agents (Verifier, Critic) setparent_agent_idto the spawning event'sagent_id, letting the Auditor partition the event stream by invocation without relying on timestamp ordering.Source
agent_idandparent_agent_idto OTEL spans" — multi-agent sessions now carry structured invocation-lineage through telemetry.Theme
Theme 1 — Multi-agent coordination (also Theme 2 — Trust + verification). When CSIS runs concurrent Verifier invocations for V3 debate (P1.3) or V4 replication (P1.4), the Auditor needs to know which cert came from which invocation, not just which role. Timestamp ordering breaks under concurrent writes to the same EventLog (the exact failure mode Snapshot-12 fixed for seqs). Span IDs are the correct fix layer.
What changed
csis/substrate/event_log.py:Eventgains twoOptional[str]fields (agent_id,parent_agent_id) both defaulting toNone.emit()gains keyword-onlyagent_id/parent_agent_idargs. Every existing call site is unchanged.tests/test_substrate.py: two new regression tests — (1) span-annotated events round-trip through disk and the chain stays valid; (2) legacy JSONL without the fields deserializes withNonedefaults (backward compatibility guard).No cycle-9 chokepoints touched
Eventis a leaf Pydantic model. The change is purely additive optional fields withNonedefaults.Coordinator.__init__,_BackendTracker,writer_iteration_id, and the promotion CAS are untouched. Existing JSONL files without the new fields remain valid.Test plan
Generated by Claude Code