Skip to content

fix: include plugin LLM calls in usage diagnostics - #107937

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
Last-emo-boy:fix/98968-plugin-llm-usage-diagnostics
Aug 6, 2026
Merged

vincentkoc merged 1 commit into
openclaw:mainfrom
Last-emo-boy:fix/98968-plugin-llm-usage-diagnostics

Conversation

@Last-emo-boy

@Last-emo-boy Last-emo-boy commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Plugin calls through runtime.llm.complete now contribute trusted token and cost diagnostics at the host-owned completion boundary.

Root Cause

Direct and isolated plugin LLM completions returned normalized usage, but the shared completion owner did not emit that usage to diagnostics.

Three sibling defects remained:

  • runCliAgent exposed CLI-isolated usage in meta.agentMeta.usage, but runCliIsolatedCompletion dropped it before the shared finalizer.
  • Direct provider completion resolves both successful and error terminal events as assistant messages. The owner discarded stopReason and output validity, so resolved errors, aborts, and reasoning-only messages could emit usage.
  • Earlier attribution repairs exposed host plugin identity through public diagnostic event or Plugin SDK listener shapes, allowing observation or forgery outside the OTel exporter boundary.

Fix

  • Finalize direct, harness-isolated, and CLI-isolated completions through one shared host path.
  • Thread CLI-reported usage through the isolated adapter; do not add a CLI-specific emitter.
  • Emit exactly one trusted model.usage event only for a successful visible completion with positive token or cost usage.
  • Keep missing, zero, reasoning-only, unavailable-context, diagnostics-disabled, resolved-error, aborted, and rejected isolated completions silent.
  • Derive plugin identity only from trusted host policy and one-shot event provenance.
  • Keep OpenClawPluginServiceContext.internalDiagnostics.onEvent, DiagnosticEventPrivateData, public metadata, and SDK export counts unchanged.
  • Scope hidden host identity to a fresh OTel listener registration. Ordinary public/trusted listeners and Prometheus never receive it.
  • Preserve independently updated official OTel package compatibility through the existing three-argument listener transport without exposing hostPluginId in the public type.
  • Add openclaw.plugin only to the trusted OTel usage span. Existing OTel metric labels and Prometheus labels remain unchanged.
  • Strip caller-supplied attribution at the public trusted emitter and again at the OTel-private clone boundary.

User Impact

Operators can attribute plugin-initiated LLM spend in traces without changing existing metric series, dashboards, or recording rules. Non-exporter plugins cannot observe or claim another plugin's trace identity.

Evidence

  • Published head: 8d55032feba093179c690cab4080c40ea9d59bbb, one contributor-preserving commit.
  • Focused sibling matrix: 385 tests passed across direct runtime, harness/CLI isolated adapters, diagnostic dispatch, service capability, Plugin SDK declaration, OTel, Prometheus, and llm-task suites.
  • Regression coverage includes:
    • resolved provider error, aborted, and thinking-only direct silence;
    • harness error, aborted, and thinking-only rejection;
    • CLI-isolated usage propagation and missing-usage silence;
    • public listener/type non-observation;
    • caller-supplied attribution rejection;
    • OTel registration-scoped provenance when one callback is reused in generic and OTel lanes;
    • old/new core and official OTel package listener compatibility.
  • Final P0-P2 autoreview: no actionable findings; patch correct at confidence 0.90.
  • oxfmt --check, focused oxlint, git diff --check, max-lines, extension boundary, deprecated-API, dead-export, Plugin SDK API/export, and Plugin SDK surface checks passed.
  • Plugin SDK surface remains count-neutral: 4831 public exports, 2908 callable exports, 0 forbidden package subpaths.

