Skip to content

feat: add opt-in observability for pre-tool evaluations#20

Merged
lan17 merged 3 commits intomainfrom
lev/obervability
Apr 8, 2026
Merged

feat: add opt-in observability for pre-tool evaluations#20
lan17 merged 3 commits intomainfrom
lev/obervability

Conversation

@lan17
Copy link
Copy Markdown
Contributor

@lan17 lan17 commented Apr 8, 2026

What changed

This PR bumps the plugin to agent-control TypeScript SDK 2.2.0 and adds opt-in observability to the OpenClaw plugin.

When observabilityEnabled is set to true, the plugin now reconstructs ControlExecutionEvent payloads from each before_tool_call evaluation and sends them to Agent Control's observability API. The implementation:

  • resolves OpenTelemetry trace/span IDs when an active span exists
  • generates OTEL-compatible IDs when no active span is available
  • caches rendered control metadata from agents.init() so emitted events include representative evaluator and selector identity
  • keeps observability delivery best-effort and non-blocking so ingest failures never change allow/block behavior

Why it changed

The Python SDK already emits observability events around SDK-owned evaluation flows, but the OpenClaw plugin had no equivalent path. This meant tool policy decisions could be enforced but not observed in Agent Control's observability system.

The current OpenClaw plugin SDK typings only expose a pre-tool hook, so this PR intentionally implements pre-stage event emission only.

User and developer impact

  • Existing plugin behavior stays unchanged by default.
  • Operators can enable observability explicitly with:
    • openclaw config set plugins.entries.agent-control-openclaw-plugin.config.observabilityEnabled true
  • README and plugin schema now document the new config.
  • Tests cover event reconstruction, trace ID fallback, and non-blocking ingest failures.

Validation

Ran locally:

  • npm run lint
  • npm run typecheck
  • npm test
  • npm run coverage

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 85.39326% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/observability.ts 87.17% 0 Missing and 10 partials ⚠️
src/agent-control-plugin.ts 72.72% 0 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@lan17 lan17 changed the title [codex] add opt-in observability for pre-tool evaluations feat: add opt-in observability for pre-tool evaluations Apr 8, 2026
@lan17 lan17 marked this pull request as ready for review April 8, 2026 20:24
@lan17 lan17 merged commit e79ce68 into main Apr 8, 2026
2 checks passed
@lan17 lan17 deleted the lev/obervability branch April 8, 2026 20:24
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.

2 participants