Skip to content

ahstn/oceans-llm / .agents/skills/verify-oceans-admin

verify-oceans-admin

Verified

Verify the Oceans LLM admin control plane and backend gateway against the real local stack, seeded demo data, and bounded live providers when required. Use for user-path checks of sign-in, models, API keys, observability, usage costs, spend controls, batches, agent sessions, request logs, Anthropic Messages thinking and effort compatibility, MCP registry and tool access, OpenRouter routing, guardrails, and Skills storage.

FileKindSize
SKILL.mdskill md29.0 KB
examples/mcp-candidates.jsonconfig3.0 KB
features/README.mdmarkdown10.0 KB
features/account-onboarding.mdmarkdown4.3 KB
features/agent-harnesses.mdmarkdown4.3 KB
features/agent-plugins.mdmarkdown1005 B
features/agent-sessions.mdmarkdown3.9 KB
features/anthropic-messages.mdmarkdown20.7 KB
features/api-keys.mdmarkdown6.5 KB
features/attribution.mdmarkdown13.9 KB
features/audit-log.mdmarkdown4.9 KB
features/backend-gateway.mdmarkdown5.2 KB
features/batch-requests.mdmarkdown4.2 KB
features/design-system.mdmarkdown4.6 KB
features/guardrails.mdmarkdown7.0 KB
features/harness-integration.mdmarkdown7.8 KB
features/identity.mdmarkdown4.2 KB
features/image-generation.mdmarkdown7.3 KB
features/leaderboard.mdmarkdown3.3 KB
features/live-llm-requests.mdmarkdown12.6 KB
features/mcp-client-oauth.mdmarkdown9.9 KB
features/mcp-ownership.mdmarkdown7.4 KB
features/mcp.mdmarkdown19.6 KB
features/models.mdmarkdown8.2 KB
features/password-sign-in.mdmarkdown8.3 KB
features/profile.mdmarkdown2.5 KB
features/rate-limits.mdmarkdown6.0 KB
features/request-logs.mdmarkdown8.6 KB
features/review-agent.mdmarkdown3.7 KB
features/routing.jsonconfig33.6 KB
features/service-tiers.mdmarkdown6.3 KB
features/skills.mdmarkdown9.8 KB
features/spend-controls.mdmarkdown7.3 KB
features/usage-costs.mdmarkdown3.7 KB
features/workspace-connections.mdmarkdown6.1 KB
scripts/check-messages.mjsexecutablescript2.4 KB
scripts/check-messages.test.mjsscript3.0 KB
scripts/control-oceans-adminexecutablescript25.3 KB
scripts/control-oceans-admin.test.mjsscript7.6 KB
scripts/drive-backend-gateway.mjsexecutablescript12.5 KB
scripts/drive-harness-integration.mjsscript6.6 KB
scripts/drive-mcp.mjsscript13.0 KB
scripts/drive-models.mjsscript12.9 KB
scripts/drive-observability.mjsscript16.8 KB
scripts/drive-profile.mjsscript8.2 KB
scripts/drive-service-tiers.mjsexecutablescript20.1 KB
scripts/drive-skills.mjsscript27.2 KB
scripts/mcp-browser.mjsscript26.5 KB
scripts/mcp-canary.mjsscript18.8 KB
scripts/mcp-candidates.mjsscript3.5 KB
scripts/mcp-verification.test.mjsscript10.2 KB
scripts/messages-regressions.mjsscript15.8 KB
scripts/plan-verification.mjsscript5.2 KB
scripts/plan-verification.test.mjsscript6.1 KB
scripts/proof-cli.mjsscript11.1 KB
scripts/proof.mjsscript9.2 KB
scripts/proof.test.mjsscript10.4 KB

scripts/control-oceans-admin.test.mjs

View on GitHub
import assert from 'node:assert/strict'
import { spawn, spawnSync } from 'node:child_process'
import fs from 'node:fs/promises'
import os from 'node:os'
import path from 'node:path'
import test from 'node:test'
import { fileURLToPath } from 'node:url'

