Skip to content

Loom traces record invocation origin, outcome and benchmark context - #1112

Open
zlareb1 wants to merge 15 commits into
mainfrom
feat/prompt-observability-20261119
Open

zlareb1 wants to merge 15 commits into
mainfrom
feat/prompt-observability-20261119

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

Changelog entry

Loom traces distinguish tool, automatic-hook and background-worker origins and record the outcome, duration and optional benchmark context of each call. Hook invocation headers need a server that supports them.

Why

Transport and session identity do not explain why Loom was called. Invocation metadata gives operators and evaluators a way to count actual Loom calls and filter them by benchmark run, case and variant without treating missing origin or usage as measured data.

Scope and risk

  • Registered HTTP operations under /v1/{op} and MCP tools/call requests record root observations, including refusals and calls to loom_op. HTTP account routes under /v1/me/*, other MCP protocol methods such as tools/list and ping, batch envelopes, and nested stages are not counted. Each batch tool call and received retry has its own attempt ID. Authenticated idempotent replays keep their trace identity without a capture-consent lookup.
  • Each invocation starts a separate trace because erasure deletes whole traces. Supplied trace context is a link, not a parent. Trace grouping uses the authenticated, resolved session when available; callers cannot use origin or correlation fields to change identity or access. Private diagnostics retain their export boundary.
  • Provider observations keep their own timing and measured usage. Missing usage or price remains unknown. The Code Plane board groups failed HTTP and MCP calls by outcome, rather than grouping HTTP requests by status code. The hook transport reports invocation context without sending prompt text and rejects redirects when it carries hook context. Both plugin manifests use 1.2.55.

Compatibility, rollout and rollback

  • Wire: optional invocation headers and MCP _meta.loom fields carry origin, correlation and benchmark IDs. No operation argument, stored identity or authorization default changes.
  • Operator steps: if the hook server URL redirects, set it to the final URL before upgrading. FastAPI URL exclusions do not suppress Loom call observations; sampling and export policies still apply. Select loom.call.root=true for request panels. Use opaque, non-sensitive values for optional invocation IDs; accepted IDs are exported as supplied.
  • Rollback: revert the instrumentation and plugin changes. No migration or backfill is required. Exported observations follow the tracing backend's retention and erasure policy.

Tests

  • make format-check, make lint and make typecheck pass on the composed source.
  • Focused Python tests: 680 passed across invocation and replay behavior, MCP HTTP batch isolation, capture consent, the plugin sender inventory, the dashboard spec, and documentation. The SQL timing case also passed.
  • node --test integrations/claude-code-plugin/tests/{loom-client-status,prompt-context,usage}.test.mjs: 27 passed.
  • Earlier CI on this PR failed Cell acceptance and a unit SQL timing check; a later Helm job stopped at a tool download returning HTTP 504. None of those results is waived. Full CI and fresh independent review are required for this head.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Codex. Checked transport, trace isolation, usage and generated plugin behavior with focused tests.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass. Full unit and integration suites run in CI.
  • Generated plugin files follow the canonical plugin. No SDK wire model, generated reference table or schema changes.
  • No migration is added or edited.
  • Both plugin manifests are bumped, and no other checked open PR uses that version.
  • No frontend changes.
  • Documentation describes the invocation fields, operator steps and counting limits.
  • Repository text contains no deployment-specific details.
  • Commits are signed off.

Note

Medium Risk
Touches HTTP/MCP request paths and trace shape operators use for counting and erasure, though instrumentation is designed to fail open and not change authorization or stored identity.

Overview
Adds loom.call.root observation spans for registered HTTP /v1/{op} and MCP tools/call (including refusals and loom_op), with origin, transport, outcome, duration, attempt IDs, and optional benchmark/correlation metadata from headers or MCP _meta.loom. Each call starts its own trace (with optional W3C span links), and provider/ASGI children stay out of request counts.

Claude Code and Codex plugins (1.2.55) attach validated X-Loom-* hook headers (no prompt body), reject redirects when those headers are set, and skip usage rows until token counters are safe integers.

HyperDX / Code Plane panels and docs now filter on loom.call.root=true instead of loom.operation; the failed-code tile groups by loom.call.outcome rather than HTTP status codes.

Reviewed by Cursor Bugbot for commit 517f489. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 26, 2026 4:42pm UTC
loom-telemetry Ready Ready Preview Nov 26, 2026 4:42pm UTC

Request Review

@zlareb1
zlareb1 force-pushed the feat/prompt-observability-20261119 branch 3 times, most recently from 6129bf9 to b9ef5b2 Compare November 21, 2026 16:54
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Share operation name resolution with routing so refused aliases retain their target, and classify unsupported per-call protocol versions as refusals.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Use the routing help aliases for invocation attribution and retain a bounded generic label for unknown or malformed loom_op requests.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Stamp resolved identity before cache replay so tenant trace discovery and erasure find each attempt. Early authenticated refusals carry verified token identity without trusting the requested namespace.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
The HTTP observer calls the core dispatcher directly. Keep batch admission and pre-send proof assertions on the executed path.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Admitted replay spans carry the authorized tenant identity. Describe that order in the dispatcher documentation.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
The transport adds bounded, redacted invocation headers without changing request bodies or admission. Renew only the two reviewed client module digests.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
One host tool can trigger several Loom requests. Logical request counting needs a caller guarantee of unique IDs that persist across retries.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 force-pushed the feat/prompt-observability-20261119 branch from b9ef5b2 to 6e04d61 Compare November 21, 2026 19:13
Link trace context instead of sharing a trace across invocations. Record resolved session context and catalog refusals, and count each tool call in a batch independently.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Retain the qualified invocation changes and current main without rewriting the existing pull request branch.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Preserve admitted identity on HTTP and MCP replays without resolving capture consent for a skipped handler. Scope HTTP invocation counts to registered routes.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Provider spans can share the operation name with a call root. Document the scope of URL exclusions and the need for non-sensitive caller IDs.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
The HTTP envelope holds the status code separately from the invocation span. Count failed calls where the operation and outcome are recorded together.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>

This branch has not been deployed

No deployments
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