forked from lidge-jun/opencodex
-
Notifications
You must be signed in to change notification settings - Fork 0
Add testing skill for the OpenCodex management API #616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
devin-ai-integration
wants to merge
3
commits into
dev
Choose a base branch
from
devin/update-skills-1790064574
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
0688106
Add testing skill for the OpenCodex management API
devin-ai-integration[bot] ef9ad96
docs(skills): isolate client homes in management-API test setup
devin-ai-integration[bot] ab64dac
docs(skills): document residual macOS write paths in test recipe
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| --- | ||
| name: testing-opencodex-management-api | ||
| description: Run the opencodex proxy locally against a scratch home and exercise the management /api/* endpoints with admin-token auth (Windows + bun). | ||
| --- | ||
|
|
||
| # Testing the opencodex management API locally | ||
|
|
||
| ## Start a scratch instance | ||
| - `OPENCODEX_HOME` relocates OpenCodex-owned state ONLY (config.json, admin-api-token, | ||
| lab automation state, SQLite projections). Client homes are NOT relocated: startup | ||
| syncs can still write to the real `~/.codex`, `~/.grok`, `~/.claude`, and Claude | ||
| Desktop dirs. Point these at scratch too: `CODEX_HOME`, `GROK_HOME`, | ||
| `CLAUDE_CONFIG_DIR`, `OPENCODEX_CLAUDE_DESKTOP_CONFIG_DIR`. | ||
| - `codexAutoStart:false` does NOT gate startup client syncs: `shouldSyncCodexOnStart` | ||
| reads `clientIntegrations.codex` (absent = ON), `shouldSyncGrokOnStart` reads | ||
| `clientIntegrations.grok`, and the Claude roster write (`ocx-*.md` into | ||
| `~/.claude/agents/`) is gated by `claudeCode.enabled`/`claudeCode.injectAgents`. | ||
| Observed: a run with only OPENCODEX_HOME + codexAutoStart:false still injected five | ||
| `ocx-*.md` files into the real `~/.claude/agents/`. | ||
| - Safe scratch `config.json`: | ||
| `{"port":<testport>,"hostname":"127.0.0.1","codexAutoStart":false, | ||
| "clientIntegrations":{"codex":false,"grok":false,"claude-desktop":false}, | ||
| "claudeCode":{"injectAgents":false}}` | ||
| — loopback bind avoids the server-auth assert. Use the env vars AND the config | ||
| disables together; either alone leaves a write path open (e.g. a disabled | ||
| integration still prunes its owned files under the real home). | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
| - Residual writes the recipe does NOT cover (macOS only, opencodex-owned artifacts | ||
| only): startup always runs `refreshOwnedRaycastCatalog` (rewrites an existing | ||
| opencodex-owned Raycast provider entry under the OS home — no env override) and | ||
| `reconcileShellHook` (removes the opencodex-marked block from `~/.zshrc` when the | ||
| system env is inactive — `CLAUDE_CONFIG_DIR` does not redirect it). Harmless on a | ||
| box with neither installed; for hermetic isolation on macOS run under a disposable | ||
| OS user/home instead. | ||
| - Management auth: set `OPENCODEX_ADMIN_AUTH_TOKEN` (any non-empty string works for the env | ||
| source). If unset, the server mints `admin-api-token` in OPENCODEX_HOME on first start. | ||
| - Start foreground: `bun run src/cli/index.ts start --port <testport>` | ||
| (`bun run dev` is the same). bun is not on PATH — prefix `PATH="$HOME/.bun/bin:$PATH"` | ||
| in Git Bash. `ocx ensure`/tray paths spawn DETACHED children instead — avoid them for testing. | ||
|
|
||
| ## Calling /api/* | ||
| - Header: `x-opencodex-api-key: <token>` (or `Authorization: Bearer <token>`). No token → | ||
| `401 {"error":"opencodex admin token required"}`. Origin header NOT required for curl. | ||
| - Useful routes: `GET/PUT /api/lab/automation` (status has `schedulerRunning` — live | ||
| interval presence, not just policy), `POST /api/lab/automation/run` (SYNCHRONOUS — the | ||
| 200 response IS the terminal run record), `GET /api/lab/automation/runs`. | ||
| - PUT policy body: `{"policy":{"enabled":true,"layers":{"protocolConformance":true}}}`; | ||
| merges with disk policy atomically. | ||
| - Manual run body: `{"evidenceLayer":"protocol_conformance","scenarioId":"responses-core.protocol.request-shape"}` | ||
| — protocol_conformance runs need NO provider (in-process fixture harness; upstream is | ||
| deliberately dead). live_route_compatibility needs providerName+modelId in config. | ||
| - Scheduler tick is `LAB_AUTOMATION_HARD_MAX.schedulerTickMs` = 60s — scheduled work only | ||
| appears in `/runs` after the first tick; runs persist to `<OPENCODEX_HOME>/lab/automation-state.json`. | ||
|
|
||
| ## Windows desktop quirks | ||
| - The exec tool CANNOT spawn visible desktop windows (`cmd //c start` hangs the shell on | ||
| the inherited pipe). Open interactive windows via the computer tool: `super+r` → | ||
| `cmd /k <batch>` → Enter; snap halves with `super+Left/Right`. | ||
| - Ctrl+C on a cmd batch shows `Terminate batch job (Y/N)?` — the child process still | ||
| received SIGINT and drains normally; answer `N` to keep the window and see the exit. | ||
| - Single Ctrl+C → `🛑 Shutting down opencodex proxy...` → drainAndShutdown | ||
| (`shutdownTimeoutMs` default 5000) → exit 0. A second signal >500ms later force-exits. | ||
|
|
||
| ## Devin Secrets Needed | ||
| - none — the admin token is provisioned by the tester via env var. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.