Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
chore(prompts): retire order 427, cron maxDuration wiring sweep shipped
nirholasf90665fa5e16
diff --git a/prompts/finish/427-auto-cron-maxduration-wiring-sweep.md b/prompts/finish/427-auto-cron-maxduration-wiring-sweep.mddeleted file mode 100644index 3eec5a62a..000000000--- a/prompts/finish/427-auto-cron-maxduration-wiring-sweep.md+++ /dev/null@@ -1,94 +0,0 @@-# 427. Ten more crons silently truncate at wrapCron's 120s default despite a declared 300s budget--How to run: paste this file's repo path into a fresh Claude Code chat in this repository and say "run this work order". Runnable now, no gate.--## Operating clause (binding)--- Read CLAUDE.md first. CLAUDE.md overrides everything, including this file.-- Finish 100% in this session. Never end the turn with a question, an option list, or an unexecuted plan. A judgment call goes in one line of the final report; it never becomes a question that halts work.-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real funds or any irreversible on-chain write, `git push` or a production deploy, posting to an external channel, committing content that references a crypto project other than $THREE, and destroying unrecoverable data. This order touches none of them.-- No mocks, no fake data, no TODO markers, no commented-out code, no `it.skip`/`.todo` to make a failure disappear.-- The em-dash and en-dash characters are banned in everything you write.-- Concurrent agents share this worktree: stage explicit paths only (never `git add -A` or `git add .`), re-check `git status` and `git diff --staged` before each commit, commit promptly per topical slice.-- Before committing, run `npm run check:rules -- --paths <files you touched>`. It must exit 0.-- Bug fixes are test-first (CLAUDE.md): confirm each fix's test fails for the stated reason before changing the code, fix, then confirm it passes. Commit the test with the fix.--## Why this matters (measured 2026-10-24)--Two commits landed on `evolve` earlier today fixing the exact same bug in two places:--- `5814b5585` fixed `api/cron/x402-ring-leak-scan.js`: declared `maxDuration = 300` in `vercel.json`, but the file never passed `maxDurationMs` into `wrapCron()`, so `api/_lib/http.js`'s `wrapCron` fell back to `DEFAULT_CRON_MAX_DURATION_MS` (120,000 ms) and killed every run at ~120s with a `503 cron_timeout`, a 100% failure rate over a 6h sample.-- `2e7c0f555` fixed `api/cron/[name].js` (the shared dispatcher behind 30+ `HANDLERS` jobs including `run-buyback` and `solana-agents-crawl`) the same way.--`DEFAULT_CRON_MAX_DURATION_MS` is defined at `api/_lib/http.js:778` as `120_000`; `wrapCron(handler, { maxDurationMs })` at line 780 uses it whenever the caller omits the option. This scout pass cross-referenced every `vercel.json` `functions` glob that declares `maxDuration: 300` against the `api/cron/*.js` files it covers, and found the SAME unwired bug, confirmed by source inspection (`grep -n maxDuration` on each file shows no local export and no `wrapCron(..., { maxDurationMs })` second argument), in **ten more standalone cron handlers that were never touched by either fix**:--| File | Cron schedule (`vercel.json`) | Declared budget | Wired today |-|---|---|---|---|-| `api/cron/economy-reconcile.js` | `*/30 * * * *` | 300s | No |-| `api/cron/x402-prepaid-settle.js` | `23 * * * *` | 300s | No |-| `api/cron/fact-check-benchmark.js` | `41 4 * * 1` | 300s | No |-| `api/cron/avaturn-seed-cron.js` | `* * * * *` | 300s | No |-| `api/cron/strategy-fanout.js` | `*/2 * * * *` | 300s | No |-| `api/cron/gmgn-seed.js` | `0 3 * * *` | 300s | No |-| `api/cron/recompute-reputation.js` | `*/10 * * * *` | 300s | No |-| `api/cron/smart-money-graph.js` | `*/10 * * * *` | 300s | No |-| `api/cron/sketchfab-showcase.js` | `0 15 * * 1,3,5` | 300s | No |-| `api/cron/forge-smoke.js` | `30 9 * * *` | 300s | No |--Live proof this is not theoretical for the most frequent one:-- npm run logs -- --grep "economy-reconcile" --since 24h --http 503 -n 20--returns (measured 2026-10-24 09:2x UTC):-- 2026-10-24 00:22:12Z ERROR [three-ws-api] 503 GET https://three.ws/api/cron/economy-reconcile 120.00s- 2026-10-24 01:00:03Z ERROR [three-ws-api] 503 GET .../api/cron/economy-reconcile 120.00s- 2026-10-24 06:00:01Z ERROR [three-ws-api] 503 GET .../api/cron/economy-reconcile 120.29s--Three truncated runs in 24h at exactly the 120s signature, on a cron that reconciles the economy ledger every 30 minutes. The other nine run less often (hourly to weekly) or finished under 120s in this particular window, which is why they show no 503 yet; they carry the identical latent defect and will truncate the moment their workload crosses 120s, same as `x402-ring-leak-scan` did at 100% failure once its backlog grew. `recompute-reputation.js` and `smart-money-graph.js` run every 10 minutes against growing tables (trust scores, wallet clustering), so they are the next most likely to tip over.--No audit in the repo currently catches this class across all crons; the two existing fixes were each found by hand from a log signature, after the fact. This order both repairs the ten known instances and adds the audit so a future cron added with a mismatched budget fails the gate instead of waiting for a production 503 storm.--## Step 0: re-derive the current state-- git log --oneline -3 -- api/cron/economy-reconcile.js api/cron/x402-ring-leak-scan.js api/cron/\[name\].js- grep -n "maxDuration" api/cron/economy-reconcile.js api/cron/x402-prepaid-settle.js api/cron/fact-check-benchmark.js api/cron/avaturn-seed-cron.js api/cron/strategy-fanout.js api/cron/gmgn-seed.js api/cron/recompute-reputation.js api/cron/smart-money-graph.js api/cron/sketchfab-showcase.js api/cron/forge-smoke.js- npm run logs -- --grep "economy-reconcile" --since 24h --http 503 -n 20--If any of the ten files already shows a `maxDurationMs` wired into its `wrapCron(...)` call (another agent may have fixed it first), drop that file from the task list below and note it in the report; do not re-fix it.--## Tasks--1. For each of the ten files, apply the same two-part fix the precedent commits used:- - Add `export const maxDuration = 300;` near the top of the file, beside the other named exports (follow the placement and the explanatory comment style already used in `api/cron/quality-bench.js:23` and `api/cron/x402-ring-leak-scan.js`, which both read `vercel.json`'s declared value into a local constant rather than hardcoding `300` twice).- - Change the closing `});` of the `export default wrapCron(async (req, res) => { ... });` call to pass the options object: `}, { maxDurationMs: maxDuration * 1000 });`. For `api/cron/recompute-reputation.js`, which already closes with `}, { requireWriteCapacity: true });`, merge the new key into the existing object rather than adding a second one: `}, { requireWriteCapacity: true, maxDurationMs: maxDuration * 1000 });`.-2. Write one regression test per file (or one parametrized test covering all ten, following the shape of the existing `tests/cron-dispatcher-routing.test.js` maxDuration assertion and `tests/x402-ring-leak-scan-run.test.js`'s "cron timeout wiring" describe block) that: imports the handler module, reads its exported `maxDuration`, reads `vercel.json`'s declared `maxDuration` for that route from the matching `functions` glob key, and asserts they are equal and both exceed `DEFAULT_CRON_MAX_DURATION_MS` (import that constant from `api/_lib/http.js` rather than hardcoding `120000`). Confirm each test fails against the pre-fix file (checkout the file at HEAD before editing, run the test, see it fail because `maxDuration` is `undefined`), then fix, then confirm it passes.-3. Add a standing audit so this class cannot recur silently: a new script, `scripts/check-cron-budget-wiring.mjs` (follow the style of `scripts/check-cron-drift.mjs`: parse `vercel.json`'s `functions` object, expand each glob key, for every expanded path matching `api/cron/*.js` with a declared `maxDuration` strictly greater than `DEFAULT_CRON_MAX_DURATION_MS / 1000` (120), statically import the module and confirm it exports a `maxDuration` whose value, times 1000, is reachable as the `maxDurationMs` wrapCron receives. Static import plus reading the module's own exported `maxDuration` is sufficient; you do not need to parse the AST for the literal `wrapCron(...)` call site, because the convention this codebase already uses (confirmed in `quality-bench.js`, `likeness-eval.js`, `marketplace-escrow-sweep.js`, `labor-escrow-sweep.js`, and now these ten) is that the exported `maxDuration` constant IS what gets passed as `maxDurationMs: maxDuration * 1000`, so a file that exports the right constant but forgets to wire it is the one gap this script cannot catch from exports alone. Close that gap properly: have the check actually invoke `wrapCron`'s module-level default export shape is opaque (it returns a closure), so instead read each target file's source text and assert, with a regex anchored on the literal pattern `maxDurationMs: maxDuration * 1000` (or `maxDurationMs: <exportedConstantName> * 1000`) appearing in the `wrapCron(` call's option object. This is the same shape `tests/x402-ring-leak-scan-run.test.js` already verifies for one file; generalize it across all matching files instead of duplicating it ten more times by hand.-4. Add `check:cron-budget-wiring` to `package.json`'s `scripts` block beside the other `check:cron-*` entries, and add it to the `gate` script's chain (insert it next to `check:cron-syntax` in the `&&` sequence) so a future cron with this same mismatch fails CI instead of waiting for a log signature.-5. Run `npm run check:cron-budget-wiring` against the full `api/cron/` tree and confirm it reports clean for all ten fixed files plus the two precedent files, with no new false positives across the other ~140 cron files.--## Definition of done--- [ ] All ten files in the table export `maxDuration = 300` and wire `maxDurationMs: maxDuration * 1000` (merged correctly for `recompute-reputation.js`) into their `wrapCron` call.-- [ ] A regression test exists per file (or one parametrized test enumerating all ten) and passes; each was confirmed to fail before the fix.-- [ ] `scripts/check-cron-budget-wiring.mjs` exists, is wired as `npm run check:cron-budget-wiring`, is added to the `gate` script chain in `package.json`, and exits 0 against the current tree.-- [ ] `npm run test:core` exits 0 (or shows no new failures versus the pre-existing baseline order 401 already tracks; do not treat order 401's unrelated failures as caused by this change).-- [ ] `npm run check:cron-syntax` and `npm run check:rules -- --paths <files you touched>` both exit 0.-- [ ] Commit message names the ten files and the new audit script.--## Never blocked--| Looks like a blocker | It is not | Do this |-|---|---|---|-| Another agent already fixed one or more of the ten files | Routine for a shared worktree; the two precedent fixes landed hours before this order was written | Re-run step 0's grep first; skip any file that already has `maxDurationMs` wired, fix only the rest, say which were already done in the report |-| Unsure whether `recompute-reputation.js`'s `requireWriteCapacity: true` should stay | It should; this order only adds a key to that object, never removes one | Merge `maxDurationMs` into the existing options object, do not replace it |-| The new audit script flags a cron this order did not list | The sweep that produced the table above was manual; a false negative is possible | Fix it too if the cause is the same wiring gap; if it is a different shape (e.g. a file with a legitimately lower budget than `vercel.json` declares, which is not this bug), document why it is a false positive and exclude it by name with a one-line comment in the script, never by weakening the general check |-| `npm run test:core`'s pre-existing failures (order 401) make the suite noisy | Order 401 owns the general cleanup | Only verify your own new tests pass and that you introduced no new failing file; do not attempt to fix order 401's list here |--## Report format--1. Per file: the exact diff hunk (export line + wrapCron closing line).-2. The new test file(s) and the pre-fix failing run output proving each was a real regression test, not written to match the fix.-3. `scripts/check-cron-budget-wiring.mjs`'s full run output against the whole `api/cron/` tree (clean) and confirmation it is wired into `gate`.-4. `npm run test:core` summary line, before and after.-5. Commit SHA(s).diff --git a/prompts/finish/_context/production-100-PROGRESS.md b/prompts/finish/_context/production-100-PROGRESS.mdindex 8ef540f5f..bf587548b 100644--- a/prompts/finish/_context/production-100-PROGRESS.md+++ b/prompts/finish/_context/production-100-PROGRESS.md@@ -1772,3 +1772,17 @@ Did: test-first. Wrote `walk-sdk/test/load-avatar.test.mjs` (new file, 4 cases)Also found, but explicitly left untouched as out of scope (different page, different stack-trace frame names): `src/agent-trade.js`'s `loadAvatar()` calls `gltfLoader.load()` via an uncaught `.then()` and is invoked twice concurrently for the identical `AVATAR_GLB` URL, a separate instance of the same class of bug. Worth its own future order.Left: nothing for this order's own scope. The fix reduces risk structurally (it is impossible for walk-sdk's own call sites to ever register two callbacks against FileLoader's dedup table for the same URL after this change), independent of which exact concurrent-mount scenario in production was triggering it. A future sweep of the same `TypeError: Failed to fetch` signature after the next deploy should confirm the 30d count stops climbing from its ~941-952 baseline. `prompts/finish/426-auto-walk-companion-unhandled-fetch-rejection.md` deleted in this closing commit.++## 2026-10-25: order 427 (auto-cron-maxduration-wiring-sweep) closed++Step 0 re-derived cleanly: `git log` showed only the two precedent fixes (`economy-reconcile.js` lease-gating, `x402-ring-leak-scan.js`/`[name].js` already fixed hours earlier) touching any of the ten target files; `grep -n maxDuration` on all ten returned nothing, confirming every one of the ten still had the unwired bug the order described (vercel.json declares `maxDuration: 300`, wrapCron never told about it, so it would 503 cron_timeout past 120s). None were pre-fixed by another concurrent agent.++Did: for each of `economy-reconcile.js`, `x402-prepaid-settle.js`, `fact-check-benchmark.js`, `avaturn-seed-cron.js`, `strategy-fanout.js`, `gmgn-seed.js`, `recompute-reputation.js`, `smart-money-graph.js`, `sketchfab-showcase.js`, `forge-smoke.js`: added `export const maxDuration = 300;` near the top (beside `GENERATION_BUDGET_MS` in forge-smoke.js, which already exported a budget constant) and changed the closing `});` of its `wrapCron(...)` call to `}, { maxDurationMs: maxDuration * 1000 });`, following the precedent shape from `quality-bench.js`/`x402-ring-leak-scan.js`. `recompute-reputation.js` merged the new key into its existing `{ requireWriteCapacity: true }` object rather than adding a second options argument.++Test-first, per file: wrote `tests/cron-budget-wiring-sweep.test.js` (one `describe.each` over all ten) against the as-yet-unmodified files, ran it, confirmed all ten failed for the stated reason (`expected undefined to be 300`, i.e. no `maxDuration` export existed yet) by stashing just the ten cron files with a path-scoped `git stash push -m <unique-tag> -- <paths>` (never bare `git stash`), running the suite, then `git stash apply <sha>` + `git stash drop <sha>` to restore my already-applied fix without touching the shared stash stack's other entries. After restoring, all ten passed.++Added `scripts/check-cron-budget-wiring.mjs` (wired as `npm run check:cron-budget-wiring` and inserted into the `gate` chain next to `check:cron-syntax`) to close the class generally: it reads vercel.json's `functions` globs (applying wildcard keys before named keys so the `api/**/*.js` 30s catch-all never stomps a more specific 300s declaration, and escaping literal `[`/`]` in keys like `api/cron/[name].js` so glob doesn't parse them as a character class), finds every `api/cron/*.js` route declared above the 120s `DEFAULT_CRON_MAX_DURATION_MS` default, dynamically imports each handler to confirm it exports a matching constant, then regex-checks the handler's own source text for `maxDurationMs: <thatConstant> * 1000` inside its `wrapCron(...)` call, since an exported constant that is never actually passed is exactly the bug this order fixed twice over. Ran clean against the full tree: 16 in-scope routes (the ten fixed here plus the six already-correct precedents `x402-ring-leak-scan.js`, `[name].js`, `quality-bench.js`, `likeness-eval.js`, `marketplace-escrow-sweep.js`, `labor-escrow-sweep.js`), 0 problems, no false positives across the other ~108 cron files checked and found out of scope (declared at or under 120s).++Verification: `npm run check:cron-budget-wiring` exits 0. `npm run check:cron-syntax` exits 0 (150 declared crons, all valid). `npm run check:rules -- --paths <all ten fixed files, the new script, the new test, package.json>`: "OK: no hard-rule violations." `npm run test:core`: 41 files / 72 tests failed, same pre-existing order-401 baseline class (mcp-agent confirmation-required message-shape drift, an Upstash rate-limit quota exhaustion in `mcp-studio-ratelimit.test.js`); grepped the failing file list for every touched filename and for `cron-budget-wiring`: zero matches, so this order introduced no new failures. `git diff --staged --stat` reviewed before committing: exactly the ten two-line hunks, the new script, the new test, and the two-line `package.json` change (no stray em-dashes, no other files). Other agents' concurrent `public/changelog*.json`/`public/sitemap/index.html` churn in the shared worktree was left untouched; staged explicit paths only, never `-A`. Fix commit: `15e77e4c48...` (see `git log --oneline -1` on this worktree for the full SHA at close time).++Left: nothing for this order's own scope. `prompts/finish/427-auto-cron-maxduration-wiring-sweep.md` deleted in this closing commit.