Skip to content

feat(daemon): emit GenAI spans via the weave SDK - #128

Merged
rgao-coreweave merged 4 commits into
mainfrom
109-07-sdk-core
Jul 22, 2026
Merged

feat(daemon): emit GenAI spans via the weave SDK#128
rgao-coreweave merged 4 commits into
mainfrom
109-07-sdk-core

Conversation

@rgao-coreweave

@rgao-coreweave rgao-coreweave commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Swap the daemon's conversation/turn core onto the weave SDK genai primitives.

  • weave.init() replaces the hand-rolled tracer/OTLP exporter wiring; OTel diag warnings/errors land in the daemon log (they were silent).
  • One Conversation handle per session seeds conversation.id, agent identity, and the integration attributes through the handle chain, so there is no ambient per-event state; runIsolated per event keeps the SDK's single-active guards clear of concurrent sessions.
  • Turns via startTurn; turn input rides TurnInit.userMessage, instruction files ride TurnInit.systemInstructions. A turn interrupted without a Stop hook closes as superseded_by_next_prompt instead of leaking the root span.
  • sessionState moves to weave-handle types; its tracker/team fields are consumed in feat(trace): trace explicit Agent Team lifecycles #143.

Chat/tool/subagent emission is parked (handlers count tool calls and log) and lands in #142/#143 with its tests. Each PR builds green; the plugin is fully functional at #143.

Stack: #141 → this PR → #142#143#129#130#131#144#145

npm run check green (61 tests).

@rgao-coreweave
rgao-coreweave changed the base branch from 109-06-session-types to graphite-base/128 July 17, 2026 20:18
@rgao-coreweave
rgao-coreweave changed the base branch from graphite-base/128 to 109-05-session-helpers July 17, 2026 20:18
@rgao-coreweave
rgao-coreweave force-pushed the 109-05-session-helpers branch 2 times, most recently from 3587734 to 2d19b88 Compare July 17, 2026 20:39
@rgao-coreweave
rgao-coreweave changed the base branch from 109-05-session-helpers to graphite-base/128 July 17, 2026 20:47
@rgao-coreweave
rgao-coreweave changed the base branch from graphite-base/128 to main July 18, 2026 00:05
@w-b-hivemind

w-b-hivemind Bot commented Jul 18, 2026

Copy link
Copy Markdown

HiveMind Sessions

4 sessions · 1h 23m · $110

Session Agent Duration Tokens Cost Lines
Sync and Push PR to Master
019f86d9-8d45-7ff1-b9d8-da07c10c0ab5
codex 1m 48.1K $0.64 +0 -0
Sync Master Branch and Push PR
019f86d8-bea1-7323-9e05-468872aa9c00
codex 39s 18.4K $0.19 +0 -0
Sync Master and Push PR
9ab611fa-e2d4-4cd6-94d6-6beb72a0529a
claude 1s 0 $0.00 +0 -0
Clean Up and Refine PR Changes
9c63add0-5ef7-48e6-97e7-3b41bf8d962e
claude 1h 21m 254.0K $109 +237 -610
Total 1h 23m 320.4K $110 +237 -610

View all sessions in HiveMind →

Run claude --resume 9ab611fa-e2d4-4cd6-94d6-6beb72a0529a or codex resume 019f86d9-8d45-7ff1-b9d8-da07c10c0ab5 to pickup where you left off.

@rgao-coreweave
rgao-coreweave force-pushed the 109-07-sdk-core branch 4 times, most recently from 9e23361 to 4e70e9a Compare July 18, 2026 07:10
@rgao-coreweave
rgao-coreweave changed the base branch from main to 109-07a-genai-helpers July 19, 2026 06:09
@rgao-coreweave
rgao-coreweave changed the base branch from 109-07a-genai-helpers to graphite-base/128 July 19, 2026 22:35
@rgao-coreweave
rgao-coreweave changed the base branch from graphite-base/128 to main July 19, 2026 22:35
@rgao-coreweave
rgao-coreweave changed the base branch from main to graphite-base/128 July 19, 2026 22:37
@rgao-coreweave
rgao-coreweave changed the base branch from graphite-base/128 to 109-13-genai-helpers July 19, 2026 22:37
@rgao-coreweave
rgao-coreweave force-pushed the 109-07-sdk-core branch 3 times, most recently from b6e8465 to 99329a6 Compare July 21, 2026 06:30
@rgao-coreweave
rgao-coreweave marked this pull request as ready for review July 21, 2026 06:32
@rgao-coreweave
rgao-coreweave requested a review from a team as a code owner July 21, 2026 06:32

@drtangible drtangible left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

Comment thread src/sessionState.ts
rgao-coreweave and others added 3 commits July 21, 2026 20:08
Swap the daemon's conversation/turn core onto the weave SDK genai
primitives:

- weave.init() replaces the hand-rolled tracer provider/OTLP exporter
  wiring; OTel diag warnings/errors land in the daemon log (exporter
  failures were silent).
- One Conversation handle per session (sessionState starts it) seeds
  gen_ai.conversation.id, agent identity, and the integration
  attributes onto every span through the handle chain, so there is no
  ambient per-event state. runIsolated per event keeps the SDK's
  single-active guards clear of concurrent sessions.
- Turns via conversation.startTurn: turn input rides
  TurnInit.userMessage, instruction files ride
  TurnInit.systemInstructions. Turns that end without a Stop hook (user
  interrupt) close as superseded_by_next_prompt instead of leaking the
  root span.
- sessionState moves wholesale to weave-handle types; the tracker/team
  fields it declares are consumed by the subagent PR later in this
  stack.

Chat (per-response LLM), tool, and subagent span emission is parked:
the handlers count tool calls for the turn attrs and log, and their
tests leave with them; both return rewritten in the next PRs of this
stack. The plugin is not fully functional until the stack lands; each
PR builds green (npm run check).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The turn's ordinal (weave.claude_code.turn.number) is derivable from the
conversation's ordered turns server-side; stop setting it on the span.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
weave.claude_code.plugin.version is session-level, so set it once on the
Conversation; it propagates to every turn and child span like the other
integration attributes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rgao-coreweave
rgao-coreweave changed the base branch from 109-13-genai-helpers to main July 22, 2026 03:09
@rgao-coreweave
rgao-coreweave merged commit 442d5a7 into main Jul 22, 2026
4 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants