Skip to content

feat(diagnostics): emit exec process telemetry#71451

Merged
vincentkoc merged 1 commit intomainfrom
fix/otel-exec-diagnostics
Apr 25, 2026
Merged

feat(diagnostics): emit exec process telemetry#71451
vincentkoc merged 1 commit intomainfrom
fix/otel-exec-diagnostics

Conversation

@vincentkoc
Copy link
Copy Markdown
Member

Summary

  • add a bounded exec.process.completed diagnostic event for host/sandbox exec process outcomes
  • export those events from diagnostics-otel as openclaw.exec spans and openclaw.exec.duration_ms metrics
  • keep the event deliberately low-risk: no command text, no cwd, no container name, no raw output

This is the safe replacement for the exec/docker tracing portion of #70424. It keeps core agent code free of direct OpenTelemetry imports and lets the diagnostics-otel plugin remain the OTEL boundary.

Validation

  • git diff --check HEAD~1..HEAD
  • pnpm test extensions/diagnostics-otel/src/service.test.ts src/agents/bash-tools.exec-runtime.pty-fallback.test.ts was queued behind another local heavy-check lock in /Users/vincentkoc/.codex/worktrees/openclaw-openclaw/fix-gateway-restart-drain-c117686 and was cancelled rather than stacking local checks
  • pnpm tsgo:core && pnpm tsgo:extensions hit the same local heavy-check lock and was cancelled; CI is expected to provide the post-rebase proof

@vincentkoc vincentkoc self-assigned this Apr 25, 2026
@vincentkoc vincentkoc marked this pull request as ready for review April 25, 2026 07:08
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: diagnostics-otel Extension: diagnostics-otel agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Apr 25, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 25, 2026

Greptile Summary

This PR adds a bounded exec.process.completed internal diagnostic event and exports it from diagnostics-otel as an openclaw.exec span and an openclaw.exec.duration_ms histogram. The implementation correctly gates sensitive fields — command text, working directory, and container name are absent from both the event type and the OTEL attributes, verified by explicit test assertions. All four process-exit paths in runExecProcess are wired up and are mutually exclusive, so no double-emit can occur.

Confidence Score: 4/5

Safe to merge; only a minor cosmetic issue with the UTF-16 length of commandLength was found.

All findings are P2 or lower. The new event type is well-bounded, tests cover both the internal event shape and the OTEL export boundary, and the four emission sites are mutually exclusive. No data loss, no security exposure, and no runtime errors were identified.

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/bash-tools.exec-runtime.ts
Line: 190

Comment:
**`commandLength` counts UTF-16 code units, not Unicode code points**

`params.command.length` reports the number of UTF-16 code units. Commands containing characters outside the Basic Multilingual Plane (e.g. emoji) will report a `commandLength` that is larger than the visible character count. For this diagnostic metric the difference is unlikely to matter in practice, but it is worth documenting — or switching to `[...params.command].length` / `Array.from(params.command).length` if accurate code-point counts are preferred.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "feat(diagnostics): emit exec process tel..." | Re-trigger Greptile

mode: params.mode,
outcome: params.outcome.status,
durationMs: params.outcome.durationMs,
commandLength: params.command.length,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 commandLength counts UTF-16 code units, not Unicode code points

params.command.length reports the number of UTF-16 code units. Commands containing characters outside the Basic Multilingual Plane (e.g. emoji) will report a commandLength that is larger than the visible character count. For this diagnostic metric the difference is unlikely to matter in practice, but it is worth documenting — or switching to [...params.command].length / Array.from(params.command).length if accurate code-point counts are preferred.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/bash-tools.exec-runtime.ts
Line: 190

Comment:
**`commandLength` counts UTF-16 code units, not Unicode code points**

`params.command.length` reports the number of UTF-16 code units. Commands containing characters outside the Basic Multilingual Plane (e.g. emoji) will report a `commandLength` that is larger than the visible character count. For this diagnostic metric the difference is unlikely to matter in practice, but it is worth documenting — or switching to `[...params.command].length` / `Array.from(params.command).length` if accurate code-point counts are preferred.