Exporter capability boundary

  • src/plugins/registry-registrars-operations.ts:300 captures pluginId, origin, and trustedOfficialInstall from the host-owned plugin record when a service is registered; the plugin supplies only the service implementation.
  • src/plugins/services.ts:38 grants internalDiagnostics only when the host record owner matches the exact diagnostics-otel or diagnostics-prometheus service id and the record is bundled or a verified official install.
  • src/plugins/manifest-registry.ts:835 derives official-install trust from a matching install path, install record, official catalog package/id, and registry or trusted official ClawHub source. Workspace/path/npm-pack/custom-source/unrecorded lookalikes cannot obtain the capability from manifest claims.
  • src/infra/diagnostic-events.ts:1093 gives the one-shot host identity only to the listener wrapper marked by the OTel service context. Public listeners, generic trusted listeners, and Prometheus receive cloned private data without hostPluginId; src/plugins/services.test.ts:781 covers the grant and spoof-denial matrix.
  • hostPluginId is absent from the public listener declaration, and the internal test-runtime listener API is not shipped as a package export. OpenClaw native plugins are trusted in-process code; the supported plugin model does not claim process isolation from deliberate runtime tampering.

Exact-head real Gateway + OTLP proof

Redacted receiver/span output:

{"spanName":"openclaw.model.usage","pluginId":"llm-task","inputTokens":64,"outputTokens":24,"totalTokens":88,"attributedUsageSpanCount":1,"requestContentPresent":false}

The E2E fails if the completion emits a second matching usage span, if attribution is missing or forged, or if request content reaches OTLP.

Production runtime delta is +217/-83 (net +134), justified by the shared completion owner, CLI adapter propagation, and exporter-private security/version-skew boundary. Tests and QA are net +971; docs are net +5.

No changelog entry is included for this contributor repair.

Fixes #98968

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: diagnostics-otel Extension: diagnostics-otel extensions: diagnostics-prometheus size: S labels Jul 15, 2026
@Last-emo-boy

Last-emo-boy commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Land-ready proof for f52816089d1ba1d23312cdda6adfe9d25c872c54:

  • Final PR diff: 10 files, 287 additions / 18 deletions. The tenth file is the official generator's one-line docs-map synchronization.
  • Best-fix verdict: emit token/cost usage once at the trusted host runtime boundary, attribute it with the trusted plugin policy owner, keep exporter labels bounded with none, and do not mix plugin completion latency into the agent-run duration histogram.
  • Focused local proof: 183 tests passed across the runtime, diagnostic bus, OTel, and Prometheus suites after the final rebase.
  • Docs map check, docs formatting, diff checks, SDK API baseline/surface checks, and targeted formatting passed.
  • Fresh autoreview: no accepted/actionable findings, patch is correct, confidence 0.94.
  • Exact-head hosted CI against current base a3f06fb119b: all 71 checks succeeded, with 0 pending and 0 failures. Run: https://github.com/openclaw/openclaw/actions/runs/29386730484
  • GitHub reports the PR as mergeable. The branch is one unrelated test-only commit behind, but the successful PR merge run used that current base.

Known proof gap: no live provider/OTLP call was made; the source-level completion path and both exporter outputs are covered by focused deterministic tests.

@Last-emo-boy
Last-emo-boy force-pushed the fix/98968-plugin-llm-usage-diagnostics branch from ed089fc to a023985 Compare July 15, 2026 03:16
@Last-emo-boy
Last-emo-boy force-pushed the fix/98968-plugin-llm-usage-diagnostics branch from a023985 to f528160 Compare July 15, 2026 03:31
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 16, 2026
@clawsweeper

clawsweeper Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 6, 2026, 4:36 AM ET / 08:36 UTC.

ClawSweeper review

What this changes

Records successful direct and isolated plugin LLM completion usage in diagnostics and adds host-derived plugin identity only to the corresponding OpenTelemetry span.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking findings. This PR remains necessary because current main still omits plugin LLM usage diagnostics; the exact head implements the approved host-owned path with sufficient real Gateway-to-OTLP proof.

Priority: P2
Reviewed head: 8d55032feba093179c690cab4080c40ea9d59bbb

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-boundary repair with strong regression coverage, exact-head real behavior proof, and no actionable finding; only current-base validation remains before landing.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body provides an exact-head redacted Gateway-to-OTLP run, and the checked E2E asserts one attributed span with token values and no request-content leakage.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body provides an exact-head redacted Gateway-to-OTLP run, and the checked E2E asserts one attributed span with token values and no request-content leakage.
Evidence reviewed 5 items Current-main gap: Current main has no plugin runtime model.usage emission in the direct or isolated completion paths, so the reported operator-visible diagnostics gap remains.
Canonical completion owner: The PR normalizes usage once and emits one trusted usage event only for enabled diagnostics and positive usage; direct and isolated paths call this shared finalizer.
Private attribution boundary: Host plugin identity is released only to the OTel-marked listener wrapper; public, generic trusted, and Prometheus listeners receive cloned data without it.
Findings None None.
Security None None.