const scripts = path.dirname(fileURLToPath(import.meta.url))
const control = path.join(scripts, 'control-oceans-admin')
const repoRoot = path.resolve(scripts, '../../../..')
const hasTools = ['lsof', 'git', 'bash'].every(
  (tool) => spawnSync('sh', ['-c', `command -v ${tool}`]).status === 0,
)

// Git subprocesses that target a fixture must not inherit a caller's repository location.
const isolatedGitEnv = Object.fromEntries(
  Object.entries(process.env).filter(([name]) => !name.startsWith('GIT_')),
)

function git(args) {
  const result = spawnSync('git', args, { env: isolatedGitEnv, encoding: 'utf8' })
  assert.equal(result.status, 0, `git ${args.join(' ')}: ${result.stderr}`)
  return result.stdout.trim()
}

// Starts one loopback listener from `cwd` and resolves with its process and port.
async function startListener(cwd) {
  const child = spawn(
    process.execPath,
    [
      '-e',
      `const server = require('node:net').createServer();
       server.listen(0, '127.0.0.1', () => console.log(server.address().port));`,
    ],
    { cwd, stdio: ['ignore', 'pipe', 'inherit'] },
  )
  const port = await new Promise((resolve, reject) => {
    const onExit = (code, signal) =>
      reject(new Error(`listener exited before reporting its port (code ${code}, signal ${signal})`))
    child.once('error', reject)
    child.once('exit', onExit)
    child.stdout.once('data', (chunk) => {
      child.off('error', reject)
      child.off('exit', onExit)
      resolve(String(chunk).trim())
    })
  })
  return { child, port }
}

async function recordRun(stateBase, runId, gateway, ui) {
  const runDir = path.join(stateBase, runId)
  await fs.mkdir(runDir, { recursive: true })
  await fs.writeFile(path.join(runDir, 'gateway-port'), `${gateway.port}\n`)
  await fs.writeFile(path.join(runDir, 'ui-port'), `${ui.port}\n`)
  await fs.writeFile(path.join(runDir, 'gateway.pid'), `${gateway.child.pid}\n`)
  await fs.writeFile(path.join(runDir, 'ui.pid'), `${ui.child.pid}\n`)
}

function runControl(stateBase, runId, command) {
  return spawnSync('bash', [control, command], {
    env: { ...process.env, OCEANS_VERIFY_STATE_BASE: stateBase, OCEANS_VERIFY_RUN_ID: runId },
    encoding: 'utf8',
    // Trusting a foreign listener used to hang on its readiness probe; fail instead of waiting.
    timeout: 20_000,
  })
}

function isAlive(pid) {
  try {
    process.kill(pid, 0)
    return true
  } catch {
    return false
  }
}

async function exitSignal(child, timeoutMs = 5_000) {
  if (child.exitCode !== null || child.signalCode !== null) return child.signalCode
  return new Promise((resolve) => {
    const timer = setTimeout(() => resolve('still running'), timeoutMs)
    child.once('exit', (_code, signal) => {
      clearTimeout(timer)
      resolve(signal)
    })
  })
}

async function tempGitCheckout(t) {
  const checkout = await fs.mkdtemp(path.join(os.tmpdir(), 'oceans-other-checkout-'))
  t.after(() => fs.rm(checkout, { recursive: true, force: true }))
  git(['init', '--quiet', checkout])
  return checkout
}

async function tempStateBase(t) {
  const stateBase = await fs.mkdtemp(path.join(os.tmpdir(), 'oceans-verify-state-'))
  t.after(() => fs.rm(stateBase, { recursive: true, force: true }))
  return stateBase
}

async function listenerFor(t, cwd) {
  const listener = await startListener(cwd)
  t.after(() => listener.child.kill('SIGKILL'))
  return listener
}

test('doctor and cleanup leave listeners from another checkout alone', { skip: !hasTools }, async (t) => {
  const stateBase = await tempStateBase(t)
  const otherCheckout = await tempGitCheckout(t)
  const gateway = await listenerFor(t, otherCheckout)
  const ui = await listenerFor(t, otherCheckout)
  await recordRun(stateBase, 'foreign-run', gateway, ui)

  const doctor = runControl(stateBase, 'foreign-run', 'doctor')
  assert.notEqual(doctor.status, 0)
  assert.match(doctor.stderr, /does not belong to/)

  const cleanup = runControl(stateBase, 'foreign-run', 'cleanup')
  assert.equal(cleanup.status, 0, cleanup.stderr)
  assert.match(cleanup.stderr, /Not stopping PID \d+ from .*oceans-other-checkout-/)
  await new Promise((resolve) => setTimeout(resolve, 200))
  assert.ok(isAlive(gateway.child.pid), 'cleanup must not signal another checkout')
  assert.ok(isAlive(ui.child.pid), 'cleanup must not signal another checkout')
})

