Skip to content

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

Merged
clockgrove-factory[bot] merged 1 commit into
mainfrom
factory/183
Nov 13, 2026
Merged

clockgrove-factory[bot] merged 1 commit into
mainfrom
factory/183

Conversation

@clockgrove-factory

Copy link
Copy Markdown
Contributor

Adds scripts/gateway-ping-g23.mjs, a manual check that sends one prompt through Factory's AI Gateway relay and prints the answer and the cost the gateway reports. It has the same shape as scripts/gateway-ping-c5.mjs. No test calls it and CI never runs it.

Acceptance

Entry Change Proof
Uses the ai devDependency pinned at 7.0.165; package.json and package-lock.json unchanged scripts/gateway-ping-g23.mjs imports from ai git diff --stat origin/main shows only scripts/gateway-ping-g23.mjs (1 file, +42)
Script creates the gateway with createGateway({ apiKey, baseURL: <FACTORY_GATEWAY_URL>/v4/ai }), calls generateText with nvidia/nemotron-3.5-lightning-free and Say ok., prints text: and cost:; on a missing variable or a failed call it writes one stderr line and exits non-zero; the key is never printed scripts/gateway-ping-g23.mjs the one manual run below; node --check scripts/gateway-ping-g23.mjs passes. The failure paths were reviewed in code only, because a second run would break the one-call rule.
Run once from the worker's shell; stdout quoted verbatim n/a see below
npm run check and npm test pass; the only change is the new script n/a Validation

The one run of node scripts/gateway-ping-g23.mjs (exit code 0)

stdout, verbatim:

text: ok
cost: 0

stderr had only Node's EnvHttpProxyAgent is experimental warning, which the sandbox's proxy setup triggers.

Validation

  • npm run check: passed.
  • npm test: passed, 855 tests, 0 failed.
  • npm run test:db: not run here. Factory's validation runs it. This change adds no source file or test file.
  • Budget command: none on the task card.

Fake-only proofs

none

Design checklist

n/a: the repository has no design checklist.

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 the script's syntax was checked separately with node --check. The script is not added to check, because package.json must not change.

Undone

none

🤖 Generated with Claude Code

Closes #183

…actory's relay

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clockgrove-factory

Copy link
Copy Markdown
Contributor Author

Factory: validation green on cada341; ready for the reviewer.

@clockgrove-factory
clockgrove-factory Bot marked this pull request as ready for review November 13, 2026 07:20
@clockgrove-factory clockgrove-factory Bot added the factory:review Applied by the Factory App to trigger the review job label Nov 13, 2026

@clockgrove-factory clockgrove-factory Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Factory reviewer: one comment-only pass, 1 comment(s).

Acceptance as the reviewer judged it:

  • 1: met (The script imports createGateway and generateText from ai; package.json pins ai at 7.0.165, the installed version is 7.0.165, and the commit changes only scripts/gateway-ping-g23.mjs, so package.json and package-lock.json are untouched.)
  • 2: met (Lines 25-28 build the gateway with the exact apiKey and baseURL expressions; line 29 calls generateText with nvidia/nemotron-3.5-lightning-free and Say ok.; line 31 prints text: and cost: from providerMetadata.gateway.cost; lines 22-23 and 32-38 write one stderr line naming …
  • 3: met (The PR body reports one run with exit code 0 and quotes stdout verbatim (text: ok / cost: 0), which matches the two-line format line 31 writes; the run itself cannot be checked from the diff and was not repeated here, to keep the one-call rule.)
  • 4: met (Rerun on the PR head: npm run check passed and npm test passed with 855 tests, 0 failed; git diff --stat shows one file changed, the new script (+42).)

Comment thread scripts/gateway-ping-g23.mjs Resolved
@clockgrove-factory clockgrove-factory Bot removed the factory:review Applied by the Factory App to trigger the review job label Nov 13, 2026
@clockgrove-factory

Copy link
Copy Markdown
Contributor Author

Factory: cada341 is reviewed and validated; it merges once its required checks are green.

@clockgrove-factory
clockgrove-factory Bot added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 4252271 Nov 13, 2026
14 checks passed
@clockgrove-factory
clockgrove-factory Bot deleted the factory/183 branch November 13, 2026 07:23
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.

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

0 participants