How this fits together

Plugin runtime LLM calls produce normalized token and cost data, which diagnostics exporters consume. This PR routes valid completion usage through the shared host finalizer to OpenTelemetry and Prometheus while keeping plugin attribution private to OpenTelemetry spans.

flowchart LR
  A[Plugin LLM call] --> B[Direct or isolated completion]
  B --> C[Shared usage finalizer]
  C --> D[Trusted diagnostics dispatcher]
  D --> E[OpenTelemetry usage span]
  D --> F[Prometheus aggregate metrics]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is cleanly mergeable but behind current main by 13 commits; refresh current-base merge-ref validation before landing.
  • Resolve merge risk (P1) - Aggregate usage values will intentionally increase for plugin calls, although metric labels, Prometheus series, and the public Plugin SDK listener contract remain unchanged.
  • Complete next step (P2) - No mechanical repair remains; refresh current-base merge-result validation, then take the normal maintainer landing path.
Agent review details

Security

None.

PR surface

Source +188, Tests +917, Docs +5. Total +1110 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 10 271 83 +188
Tests 9 925 8 +917
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 20 1201 91 +1110

Review metrics

Metric Value Why it matters
Production versus test delta production +134 net; tests/QA +971 net; docs +5 The production growth is justified by one shared completion owner and the exporter-private attribution boundary; the large regression matrix covers direct, isolated, and exporter sibling paths.
Public telemetry surface 1 optional span attribute added; 0 public SDK listener fields and 0 metric-label dimensions added This preserves existing dashboards, recording rules, and Plugin SDK consumers while adding trace-level attribution.

Stored data model

Persistent data-model change detected: vector/embedding metadata: extensions/diagnostics-otel/src/service-events.ts, vector/embedding metadata: extensions/diagnostics-otel/src/service-recorders-usage.ts, vector/embedding metadata: src/infra/diagnostic-events.plugin-usage.test.ts, vector/embedding metadata: src/infra/diagnostic-events.ts, vector/embedding metadata: src/plugins/runtime/runtime-llm-diagnostics.runtime.test.ts, vector/embedding metadata: src/plugins/runtime/runtime-llm-isolated.runtime.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #98968
Summary: This PR is the concrete implementation candidate for the open report about missing plugin runtime LLM usage diagnostics.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Refresh merge-result validation (recommended)
    Run the focused runtime diagnostics and Gateway-to-OTLP checks against the current merge result before landing, preserving the existing metric-label and SDK-listener contracts.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Validate the exact current-base merge result with the runtime diagnostics and Gateway-to-OTLP coverage; preserve existing aggregate metric labels and public Plugin SDK listener types.

Technical review

Best possible solution:

Validate the clean merge result against current main, then land the shared host-finalizer repair without adding plugin labels to aggregate metrics or public SDK listener types.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current main returns plugin completion usage without emitting model.usage, while the exact-head Gateway-to-OTLP scenario exercises the repaired production boundary.

Is this the best way to solve the issue?

Yes. A single host-owned finalizer covers direct and isolated completions, while the dispatcher carries attribution privately to the OTel exporter instead of expanding public event or SDK contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 245dbacbe091.

Labels