test('an inherited GIT_DIR cannot make a foreign listener look owned', { skip: !hasTools }, async (t) => {
  const stateBase = await tempStateBase(t)
  const otherCheckout = await tempGitCheckout(t)
  const gateway = await listenerFor(t, otherCheckout)
  const ui = await listenerFor(t, otherCheckout)
  await recordRun(stateBase, 'git-env-run', gateway, ui)

  const cleanup = spawnSync('bash', [control, 'cleanup'], {
    env: {
      ...process.env,
      OCEANS_VERIFY_STATE_BASE: stateBase,
      OCEANS_VERIFY_RUN_ID: 'git-env-run',
      // In a linked worktree `.git` is a pointer file, so resolve the real Git directory.
      GIT_DIR: git(['-C', repoRoot, 'rev-parse', '--absolute-git-dir']),
      GIT_WORK_TREE: repoRoot,
    },
    encoding: 'utf8',
    timeout: 20_000,
  })
  assert.equal(cleanup.status, 0, cleanup.stderr)
  await new Promise((resolve) => setTimeout(resolve, 200))
  assert.ok(isAlive(gateway.child.pid), 'GIT_DIR must not redirect the ownership check')
})

test('a foreign checkout cannot claim this checkout through core.worktree', { skip: !hasTools }, async (t) => {
  const stateBase = await tempStateBase(t)
  const otherCheckout = await tempGitCheckout(t)
  git(['-C', otherCheckout, 'config', 'core.worktree', repoRoot])
  const gateway = await listenerFor(t, otherCheckout)
  const ui = await listenerFor(t, otherCheckout)
  await recordRun(stateBase, 'worktree-config-run', gateway, ui)

  const doctor = runControl(stateBase, 'worktree-config-run', 'doctor')
  assert.notEqual(doctor.status, 0)
  assert.match(doctor.stderr, /does not belong to/)

  const cleanup = runControl(stateBase, 'worktree-config-run', 'cleanup')
  assert.equal(cleanup.status, 0, cleanup.stderr)
  await new Promise((resolve) => setTimeout(resolve, 200))
  assert.ok(isAlive(gateway.child.pid), 'core.worktree must not redirect the ownership check')
  assert.ok(isAlive(ui.child.pid), 'core.worktree must not redirect the ownership check')
})

test('cleanup stops the owned listener and spares the foreign one', { skip: !hasTools }, async (t) => {
  const stateBase = await tempStateBase(t)
  const otherCheckout = await tempGitCheckout(t)
  const gateway = await listenerFor(t, repoRoot)
  const ui = await listenerFor(t, otherCheckout)
  await recordRun(stateBase, 'mixed-run', gateway, ui)

  const cleanup = runControl(stateBase, 'mixed-run', 'cleanup')
  assert.equal(cleanup.status, 0, cleanup.stderr)
  assert.equal(await exitSignal(gateway.child), 'SIGTERM')
  assert.ok(isAlive(ui.child.pid), 'cleanup must not signal another checkout')
})

test('cleanup stops gateway and UI listeners started from this checkout', { skip: !hasTools }, async (t) => {
  const stateBase = await tempStateBase(t)
  const gateway = await listenerFor(t, repoRoot)
  const ui = await listenerFor(t, path.join(repoRoot, 'crates/admin-ui/web'))
  await recordRun(stateBase, 'owned-run', gateway, ui)

  const cleanup = runControl(stateBase, 'owned-run', 'cleanup')
  assert.equal(cleanup.status, 0, cleanup.stderr)
  assert.equal(await exitSignal(gateway.child), 'SIGTERM')
  assert.equal(await exitSignal(ui.child), 'SIGTERM')
})
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall