feat: add rogue gateway tokenomics routing spike package#210
Conversation
6eeb1ef to
f0b3508
Compare
bearmug
left a comment
There was a problem hiding this comment.
PR #210 looks good and checks are passing.
I reviewed against issue #207 requirements and current diff:
- Added standalone (planner/substrates/events/server/tests) ✅
- Workspace checks/tests pass locally and in CI ✅
- Lockfile updated for npm ci parity ✅
Non-blocking follow-up: consider wrapping JSON parse in request handling in the try/catch so malformed JSON returns 400 instead of throwing out of handler.
Otherwise this is good to merge.
bearmug
left a comment
There was a problem hiding this comment.
PR #210 looks good and checks are passing.
I reviewed against issue #207 requirements and current diff:
- Added standalone
packages/rogue-gateway(planner/substrates/events/server/tests) ✅ - Workspace checks/tests pass locally and in CI ✅
- Lockfile updated for npm ci parity ✅
Non-blocking follow-up: consider wrapping JSON parse in startGatewayServer request handling in the try/catch so malformed JSON returns 400 instead of throwing out of handler.
Otherwise this is good to merge.
f0b3508 to
c5e1f80
Compare
|
Codex-style review pass: fixed a blocker in server request handling. Fixes made:
Validation after fix:
|
c5e1f80 to
751b001
Compare
|
Added the missing explicit Commodity Gateway Substrate Check report in this PR (same branch), including direct answers to the required 1..6 questions. Files added/updated:
Summary in PR:
Validation still passes ( |
Rogue Gateway spike outcomeStatus: validated spike / pilot setup, not a target-system architecture recommendation yet. What is now in PR #210:
Local validation performed:
Manual Portkey experiment setup is prepared, but a live Portkey run was not executed because no Portkey endpoint/key is available in this environment. Expected manual env setup: PORTKEY_BASE_URL=...
PORTKEY_API_KEY=...
PORTKEY_AUTH_HEADER=x-portkey-api-key # optional; defaults are supported
PI_ROGUE_CONFIG_PATH=...
PI_ROGUE_ROUTER_CONFIG_PATH=...Fugu-ultra review was attempted but not obtained: Sakana returned Conclusion: this is good evidence for the pilot/spike. Before treating it as the target system direction, follow-ups should harden config schema validation, failure-mode tests, credential redaction, and observability. |
Final explicit spike status / manual experiment readinessOutcome: PR #210 is a validated Rogue Gateway spike / pilot setup, not a recommendation to promote this as the target gateway architecture yet. What is in the PR now:
Verification completed locally and in CI:
Manual Portkey experiment readiness: prepared, but not live-run here because this environment does not have a real Portkey/OpenAI-compatible endpoint + key. Required env: export PORTKEY_BASE_URL="https://..." # Portkey/OpenAI-compatible base URL
export PORTKEY_API_KEY="..." # secret; not stored in repo
export PORTKEY_AUTH_HEADER="x-portkey-api-key" # optional; default Authorization/Bearer also supported
export PI_ROGUE_CONFIG_PATH="$HOME/.pi/agent/pi-rogue/config.json"
export PI_ROGUE_ROUTER_CONFIG_PATH="$HOME/.pi/agent/pi-rogue/router/config.json"One-shot manual measurement command from repo root: cat > /tmp/rogue-portkey-measure.ts <<'TS'
import { measurePiDedicatedModes } from "./packages/rogue-gateway/src/measurement.js";
const report = await measurePiDedicatedModes({
profile: process.env.PI_ROGUE_PROFILE ?? "local-smart",
role: process.env.PI_ROGUE_ROLE ?? "smart",
request: {
profile: "local-first-economy",
taskKind: "manual_portkey_measurement",
rawInputTokensApprox: Number(process.env.RAW_INPUT_TOKENS ?? 82000),
forwardedInputTokensApprox: Number(process.env.FORWARDED_INPUT_TOKENS ?? 2400),
expectedOutputTokensApprox: Number(process.env.EXPECTED_OUTPUT_TOKENS ?? 900),
contextPolicy: "typed_lens",
candidateAssets: ["local.qwen35", "remote.cheap", "remote.premium", "subscription.smart"],
},
});
console.log(JSON.stringify({
profile: report.profile,
role: report.role,
requestedModel: report.requestedModel,
upstreamModel: report.upstreamModel,
modes: report.modes.map((mode) => ({
mode: mode.mode,
forwardedInputTokensApprox: mode.request.forwardedInputTokensApprox,
selectedRoute: mode.quote.selected.route,
selectedAsset: mode.quote.selected.asset,
ok: mode.chat.ok,
status: mode.chat.status,
providerUsage: mode.chat.usage ?? null,
})),
}, null, 2));
TS
# Run from repo root so the relative package import resolves:
npx tsx /tmp/rogue-portkey-measure.tsExpected manual output: JSON showing Still missing for a live external result: real Fugu-ultra note: attempted but not obtained; Sakana returned |
|
Added a repo-local manual experiment artifact for the Portkey self-host path:
This keeps the spike scope intact: the repo still cannot launch Portkey itself, but the exact env-driven manual run is now drafted and runnable once a real Portkey/OpenAI-compatible endpoint + API key are provided in the runtime environment. |
|
Drafted the tiny self-host Portkey experiment setup requested:
This keeps the experiment repo-local and env-driven. It does not launch Portkey from within this repo; it expects a real Portkey/OpenAI-compatible runtime to be started externally via Docker/infra and then pointed to with |
Prototype spike for standalone Rogue Gateway (issue #207).
What this adds
packages/rogue-gatewayquoteRoute) with deterministic score/guard logicPOST /rogue/economics/quote/healthValidation
npm run check --workspace @fiale-plus/pi-rogue-gatewaynpm run test --workspace @fiale-plus/pi-rogue-gatewaynpm run check --workspaces --if-presentnpm run test --workspaces --if-presentCloses #207