Skip to content

Add scripts/gateway-ping-g23.mjs: one AI Gateway call through Factory's relay #183

Description

@kirkmarple-clockgrove

Goal

A maintainer can check, from a worker's own shell, that the AI Gateway is reachable through Factory's relay: node scripts/gateway-ping-g23.mjs sends one prompt and prints the answer and its gateway-reported cost.

Acceptance

  • Use the ai devDependency already pinned at 7.0.165; package.json and package-lock.json do not change.
  • scripts/gateway-ping-g23.mjs (plain Node ES module) creates the gateway with createGateway({ apiKey: process.env.AI_GATEWAY_API_KEY, baseURL: \${process.env.FACTORY_GATEWAY_URL.replace(//$/, "")}/v4/ai` })fromai, calls generateTextwith modelnvidia/nemotron-3.5-lightning-freeand the promptSay ok., then prints two lines: text: <the answer's text>andcost: <providerMetadata.gateway.cost>`. It exits non-zero with one line on stderr when either variable is missing or the call fails (that line names the missing variable, or carries the error's message and HTTP status), and never prints the key.
  • You run node scripts/gateway-ping-g23.mjs exactly once from your own shell, and the PR body quotes its stdout verbatim (or, if it failed, its stderr and exit code).
  • npm run check and npm test pass; the only change is the new script.

Sources

  • package.json, AGENTS.md, scripts/gateway-ping-c5.mjs (an earlier script of the same shape)
  • The ai package's createGateway and generateText (version 7.0.165)

Context

A release gate run for Factory's metering gateway relay (Claude harness, Actions route). Recorded decisions: the model is the free nvidia/nemotron-3.5-lightning-free; AI_GATEWAY_API_KEY and FACTORY_GATEWAY_URL are given to your shell by Factory (the key is a relay token, not a real key); do not add ai-gateway.vercel.sh anywhere. The script is a manual check: no test calls it and CI never runs it. Make one call only. npm run test:db is Factory's validation to run; a database the setup started may be out of reach of your own commands.

Activity

  1. clockgrove-factory commented on Nov 13, 2026

    @clockgrove-factory
    Contributor

    Factory work run 43384608799 · PR #184: started 07:17Z, 3 min at the last line.

    • 07:17Z setup
    • 07:17Z install
    • 07:18Z re-entry: fresh (resume policy is fresh)
    • 07:18Z harness claude (claude-opus-5-5) attempt 1
    • 07:18Z validation pass 1 (required checks)
    • 07:18Z waiting for required checks (quality) on cada341
    • 07:20Z exit: delivered; usd 0.299688
  2. clockgrove-factory commented on Nov 13, 2026

    @clockgrove-factory
    Contributor

    Goal

    Add a manual check script, scripts/gateway-ping-g23.mjs, that sends one prompt (Say ok.) to nvidia/nemotron-3.5-lightning-free through Factory's AI Gateway relay with the pinned ai@​7.0.165, and prints the answer's text and the gateway-reported cost. Run it once and quote the output in the PR.

    Checklist

    1. Write scripts/gateway-ping-g23.mjs (owns: scripts/gateway-ping-g23.mjs). Covers acceptance entries 1 and 2 (no package.json/lockfile change; createGateway + generateText, two stdout lines, one stderr line with non-zero exit on a missing variable or failure, key never printed).
    2. Run node scripts/gateway-ping-g23.mjs exactly once and record its stdout (or stderr and exit code) for the PR body. Covers acceptance entry 3.
    3. Run npm run check and npm test; confirm the diff is just the new script. Covers acceptance entry 4.

    Assumptions

    1. The script follows the shape of scripts/gateway-ping-c5.mjs: the stderr line is prefixed gateway-ping-g23: , the key is masked as *** if it shows up in an error message, and the HTTP status is added as (HTTP <status>) when the error has one.
    2. When the gateway reports no cost, the script prints cost: undefined rather than failing.
    3. npm run check only covers src/ and test/, so I checked the script's syntax separately with node --check. The script is not added to check, because package.json must not change.

    Design note

    The repository has no design checklist. This is a standalone manual script: no test or CI job calls it.

  3. added
    factory:in-reviewFactory PR open, reviewer pass pending or done
    and removed
    factory:runningFactory worker running (fallback for the Project card)
    on Nov 13, 2026
  4. clockgrove-factory commented on Nov 13, 2026

    @clockgrove-factory
    Contributor

    Factory review run 43385002779 · PR #184: started 07:20Z, 1 min at the last line.

    • 07:21Z setup
    • 07:21Z install
    • 07:21Z re-entry: fresh (resume policy is fresh)
    • 07:21Z reviewer claude-fable-5-2
    • 07:22Z exit: delivered; usd 0.239429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Priority 1factory:objectiveAn Objective for Factory to build unattended

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions