Skip to content

routine: event-span-agent-ids (2026-05-25)#12

Draft
jim4226 wants to merge 1 commit into
mainfrom
claude/daily-2026-05-25-event-span-agent-ids
Draft

routine: event-span-agent-ids (2026-05-25)#12
jim4226 wants to merge 1 commit into
mainfrom
claude/daily-2026-05-25-event-span-agent-ids

Conversation

@jim4226
Copy link
Copy Markdown
Owner

@jim4226 jim4226 commented May 25, 2026

Summary

Adds agent_id and parent_agent_id optional fields to Event in csis/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) set parent_agent_id to the spawning event's agent_id, letting the Auditor partition the event stream by invocation without relying on timestamp ordering.

Source

  • URL: https://code.claude.com/docs/en/changelog (v2.1.145, 2026-05-19)
  • Key entry: "Added agent_id and parent_agent_id to 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: Event gains two Optional[str] fields (agent_id, parent_agent_id) both defaulting to None. emit() gains keyword-only agent_id/parent_agent_id args. 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 with None defaults (backward compatibility guard).

No cycle-9 chokepoints touched

Event is a leaf Pydantic model. The change is purely additive optional fields with None defaults. Coordinator.__init__, _BackendTracker, writer_iteration_id, and the promotion CAS are untouched. Existing JSONL files without the new fields remain valid.

Test plan

python -m pytest tests/test_substrate.py -v  # 15 passed (13 before + 2 new)
python -m pytest tests/ -q                   # 252 passed, 0 failed

Generated by Claude Code

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants