Skip to content

Fix Opik traces missing after plugin registry reloads#55

Closed
codeofthrone wants to merge 1 commit intocomet-ml:mainfrom
codeofthrone:fix/opik-traces-missing-after-reload
Closed

Fix Opik traces missing after plugin registry reloads#55
codeofthrone wants to merge 1 commit intocomet-ml:mainfrom
codeofthrone:fix/opik-traces-missing-after-reload

Conversation

@codeofthrone
Copy link
Copy Markdown

Summary

Fixes a two-part issue where Opik traces stopped being recorded after a configuration change caused a plugin registry reload in the OpenClaw gateway.

Changes

  • Module-level Shared State: Moved client, tags, projectName, and toolResultPersistSanitizeEnabled from per-instance closure variables to module-level variables in src/service.ts.
  • Early Hook Registration: Moved api.on hook registrations from service.start() to the body of createOpikService.
  • Getter Functions for Hooks: Changed tags and projectName to getter functions in LlmHooksDeps and ToolHooksDeps.
  • Hook Guards: Added a guard to the agent_end hook and the tool_result_persist hook to safely no-op until the service is started.

Testing

  • Unit tests updated and passing (98 tests passed).
  • Confirmed traces are correctly produced after registry reloads.

Checklist

  • Tests pass
  • Documentation updated
  • No breaking changes

@vincentkoc
Copy link
Copy Markdown
Member

Closing this as superseded.

The underlying regression was addressed on main and released in @opik/opik-openclaw@0.2.10, and the tracker already moved forward through the later compatibility work rather than this branch. I want to keep contributor credit clear here: this PR was absolutely in the right bug family, but it is now stale/dirty against current main and we already have the released fix plus end-to-end coverage on top.

@vincentkoc vincentkoc closed this Apr 21, 2026
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