Skip to content

feat(pi): trace model requests - #386

Merged
eersnington merged 1 commit into
mainfrom
feat/pi-model-spans
Nov 5, 2026
Merged

eersnington merged 1 commit into
mainfrom
feat/pi-model-spans

Conversation

@eersnington

@eersnington eersnington commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

ModelRuntime skips pi-ai's observeModelRequest, so default pi() actors have no model spans.

pi.durable.phase  pi.generation request
└── chat claude-opus-5-5
Pi attribute Exported as
pi.ai.request, pi.ai.poll chat <model>
provider gen_ai.provider.name
model gen_ai.request.model
usage.input + cache read + cache write gen_ai.usage.input_tokens
usage.output gen_ai.usage.output_tokens
cost.total gen_ai.usage.cost_usd
  • The adapter translates Pi's model spans, so every actor exports the same span, with or without its own models.
  • traceModelRequests wraps the runtime that createActorModelRuntime builds and emits Pi's span names, because pi-ai does not export observeModelRequest.
  • It is a Proxy, because completeSimple calls streamSimple inside ModelRuntime. Patched methods would give that call two spans.
  • tests/tracing-models.test.ts expects exactly one span per call, so it fails when Pi fixes ModelRuntime. Delete the wrapper then. Users see the same spans.
  • A failed attempt records error.type: provider_error and no error text.

This is part 2 of 2 in a stack:

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

📟 Pip-Boy · dc429ab

📦 Packages · fresh npm install resolve, no lockfile · this PR vs base

No notable install size, dependency, or entrypoint changes across 10 packages.

All 10 packages · linux-x64-gnu
package (linux-x64-gnu) @latest base this PR Δ vs base packages
@rivet-dev/pi 372.8 MB 381.9 MB 381.9 MB +8.5 KB (+0.0%) 220 (0)
@rivet-dev/sandbox-adapter 113.8 KB 114.5 KB 114.5 KB 0 1 (0)
@sandbox-agent/cli-shared 27.2 KB 27.2 KB 27.2 KB 0 1 (0)
@sandbox-agent/persist-indexeddb 12.4 KB 12.4 KB 12.4 KB 0 1 (0)
@sandbox-agent/persist-postgres 12.3 KB 12.3 KB 12.3 KB 0 1 (0)
@sandbox-agent/persist-rivet 12.2 KB 12.2 KB 12.2 KB 0 1 (0)
@sandbox-agent/persist-sqlite 12.3 KB 12.3 KB 12.3 KB 0 1 (0)
@sandbox-agent/react 41.6 MB 41.9 MB 41.9 MB 0 15 (0)
acp-http-client 6.7 MB 6.7 MB 6.7 MB 0 3 (0)
sandbox-agent 31.0 MB 31.0 MB 31.0 MB 0 8 (0)

🧹 Rust dependencies

Skipped: this PR doesn't change any Rust code or dependencies.

🦀 Binaries

Skipped: this PR doesn't change any Rust code.

⏱ Timing

job wall time slowest step
changes 23s checkout · 19s
zizmor 20s checkout · 12s
footprint 2m46s Pack the base · 40s
⏭ hygiene — skipped
⏭ native · ${{ matrix.platform }} — skipped
⏭ self-test — skipped
report 30s setup-node · 12s
🔭 Full CI trace for this commit

One OpenTelemetry trace of CI and Pip-Boy for dc429ab: every job and step, with the sizes above attached. Run after CI finishes.

pnpm install --frozen-lockfile --filter 'pipboy...'
pnpm --filter pipboy pipboy trace --sha dc429abe4c46a59508f1edb50301b593ea0e34ef

Add --otlp <url> to send it to any OTLP/HTTP collector.

Agent instruction: From a rivet-dev/agents checkout, run the commands above, then read the trace file the last command prints. List the slowest jobs and steps and explain where CI time went.

Base automatically changed from feat/pi-otel-traces to main November 5, 2026 14:39
@eersnington
eersnington merged commit eae54b8 into main Nov 5, 2026
6 of 7 checks passed
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.

1 participant