Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/ci-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: ci-image

on:
# The image-billing surfaces only: this lane exists to pin the #1857
# verification (parser truth, bytes-prior poison ratio, learned-cost
# rescue) — it costs nothing to run but there is no reason to spend a
# runner on doc-only diffs. Manual dispatch covers everything else.
pull_request:
branches: [master]
paths:
- "src/image-*.ts"
- "src/preflight.ts"
- "src/server.ts"
- "src/cache-ledger.ts"
- "tests/e2e/e2e-image-billing.test.ts"
- ".github/workflows/ci-image.yml"
# acp-kernel is pinned exactly and bundled INLINE into the pipeline —
# a pin bump IS a pipeline change (#1289-class guard).
- "package-lock.json"
workflow_dispatch:

concurrency:
group: ci-image-${{ github.ref }}
cancel-in-progress: true

jobs:
image-billing:
name: real-image billing e2e (hermetic corpus, zero tokens)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install deps
run: npm ci

# The suite drives src/*.ts through tsx like the other hermetic lanes —
# no build step needed, but a typecheck pass keeps the lane from going
# green on a tree that cannot compile.
- name: Typecheck
run: npm run typecheck

- name: Run real-image billing E2E
run: npm run test:e2e:image

- name: Collect E2E artifacts
if: failure()
run: |
mkdir -p tmp/e2e-artifacts
for d in /tmp/e2e-image-billing-*; do [ -d "$d" ] && cp -r "$d" tmp/e2e-artifacts/ || true; done

- uses: actions/upload-artifact@v4
if: failure()
name: image-corpus-artifacts
with:
path: tmp/e2e-artifacts
if-no-files-found: ignore
17 changes: 17 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,23 @@ Rules:
a hosted runner cannot reach `127.0.0.1` upstreams, and events without
secret access (fork PRs) skip the run gracefully instead of failing.

### E2E: Real-Image Billing Lane (`npm run test:e2e:image`)

`tests/e2e/e2e-image-billing.test.ts` is the hermetic twin of the manual
verification that cleared PR #1857 (#1843/#1848): a corpus of structurally
real images (valid PNG/JPEG/WebP/GIF containers, real dimensions, a 4.7MB
4032x3024 photo, EXIF-orientation, truncated and pure-garbage blobs) is
synthesized deterministically in pure Node — no PIL/ImageMagick, no network,
zero tokens — and driven through the real billing pipeline against a mock
upstream that bills the Qwen2-VL formula. It pins the three failure classes
#1857 fixed: header-parser truth for every container, the >=700x bytes-prior
poison ratio, and the learned-cost rescue (arbitrated 12.6MB forward ->
usage report teaches the per-image cost -> stale-high usage baseline no
longer bricks the session -> baseline regresses to real billing) plus the
default auto->pixels route riding a malformed blob. CI:
`.github/workflows/ci-image.yml` auto-runs on PRs touching the image/
window-gate surfaces; it always runs ungated (needs nothing external), ~1s.

### E2E: Hermetic Local Registry (`ACP_TEST_REGISTRY`)

`tests/e2e/e2e-registry.test.ts` brings its own verdaccio instance (random
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"test": "node --import tsx --test tests/*.test.ts",
"start": "node dist/index.js",
"test:e2e": "node --import tsx --test tests/e2e/e2e-codex.test.ts",
"test:e2e:fake": "node --import tsx --test tests/e2e/e2e-codex-fake.test.ts"
"test:e2e:fake": "node --import tsx --test tests/e2e/e2e-codex-fake.test.ts",
"test:e2e:image": "node --import tsx --test tests/e2e/e2e-image-billing.test.ts"
},
"keywords": [
"context",
Expand Down
Loading
Loading