Label justifications:

  • P2: The PR repairs incomplete operator cost and token diagnostics without evidence of urgent runtime unavailability.
  • merge-risk: 🚨 compatibility: Existing aggregate diagnostics will include plugin usage after merge, which can intentionally change observed totals even though labels and public listener types remain stable.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body provides an exact-head redacted Gateway-to-OTLP run, and the checked E2E asserts one attributed span with token values and no request-content leakage.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an exact-head redacted Gateway-to-OTLP run, and the checked E2E asserts one attributed span with token values and no request-content leakage.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Authored the exact head, recently maintained diagnostics on main, and recorded the accepted telemetry contract in the discussion. (role: recent area contributor and decision owner; confidence: high; commits: 8d55032feba0, 397a60582a, 4db44c6923; files: src/plugins/runtime/runtime-llm.runtime.ts, src/infra/diagnostic-events.ts, src/plugins/services.ts)
  • Daev Mithran: Introduced the plugin LLM API that owns the missing completion-to-diagnostics boundary. (role: feature introducer; confidence: medium; commits: 9e1e59717ffd; files: src/plugins/runtime/runtime-llm.runtime.ts)
  • steipete: Carried the recent OpenTelemetry recorder refactor adjacent to the span contract preserved by this PR. (role: adjacent exporter contributor; confidence: medium; commits: 00af5a59893; files: extensions/diagnostics-otel/src/service-recorders-usage.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-30T10:45:43.655Z sha f52816089d1ba1d23312cdda6adfe9d25c872c54 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-30T18:01:00.620Z sha f52816089d1ba1d23312cdda6adfe9d25c872c54 :: needs real behavior proof before merge. :: [P1] Preserve the existing metrics label contract
  • reviewed 2026-08-02T15:16:42.346Z sha f52816089d1ba1d23312cdda6adfe9d25c872c54 :: needs real behavior proof before merge. :: [P1] Preserve existing usage metric label contracts
  • reviewed 2026-08-06T04:31:18.578Z sha 12acb69b29ac7780d3516efb2235891e5a8778ea :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-06T04:41:01.244Z sha 4b236be2faf7e4f387ec70a7b30ef33824854e9e :: needs real behavior proof before merge. :: [P1] Derive plugin attribution from host-only provenance
  • reviewed 2026-08-06T05:42:20.566Z sha 41713d67cbde374a7a25ce8f552c886275fddb8f :: needs changes before merge. :: [P2] Keep host plugin identity out of public listener metadata
  • reviewed 2026-08-06T06:47:38.302Z sha ae21df4f9d4362076fb60d579a2afaace84feb2c :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-06T07:38:32.580Z sha ae21df4f9d4362076fb60d579a2afaace84feb2c :: needs maintainer review before merge. :: none

@vincentkoc

Copy link
Copy Markdown
Member

Maintainer decision: preserve every existing OpenTelemetry metric and Prometheus label contract.

The approved repair is:

  • emit one trusted model.usage event at the host-owned plugin completion boundary for both direct and isolated execution
  • derive optional plugin attribution only from the host-owned policy identity
  • expose that attribution only as openclaw.plugin on the openclaw.model.usage trace span
  • keep all shared OTel metrics, Prometheus series, run-duration metrics, and non-plugin series unchanged
  • prove the path with a redacted real plugin completion and OTLP export, not unit tests alone

This resolves the additive-versus-breaking telemetry decision. The existing contributor PR should be repaired in place and preserve contributor credit.

@vincentkoc vincentkoc self-assigned this Aug 6, 2026
@vincentkoc
vincentkoc force-pushed the fix/98968-plugin-llm-usage-diagnostics branch from f528160 to 12acb69 Compare August 6, 2026 04:04
@openclaw-barnacle openclaw-barnacle Bot added extensions: qa-lab size: L triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 6, 2026
@vincentkoc
vincentkoc force-pushed the fix/98968-plugin-llm-usage-diagnostics branch from 12acb69 to 4b236be Compare August 6, 2026 04:33
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Please review exact published head 4b236be2faf7e4f387ec70a7b30ef33824854e9e. The PR body now contains the redacted exact-head AWS Gateway-to-OTLP run and terminal summary. Exact-head CI is running.

@clawsweeper

clawsweeper Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Aug 6, 2026
@vincentkoc
vincentkoc force-pushed the fix/98968-plugin-llm-usage-diagnostics branch from 4b236be to 921524f Compare August 6, 2026 05:01
@clawsweeper

clawsweeper Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@vincentkoc
vincentkoc force-pushed the fix/98968-plugin-llm-usage-diagnostics branch from 1c7c3d0 to e8a28f4 Compare August 6, 2026 06:33
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Please review exact published head e8a28f42bbcd7dede01ed1e74db0a3b90e5ec675.

Both rank-up moves from the 41713d67 review are complete: host identity is absent from public diagnostic metadata/listeners, and the capability-gated private diagnostics lane carries it only to trusted OTel. Regressions prove public listeners cannot observe it and public/plugin-supplied events cannot spoof it.

This head is the test-only lint successor to 1c7c3d0a; production is byte-identical. The PR body contains 388 focused-test results, the final-head autoreview disposition, and redacted AWS Gateway-to-OTLP receiver output proving exactly one attributed isolated llm-task usage span with no request content.

@clawsweeper

clawsweeper Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Aug 6, 2026
@vincentkoc
vincentkoc force-pushed the fix/98968-plugin-llm-usage-diagnostics branch from e8a28f4 to ae21df4 Compare August 6, 2026 06:40
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL and removed size: L labels Aug 6, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Please review the exact published head ae21df4f9d4362076fb60d579a2afaace84feb2c.

Exact-head CI is green in run 31078106256. The PR body contains sanitized AWS Crabbox proof for runs run_cb763238bcb8 and run_3441ec2eab0f, including redacted receiver output showing exactly one attributed usage span and no request content.

@clawsweeper

clawsweeper Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Emit usage once at the shared plugin completion boundary and expose host-derived plugin identity only on OTel usage spans. Preserve aggregate metric labels and cover the redacted Gateway path end to end.

Refs openclaw#98968

Co-authored-by: Last-emo-boy <[email protected]>

Co-authored-by: ZengWen-DT <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Aug 6, 2026
@vincentkoc
vincentkoc force-pushed the fix/98968-plugin-llm-usage-diagnostics branch from ae21df4 to 8d55032 Compare August 6, 2026 07:45
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Please review exact published head 8d55032feba093179c690cab4080c40ea9d59bbb.

The remaining same-invariant fixes are complete:

  • host identity is absent from public SDK listener types and ordinary/Prometheus listeners;
  • OTel provenance is registration-scoped, spoof-resistant, and compatible across official external OTel/core version skew;
  • direct usage emits only for successful visible terminal outcomes;
  • CLI-isolated usage reaches the one shared finalizer.

Exact-head proof is in the PR body: 385 focused tests, clean P0-P2 autoreview, and redacted AWS Gateway-to-OTLP output showing one attributed span and no request content.

@clawsweeper

clawsweeper Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

Exact-head ClawSweeper review disposition for 8d55032feba093179c690cab4080c40ea9d59bbb:

  1. Current-base merge-result validation: OPENCLAW_TESTBOX=1 scripts/pr prepare-run 107937 passed. A local-only merge result against then-current origin/main (b87a2c33982a, parents d8147f81b72 + 8d55032feba) passed 309 focused tests across seven Vitest shards, including the real Gateway + llm-task + OTLP receiver E2E. Provider: aws; lease: cbx_723cc960f28f; run: run_6f637bffdad3; result: succeeded, exit 0, lease stopped. Run: https://crabbox.openclaw.ai/portal/runs/run_6f637bffdad3

    main advanced once during that run to f99b6a48f77, changing only four unrelated src/auto-reply/reply/* files. The refreshed merge tree 34272cfea575f9e2be5e88c6e264a493ff8af461 has byte-identical blobs for all 20 PR-touched files, so the focused merge-result proof remains applicable. The contributor branch was not rebased.

  2. Intentional aggregate value increase: accepted scope. Plugin calls now contribute to aggregate usage totals, while existing OTel metric labels, Prometheus series/labels, and the public Plugin SDK listener contract remain unchanged. The focused exporter, service-capability, SDK declaration, and public-listener regressions passed.

  3. Normal maintainer landing: proceeding through the repo-native scripts/pr merge-run 107937 path.

Exact-head CI remains green: https://github.com/openclaw/openclaw/actions/runs/31082140776

@vincentkoc
vincentkoc merged commit 2ea5679 into openclaw:main Aug 6, 2026
132 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 7, 2026
Emit usage once at the shared plugin completion boundary and expose host-derived plugin identity only on OTel usage spans. Preserve aggregate metric labels and cover the redacted Gateway path end to end.

Refs openclaw#98968

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: ZengWen-DT <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: diagnostics-otel Extension: diagnostics-otel extensions: diagnostics-prometheus extensions: qa-lab gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: emit model.usage diagnostics for plugin runtime.llm.complete calls

2 participants