Skip to content

fix(plugin): wire openclaw-agentweave-bridge tests and fix all 8 failures#161

Merged
arniesaha merged 2 commits intomainfrom
fix/openclaw-bridge-tests-v2
Apr 17, 2026
Merged

fix(plugin): wire openclaw-agentweave-bridge tests and fix all 8 failures#161
arniesaha merged 2 commits intomainfrom
fix/openclaw-bridge-tests-v2

Conversation

@arniesaha
Copy link
Copy Markdown
Owner

Problem

The plugins/openclaw-agentweave-bridge plugin had 8 tests that were completely unrunnable and contained several bugs.

Root causes

1. No test runner wired up
package.json had no test script, no vitest dep, no tsconfig.json, no vitest.config.ts.

2. NodeSDK mocked with arrow function
vi.fn(() => ({...})) — arrow functions can't be new'd. Caused TypeError: is not a constructor on every test.

3. Stale fire() helper
Tests dispatched via onDiagnosticEvent hook, but service.ts uses globalThis.__openclawDiagnosticEventsState directly. capturedListener was always null.

4. Missing tool.loop handler
service.ts had no case "tool.loop": — test expected a tool.loop.detected span event.

5. Plugin excluded from CI
.github/workflows/test.yml only ran sdk/js, sdk/python, sdk/go.

Changes

  • package.json — vitest + typescript devDeps, test script
  • tsconfig.json + vitest.config.ts — new
  • src/service.ts — add tool.loop case
  • src/service.test.ts — fix mocks, fire(), config shape, assertions
  • .github/workflows/test.yml — add plugin CI job

All 8 tests pass.

arniesaha and others added 2 commits April 5, 2026 11:21
…ures

- Add vitest, typescript, @types/node devDeps + test script to package.json
- Add tsconfig.json and vitest.config.ts
- Fix NodeSDK mock: arrow function can't be used as constructor — use
  vi.fn().mockImplementation(function() { return {...} }) instead
- Fix fire() helper: service.ts uses globalThis.__openclawDiagnosticEventsState
  directly, not onDiagnosticEvent hook — dispatch through that state
- Fix config shape in makeCtx() to match service.ts nested read path
- Add SimpleSpanProcessor to sdk-trace-base mock (upstream switched from Batch)
- Add tool.loop handler to service.ts (missing case — test expected it)
- Add plugin-openclaw-bridge CI job to test.yml
Production code still writes these attributes; re-adds the coverage
dropped during the test rewrite. Follow-up to PR #161 review.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@arniesaha arniesaha merged commit 34d559b into main Apr 17, 2026
5 checks passed
@arniesaha arniesaha deleted the fix/openclaw-bridge-tests-v2 branch April 17, 2026 09:50
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