feat: add Cortex plugin runtime smoke contract#37
Conversation
|
Warning Review limit reached
More reviews will be available in 11 minutes and 18 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds a smoke test CLI tool that validates Cortex and Company Brain runtime health, updates the plugin manifest to declare supported tools via ChangesCortex Runtime Smoke Test
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
README.md (1)
163-170: ⚡ Quick winClarify when to omit
CORTEX_OWNER_IDin the smoke example.The example always sets
CORTEX_OWNER_ID; add a note to leave it unset when runtime owner mode isserver_resolved, and set it only for intentional configured/owner-bound runs.Suggested doc tweak
CORTEX_URL=https://cortex-electricsheep.fly.dev \ CORTEX_API_KEY="$CORTEX_API_KEY" \ CORTEX_OWNER_ID=eva-origin \ COMPANY_BRAIN_SOURCE_SCOPE=internal \ COMPANY_BRAIN_ACCOUNT_KEY=company:electricsheep-internal \ npm run runtime:smoke + +# Note: omit CORTEX_OWNER_ID when owner mode is server_resolved. +# Set CORTEX_OWNER_ID only for configured/owner-bound smoke runs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` around lines 163 - 170, The README smoke-test example always sets the CORTEX_OWNER_ID env var; update the example and add a brief note explaining that CORTEX_OWNER_ID should be omitted when runtime owner mode is server_resolved and only provided for intentional configured/owner-bound runs. Mention the specific env var name CORTEX_OWNER_ID and the runtime owner mode string server_resolved so readers know when to leave it unset versus when to include it for owner-bound testing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/cortex-runtime-smoke.mjs`:
- Around line 24-28: The request function currently calls fetch with no timeout
causing potential indefinite hangs; update request(stage, path, options = {}) to
support a timeout (e.g., options.timeout or a sensible default) by creating an
AbortController, pass controller.signal into fetch, start a setTimeout that
calls controller.abort() after the timeout, and clear the timeout on successful
response or error so the request always finishes; reference the request
function, fetch call, and options.headers when adding the AbortController and
signal handling.
---
Nitpick comments:
In `@README.md`:
- Around line 163-170: The README smoke-test example always sets the
CORTEX_OWNER_ID env var; update the example and add a brief note explaining that
CORTEX_OWNER_ID should be omitted when runtime owner mode is server_resolved and
only provided for intentional configured/owner-bound runs. Mention the specific
env var name CORTEX_OWNER_ID and the runtime owner mode string server_resolved
so readers know when to leave it unset versus when to include it for owner-bound
testing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 178b2da1-390e-4165-8e43-71a758b5d28c
⛔ Files ignored due to path filters (3)
dist/__tests__/plugin-manifest-parity.test.jsis excluded by!**/dist/**dist/__tests__/plugin-manifest-parity.test.js.mapis excluded by!**/dist/**,!**/*.mapdist/openclaw.plugin.jsonis excluded by!**/dist/**
📒 Files selected for processing (5)
README.mdopenclaw.plugin.jsonpackage.jsonscripts/cortex-runtime-smoke.mjssrc/__tests__/plugin-manifest-parity.test.ts
Summary
contracts.toolsto the plugin manifest so current OpenClaw runtimes can discover the same owner-bound Cortex tools exposed intoolsRuntime Drift Notes
Issue #20 is still a real runtime concern, but the current published plugin source and installed local artifact agree on the expected tools. The gap found during the audit is runtime loading/configuration: the local OpenClaw config does not currently allow/load the Cortex extension, so OpenClaw cannot exercise these tools until the extension is enabled in runtime config.
Stale PR disposition from this audit:
Validation
node --check scripts/cortex-runtime-smoke.mjs && npm testElectricSheep InternalNo writes, direct DB access, or customer actions are introduced.
Summary by CodeRabbit
New Features
runtime:smokenpm script for easy smoke test execution.Documentation
Tests