Skip to content

feat: add Cortex plugin runtime smoke contract#37

Merged
100yenadmin merged 2 commits into
mainfrom
codex/cortex-plugin-runtime-smoke
May 28, 2026
Merged

feat: add Cortex plugin runtime smoke contract#37
100yenadmin merged 2 commits into
mainfrom
codex/cortex-plugin-runtime-smoke

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

  • add contracts.tools to the plugin manifest so current OpenClaw runtimes can discover the same owner-bound Cortex tools exposed in tools
  • add a read-only Cortex runtime smoke covering memory search, entity list/detail, graph query, and Company Brain account/brief/timeline/query calls
  • add a manifest parity test and README command so plugin runtime drift can be checked before rollout

Runtime 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 test
  • live read-only smoke against production Cortex:
    • memory search returned 1 item
    • entity list returned 5 items and entity detail loaded
    • graph query returned 25 nodes
    • Company Brain internal account list/brief/timeline/query succeeded for ElectricSheep Internal

No writes, direct DB access, or customer actions are introduced.

Summary by CodeRabbit

  • New Features

    • Added Runtime Smoke validation to test deployed OpenClaw runtime against Cortex endpoints and Company Brain (if configured).
    • Added runtime:smoke npm script for easy smoke test execution.
  • Documentation

    • Updated README with Runtime Smoke usage instructions and required environment variables.
  • Tests

    • Enhanced manifest parity tests to validate contracts configuration.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@100yenadmin, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ae8a60c7-b058-4045-b2c1-9ef3f195e8de

📥 Commits

Reviewing files that changed from the base of the PR and between a2995a6 and 8f6b32c.

📒 Files selected for processing (2)
  • README.md
  • scripts/cortex-runtime-smoke.mjs
📝 Walkthrough

Walkthrough

This PR adds a smoke test CLI tool that validates Cortex and Company Brain runtime health, updates the plugin manifest to declare supported tools via contracts.tools, registers the runtime:smoke npm script, and documents the smoke test configuration and behavior.

Changes

Cortex Runtime Smoke Test

Layer / File(s) Summary
Manifest contracts declaration and parity test
openclaw.plugin.json, src/__tests__/plugin-manifest-parity.test.ts
Plugin manifest declares contracts.tools listing supported tool identifiers; test assertions verify parity of contracts.tools across root and dist manifests and alignment with the existing tools list.
Cortex runtime smoke test implementation
scripts/cortex-runtime-smoke.mjs
CLI smoke test reads environment configuration, builds HTTP request headers with optional API key and owner ID, and exercises Cortex endpoints (memory search, entities, entity detail, graph query) and Company Brain workflows (accounts, brief, timeline, follow-ups); records stage results and optionally enforces non-empty data; catches errors and exits with non-zero code on failure.
Smoke test npm script and documentation
package.json, README.md
New runtime:smoke npm script runs the smoke test; README documents required environment variables (Cortex URL, optional API key, optional owner ID, Company Brain credentials) and clarifies that the smoke test is read-only with no writes to plugin storage, Cortex, Intercom, Gmail, Stripe, or customer systems.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • electricsheephq/evaos-cortex-plugin#30: Both PRs modify plugin manifest parity coverage around the packaged dist/openclaw.plugin.json—extending parity assertions to the new contracts.tools shape and dist-manifest generation flow.
  • electricsheephq/evaos-cortex-plugin#35: The smoke test script validates the Cortex entity/graph tools added in that PR, using contracts.tools for manifest parity and calling entities, detail, and graph endpoints.

Poem

🐰 A smoke test hops through Cortex halls,
Checking memory, entities, graphs, and calls,
Company Brain accounts dance in the flow,
All read-only—no writes to show!
Manifests matched, the rabbit's delight,
Runtime validated, all shining bright. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add Cortex plugin runtime smoke contract' accurately summarizes the main change: adding a runtime smoke test contract to the plugin manifest.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/cortex-plugin-runtime-smoke

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
README.md (1)

163-170: ⚡ Quick win

Clarify when to omit CORTEX_OWNER_ID in the smoke example.

The example always sets CORTEX_OWNER_ID; add a note to leave it unset when runtime owner mode is server_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

📥 Commits

Reviewing files that changed from the base of the PR and between 6c1fbca and a2995a6.

⛔ Files ignored due to path filters (3)
  • dist/__tests__/plugin-manifest-parity.test.js is excluded by !**/dist/**
  • dist/__tests__/plugin-manifest-parity.test.js.map is excluded by !**/dist/**, !**/*.map
  • dist/openclaw.plugin.json is excluded by !**/dist/**
📒 Files selected for processing (5)
  • README.md
  • openclaw.plugin.json
  • package.json
  • scripts/cortex-runtime-smoke.mjs
  • src/__tests__/plugin-manifest-parity.test.ts

Comment thread scripts/cortex-runtime-smoke.mjs Outdated
@100yenadmin 100yenadmin merged commit 8923ecb into main May 28, 2026
5 checks passed
@100yenadmin 100yenadmin deleted the codex/cortex-plugin-runtime-smoke branch May 28, 2026 20:28
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