How can I resolve this? If you propose a fix, please make it concise.

@vincentkoc vincentkoc merged commit 3e3bba4 into main Apr 25, 2026
94 of 97 checks passed
@vincentkoc vincentkoc deleted the fix/otel-exec-diagnostics branch April 25, 2026 07:13
vincentkoc added a commit that referenced this pull request Apr 25, 2026
- Two Diagnostics/OTEL Changes entries credited issue #70424 (jlapenna's
  open meta-tracing proposal) as the PR ref. The actual implementing
  PRs landed as #71451 (exec-process telemetry) and #71450 (preloaded
  SDK mode), both authored by @vincentkoc — corrected.
- Telegram/webhook fix had no Thanks credit. Issue #71392 reporter
  @joelforsberg46-source identified the delivery-retry behaviour, so
  credit them on the entry.
vincentkoc added a commit that referenced this pull request Apr 25, 2026
… tool-result pruning entries

Three entries were missing co-credits I should have preserved:

- Diagnostics/OTEL exec-process spans (#71451): @vincentkoc implemented,
  but @jlapenna's #70424 proposed the broader tracing work this entry
  builds on. Now credits both.
- Diagnostics/OTEL preloaded SDK (#71450): same pattern — credits
  @vincentkoc and @jlapenna.
- Agents/tool-result pruning (#51267): @cgdusek's PR explicitly built
  on prior work in #39331 by @alvinttang and #34980 by @coffeexcoin.
  Now credits all three.
steipete pushed a commit to MonkeyLeeT/openclaw that referenced this pull request Apr 25, 2026
steipete pushed a commit to MonkeyLeeT/openclaw that referenced this pull request Apr 25, 2026
- Two Diagnostics/OTEL Changes entries credited issue openclaw#70424 (jlapenna's
  open meta-tracing proposal) as the PR ref. The actual implementing
  PRs landed as openclaw#71451 (exec-process telemetry) and openclaw#71450 (preloaded
  SDK mode), both authored by @vincentkoc — corrected.
- Telegram/webhook fix had no Thanks credit. Issue openclaw#71392 reporter
  @joelforsberg46-source identified the delivery-retry behaviour, so
  credit them on the entry.
steipete pushed a commit to MonkeyLeeT/openclaw that referenced this pull request Apr 25, 2026
… tool-result pruning entries

Three entries were missing co-credits I should have preserved:

- Diagnostics/OTEL exec-process spans (openclaw#71451): @vincentkoc implemented,
  but @jlapenna's openclaw#70424 proposed the broader tracing work this entry
  builds on. Now credits both.
- Diagnostics/OTEL preloaded SDK (openclaw#71450): same pattern — credits
  @vincentkoc and @jlapenna.
- Agents/tool-result pruning (openclaw#51267): @cgdusek's PR explicitly built
  on prior work in openclaw#39331 by @alvinttang and openclaw#34980 by @coffeexcoin.
  Now credits all three.
Angfr95 pushed a commit to Angfr95/openclaw that referenced this pull request Apr 25, 2026
Angfr95 pushed a commit to Angfr95/openclaw that referenced this pull request Apr 25, 2026
- Two Diagnostics/OTEL Changes entries credited issue openclaw#70424 (jlapenna's
  open meta-tracing proposal) as the PR ref. The actual implementing
  PRs landed as openclaw#71451 (exec-process telemetry) and openclaw#71450 (preloaded
  SDK mode), both authored by @vincentkoc — corrected.
- Telegram/webhook fix had no Thanks credit. Issue openclaw#71392 reporter
  @joelforsberg46-source identified the delivery-retry behaviour, so
  credit them on the entry.
Angfr95 pushed a commit to Angfr95/openclaw that referenced this pull request Apr 25, 2026
… tool-result pruning entries

Three entries were missing co-credits I should have preserved:

- Diagnostics/OTEL exec-process spans (openclaw#71451): @vincentkoc implemented,
  but @jlapenna's openclaw#70424 proposed the broader tracing work this entry
  builds on. Now credits both.
- Diagnostics/OTEL preloaded SDK (openclaw#71450): same pattern — credits
  @vincentkoc and @jlapenna.
- Agents/tool-result pruning (openclaw#51267): @cgdusek's PR explicitly built
  on prior work in openclaw#39331 by @alvinttang and openclaw#34980 by @coffeexcoin.
  Now credits all three.
ayesha-aziz123 pushed a commit to ayesha-aziz123/openclaw that referenced this pull request Apr 26, 2026
ayesha-aziz123 pushed a commit to ayesha-aziz123/openclaw that referenced this pull request Apr 26, 2026
- Two Diagnostics/OTEL Changes entries credited issue openclaw#70424 (jlapenna's
  open meta-tracing proposal) as the PR ref. The actual implementing
  PRs landed as openclaw#71451 (exec-process telemetry) and openclaw#71450 (preloaded
  SDK mode), both authored by @vincentkoc — corrected.
- Telegram/webhook fix had no Thanks credit. Issue openclaw#71392 reporter
  @joelforsberg46-source identified the delivery-retry behaviour, so
  credit them on the entry.
ayesha-aziz123 pushed a commit to ayesha-aziz123/openclaw that referenced this pull request Apr 26, 2026
… tool-result pruning entries

Three entries were missing co-credits I should have preserved:

- Diagnostics/OTEL exec-process spans (openclaw#71451): @vincentkoc implemented,
  but @jlapenna's openclaw#70424 proposed the broader tracing work this entry
  builds on. Now credits both.
- Diagnostics/OTEL preloaded SDK (openclaw#71450): same pattern — credits
  @vincentkoc and @jlapenna.
- Agents/tool-result pruning (openclaw#51267): @cgdusek's PR explicitly built
  on prior work in openclaw#39331 by @alvinttang and openclaw#34980 by @coffeexcoin.
  Now credits all three.
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
- Two Diagnostics/OTEL Changes entries credited issue openclaw#70424 (jlapenna's
  open meta-tracing proposal) as the PR ref. The actual implementing
  PRs landed as openclaw#71451 (exec-process telemetry) and openclaw#71450 (preloaded
  SDK mode), both authored by @vincentkoc — corrected.
- Telegram/webhook fix had no Thanks credit. Issue openclaw#71392 reporter
  @joelforsberg46-source identified the delivery-retry behaviour, so
  credit them on the entry.
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
… tool-result pruning entries

Three entries were missing co-credits I should have preserved:

- Diagnostics/OTEL exec-process spans (openclaw#71451): @vincentkoc implemented,
  but @jlapenna's openclaw#70424 proposed the broader tracing work this entry
  builds on. Now credits both.
- Diagnostics/OTEL preloaded SDK (openclaw#71450): same pattern — credits
  @vincentkoc and @jlapenna.
- Agents/tool-result pruning (openclaw#51267): @cgdusek's PR explicitly built
  on prior work in openclaw#39331 by @alvinttang and openclaw#34980 by @coffeexcoin.
  Now credits all three.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
- Two Diagnostics/OTEL Changes entries credited issue openclaw#70424 (jlapenna's
  open meta-tracing proposal) as the PR ref. The actual implementing
  PRs landed as openclaw#71451 (exec-process telemetry) and openclaw#71450 (preloaded
  SDK mode), both authored by @vincentkoc — corrected.
- Telegram/webhook fix had no Thanks credit. Issue openclaw#71392 reporter
  @joelforsberg46-source identified the delivery-retry behaviour, so
  credit them on the entry.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
… tool-result pruning entries

Three entries were missing co-credits I should have preserved:

- Diagnostics/OTEL exec-process spans (openclaw#71451): @vincentkoc implemented,
  but @jlapenna's openclaw#70424 proposed the broader tracing work this entry
  builds on. Now credits both.
- Diagnostics/OTEL preloaded SDK (openclaw#71450): same pattern — credits
  @vincentkoc and @jlapenna.
- Agents/tool-result pruning (openclaw#51267): @cgdusek's PR explicitly built
  on prior work in openclaw#39331 by @alvinttang and openclaw#34980 by @coffeexcoin.
  Now credits all three.
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 maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant