Skip to content

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.

docs(prompts): update order 060 status preamble and OWNER-ACTIONS after row 34 reconciliation

nirholasa6099728fd3d
diff --git a/prompts/finish/060-x-grok-38-agent-mention-replies.md b/prompts/finish/060-x-grok-38-agent-mention-replies.md
index 35752dc38..86cf11234 100644
--- a/prompts/finish/060-x-grok-38-agent-mention-replies.md
+++ b/prompts/finish/060-x-grok-38-agent-mention-replies.md
@@ -4,6 +4,8 @@
**Evolve status update (2026-10-11, later).** Order 061 (mention settings UI, retired) shipped the first of the four mechanical pieces listed above: `api/_lib/migrations/20261011220000_agent_mention_policy.sql` adds `mention_replies_enabled` (default false), `mention_replies_dry_run` (default true), `mention_replies_daily_cap` (default 10, checked 0..50) and `mention_replies_allowed_intents` (default `{}`, validated against the same 6-intent set `x-mention-intents.js` parses) directly to `agent_x_policies`, read and written by `getAgentPolicy`/`saveAgentPolicy` in `api/_lib/x-agent-policy.js`. That is dedicated columns rather than a `mention_replies` entry in the generic `POST_KINDS`/`allowed_kinds` list this order's task 1 originally sketched; dedicated columns let the settings UI show a daily cap and an intent checklist without overloading the kind-gate validator, and `getAgentPolicy` already defaults every agent to the row above with no row present. Whoever picks this order up after row 34's reconciliation can skip straight to tasks 2 to 4 (the `agentAccounts()` supplier, the `x-mention-poll.js` wiring, `countAccountReplies()`, tests, docs) using these columns as-is. The migration is written and locally proven (`tests/agent-mention-policy-migration.test.js`, PGlite) but not yet applied to the shared database; see OWNER-ACTIONS row 35.
+**Evolve status update (2026-10-11, order 404 close-out).** The reconciliation blocker above is resolved: merge commit `d77b89178` landed `evolve`/`main` divergence row 34 (now deleted from OWNER-ACTIONS) and this checkout now has every file in the ~14-file import closure named in the first paragraph (`x-mention-poll.js`, `x-mentions.js`, `x-mention-store.js`, `x-mention-reply.js`, `x-mention-guard.js`, `x-budget.js`, `gateway/adapters/x.js`, `x-mention-on-behalf.js`, `x-mention-avatar.js`, `x-mention-image3d.js`, `x-mention-make.js`, `x-mention-deliver.js`, `x-mention-known-bots.js`, `x-text-weight.js`), confirmed present on disk. The merge also fixed the `x-mention-reply.js` `chainFor()` bug row 34 flagged: it now resolves the agent's brain through `resolveAgentBrain` (`api/_lib/agent-brain.js`), verified with `RUN_LLM_TESTS=1 npx vitest run tests/x-mention-reply.llm.test.js` (16/16 `source: 'model'`, no `buildBody` TypeError). What is NOT yet done: `x-mention-poll.js`'s `listAccounts({ agentAccounts = async () => [] })` still defaults to the no-op stub (confirmed at line 261 post-merge), so tasks 2 to 4 (the real `agentAccounts()` supplier joining `agent_x_policies`/`agent_x_connections`/`missingScopes()`, wiring it into `listAccounts()`/`pollAccount()`/`handleMention()`, `countAccountReplies()` in `x-mention-store.js`, tests, and the docs section) are unbuilt. This order is now unblocked and ready to run top to bottom from task 2; order 404 did not build it, since that is this order's own scope, not a reconciliation task.
+
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. Dry run by default per agent.
## Operating clause (binding)
diff --git a/prompts/finish/_context/production-100-OWNER-ACTIONS.md b/prompts/finish/_context/production-100-OWNER-ACTIONS.md
index c094a8b72..c5cba4e82 100644
--- a/prompts/finish/_context/production-100-OWNER-ACTIONS.md
+++ b/prompts/finish/_context/production-100-OWNER-ACTIONS.md
@@ -9,7 +9,7 @@ it and, if that unblocks a work order, say which one in the owning pack's `produ
Rows carry the date they were added so staleness is visible. Re-verify a row before acting
on it; some resolve themselves as other work lands.
-## Open rows (2026-10-11 (scout lane): row 36 added for the Cloudflare R2 flapping degraded/down pattern, and order 404 opened to reconcile the `evolve`/`main` divergence row 34 describes; 2026-10-11 (even later): row 24 re-measured again after order 400's ring-leak-scan tiering/lock fix shipped on `evolve`; 2026-10-11 (later): row 35 added for the agent mention-policy migration; 2026-10-11 04:16 UTC: rows 1 and 24 re-measured by the deep triage sweep; row 34 added for the evolve/main branch divergence; 2026-10-10: row 33 added for the xAI MCP e2e key; rows 1, 19 and 24 re-measured by the triage sweep; 2026-10-09: rows 1, 2 and 24 re-measured by the triage sweep, row 31 added for the GPU worker redeploy and row 32 for database table retention; row 30 added for the Grok Bot CLI setup rerun; 2026-10-08: row 26 added for the coin-gated MCP catalog regeneration; rows 1 and 2 re-measured by the triage sweep, row 24 added for the paid Solana RPC credits, row 25 added for the MCP connector OAuth deploy; 2026-09-30: row 23 added for the $THREE receiver wallets; 2026-09-29: row 19 re-measured after the agent-sniper deploy; 2026-09-09: row 19 added, and row 1 corrected because its outage premise no longer holds; rows 1, 2, 3, 9, 13, 15 and 16 re-measured 2026-09-04; the former row 18 was cleared that day and its number is not reused; the 2026-09-02 and 2026-08-09 passes are folded in below)
+## Open rows (2026-10-11 (order 404 close-out): row 34 deleted, its premise cleared by merge commit `d77b89178` (the `evolve`/`main` reconciliation) which also carried the `x-mention-reply.js` `chainFor()` fix row 34 called out, verified live with `RUN_LLM_TESTS=1 npx vitest run tests/x-mention-reply.llm.test.js` (16/16 `source: 'model'`, no `buildBody` TypeError); 2026-10-11 (scout lane): row 36 added for the Cloudflare R2 flapping degraded/down pattern; 2026-10-11 (even later): row 24 re-measured again after order 400's ring-leak-scan tiering/lock fix shipped on `evolve`; 2026-10-11 (later): row 35 added for the agent mention-policy migration; 2026-10-11 04:16 UTC: rows 1 and 24 re-measured by the deep triage sweep; row 34 added for the evolve/main branch divergence; 2026-10-10: row 33 added for the xAI MCP e2e key; rows 1, 19 and 24 re-measured by the triage sweep; 2026-10-09: rows 1, 2 and 24 re-measured by the triage sweep, row 31 added for the GPU worker redeploy and row 32 for database table retention; row 30 added for the Grok Bot CLI setup rerun; 2026-10-08: row 26 added for the coin-gated MCP catalog regeneration; rows 1 and 2 re-measured by the triage sweep, row 24 added for the paid Solana RPC credits, row 25 added for the MCP connector OAuth deploy; 2026-09-30: row 23 added for the $THREE receiver wallets; 2026-09-29: row 19 re-measured after the agent-sniper deploy; 2026-09-09: row 19 added, and row 1 corrected because its outage premise no longer holds; rows 1, 2, 3, 9, 13, 15 and 16 re-measured 2026-09-04; the former row 18 was cleared that day and its number is not reused; the 2026-09-02 and 2026-08-09 passes are folded in below)
| # | Action | Size | Unblocks | Detail lives in |
|---|---|---|---|---|
@@ -45,7 +45,6 @@ on it; some resolve themselves as other work lands.
| 31 | **Redeploy the GPU workers that fetch caller images, so a Wikimedia reference photo stops failing** (added 2026-10-09 by the evolve loop triage sweep). `upload.wikimedia.org` answers httpx's default `python-httpx` agent with 403, so `model-triposg` failed every job whose reference photo was a Wikimedia link before inference (4 logged 403 failures in the 24 hours to 2026-10-09 03:00 UTC). `d886d09e1` sends a descriptive User-Agent from the shared `worker_security.py`, mirrored to all 17 vendored copies, but a worker only picks it up when its image is rebuilt. Start with the one that failed: `gcloud builds submit --config workers/model-triposg/cloudbuild.yaml --region us-central1 --project aerial-vehicle-466722-p5 --substitutions=SHORT_SHA=manual$(date +%s) .` (the command in `workers/model-triposg/README.md`); the other image-fetching workers (`model-trellis`, `model-hunyuan3d`, `rig`, `texture`, `stylize`, `segment`, `remesh`) inherit it on their next routine deploy. Separately worth a look: `model-trellis` was killed by its own liveness probe (`/health` timing out during inference, then signal 9) three times in the 24 hours to 2026-10-09, which left 147 task polls answering 503; not root-caused this session. | one build | Image-to-3D jobs whose reference photo is a Wikimedia link | [workers/model-triposg/README.md](../../../workers/model-triposg/README.md) |
| 32 | **Decide retention for the six large tables the database retention cron never prunes** (added 2026-10-09 by the evolve loop triage sweep). The Neon footprint reached 11,606 MB, past the 8192 MB high-water mark since 2026-09-09, so five write-heavy crons (`launcher-tick`, `coin-intel-observe`, `smart-money-rollup`, `recompute-reputation`, `intel-learn`) skipped every tick for a month. The sweep raised `DB_RETENTION_HIGH_WATER_MB` to 16384 (config-only, pre-approved; real cap `neon.max_cluster_size` is 16TB), which buys about six weeks at the measured ~114 MB a day. The growth is in tables outside the retention set, and pruning them deletes history, so it is not an agent's call: `oracle_training_set` 1.8 GB (1.37M rows), `x402_self_facilitator_log` 1.4 GB (3.0M rows; the code already names it a product decision about lifetime revenue totals), `firewall_decisions` 1.2 GB, `usage_events` 0.7 GB, `club_tips` 0.6 GB (1.2M rows), `ops_alerts` 0.5 GB (693k one-off `503 settlement_unavailable` rows from July to October). Name a window per table (or keep forever and accept the storage bill); an agent then adds each to `TIME_SERIES_TABLES` in `api/cron/db-retention.js`. | decision | Keeping the write crons running past mid-November without raising the mark again | [docs/ops/db-retention.md](../../../docs/ops/db-retention.md) |
| 33 | **Create a production xAI API key so a Grok model's live MCP calls against three.ws can be proven** (added 2026-10-10 by the evolve loop, x-grok order 039, which already owns this exact gate as order 927: `prompts/finish/927-x-grok-46-owner-grok-api-key.md`). Step 0 re-derivation this session found no `GROK_API_KEY`/`XAI_API_KEY` anywhere: not in `process.env`, not in `.env`/`.env.local`, not on the `three-ws-api` Cloud Run service (`node scripts/read-service-env.mjs '^(GROK\|XAI)_API_KEY$' --names` returned nothing). `scripts/xai-mcp-e2e.mjs` (npm script `e2e:xai-mcp`) is built and verified end to end in dry-run mode: it matches xAI's current Responses API remote-MCP schema field for field and names this gate when no key is found. Create a key at console.x.ai, then either set it directly (`gcloud run services update three-ws-api --region us-central1 --update-env-vars GROK_API_KEY=<key>`) or hand it to order 927 to wire through Secret Manager; afterward `npm run e2e:xai-mcp` should exit 0 against production. | minutes, console only | Closes x-grok order 039's one remaining Definition of Done line, and order 927 | [_context/x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-10 entry |
-| 34 | **Decide how to reconcile the `evolve` worktree branch with `main`: it is 358 commits behind** (added 2026-10-11 by the evolve loop, while working x-grok order 050). `git log --oneline HEAD..main \| wc -l` from `/home/user/projects/.evolve-wt` on branch `evolve` returns 358: `main` shipped (among much else) x-grok orders 044, 046 to 052, and 055 to 058 (the `x-mention-poll.js` bot, its safety rails, budget controller, and the make/image3d/avatar handlers) while `evolve` has no record of any of it, because `evolve` never merged or rebased from `main` after it branched. `evolve` also carries 20+ of its own commits not on `main` yet (x-grok orders 038 to 040, 043, 045, 049, an accessibility fix, an a11y wire-up), so this is a real two-way divergence, not a simple fast-forward. The practical cost: this session spent real effort re-discovering and re-implementing order 050's mention-poll cron from scratch before noticing `main` already shipped a more complete version, and the same evidence shows orders 051, 052, 055, 056, 057 and 058's order files are stale duplicates sitting in `prompts/finish/` on `evolve` for the same reason (noted in [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entry); every future evolve session that picks one up will repeat this exact waste until the branch is caught up. Merging or rebasing 358 commits safely is a judgment call about which side wins on any file both branches touched (this evolve worktree's own x-search/agent-brain/agent-gateway/gateway-adapter work overlaps the same `api/cron/[name].js` and `vercel.json` main also edited); that is not a mechanical fix an agent should attempt unattended. Decide the reconciliation approach (likely: rebase `evolve`'s unique commits onto current `main`, resolving the handful of shared-file conflicts by hand) and either do it or direct an agent to. **Re-measured 2026-10-11 while verifying order 051 against `main` from a throwaway detached worktree (removed after, nothing committed to `main`): `main`'s shipped `x-mention-reply.js` has a live bug that this reconciliation should fix in the same pass.** `composePublicReply`'s `chainFor()` builds its model chain from `agent-brain.js`/`agent-model.js` (`{name,url,key,model}` records meant for `copilot-engine.js`'s own round-trip reader), then hands that chain to `llmComplete` in `llm.js`, whose attempt loop calls `p.buildBody(...)`, a method only `llm.js`'s own, differently-shaped `providerChain()` objects define. Every attempt on every rung throws the same `TypeError` and the whole chain "exhausts" in milliseconds, always landing on the safe fixed fallback reply. Verified live with production's own `GROQ_API_KEY`/`OPENROUTER_API_KEY`/`NVIDIA_API_KEY` (`RUN_LLM_TESTS=1 npx vitest run tests/x-mention-reply.llm.test.js --reporter=verbose`): 16/16 "passed" (the test accepts a safe fallback as a pass) but all 16 fell back with `reason: 'llm_error', detail: '... p.buildBody is not a function'`, and the real `x_mention_events` table already carries 129 rows with `reason: 'fallback:llm_error'` from the live mention-poll cron, recorded before this was diagnosed. The public reply bot has likely never sent a single real model-composed reply to a stranger; it is safe (every post-check still holds) but has silently answered every public mention with the fixed help text only. Fix, once someone is on `main`: change `chainFor()` to build from `llm.js`'s own `providerChain({ grokKey, grokModel })` (resolving the agent's Grok key/model the way `agent-grok-key.js` already does) instead of `modelChain`/`resolveAgentBrain`, so the chain shape matches what `llmComplete` reads. Full writeup: [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entry for order 051. **Re-measured again 2026-10-11 while working order 060 (agent mention replies): the gap is now 362 commits behind / 117 ahead, and order 060 cannot be built at all until this reconciles, because its entire prerequisite subsystem (`x-mention-poll.js` and its ~14-file import closure, orders 045-058) exists only on `main` and has no file to extend on `evolve`; left open with a dated status note rather than hand-copied or duplicated. Full writeup: [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entry for order 060.** | decision, then a rebase (the `chainFor()` fix itself is a small, mechanical change once on `main`) | Stops repeat duplicate work across the whole x-grok campaign and any other area both branches touched, and fixes a currently-silent production defect in the public X reply bot | [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entries |
| 35 | **Apply the agent mention-policy migration, then ship it with the next deploy** (added 2026-10-11 by the evolve loop, x-grok order 061, which is otherwise complete and retired). `api/_lib/migrations/20261011220000_agent_mention_policy.sql` adds `mention_replies_enabled`, `mention_replies_dry_run`, `mention_replies_daily_cap` and `mention_replies_allowed_intents` to `agent_x_policies`, the four fields the new "Answer mentions" panel on `pages/agent-edit.html` (Social tab) reads and writes. `npm run db:status` on 2026-10-11 lists it as the only pending migration. The read path (`GET /api/x/agents`) already works without it, since the query is `select *` and `rowToPolicy()` defaults the missing columns; only the write path breaks: `saveAgentPolicy`'s `INSERT` names the four columns explicitly, so a save attempt against the unmigrated table answers 500 with Postgres `42703 undefined_column`, verified live in a local run of the full UI against the real dev database on 2026-10-11 (every other state, no-connection/missing-scope/connected/populated-decisions, was verified working by temporarily granting `X_OAUTH_CLIENT_ID`/`SECRET` in `.env.local` only, never in production). Apply it with `node scripts/apply-migrations.mjs --apply --file 20261011220000_agent_mention_policy.sql`, or `npm run db:status` then `npm run db:migrate` (nothing else is pending as of this writing). `npm run db:check` blocks the next deploy on it until then. Separately, and not blocking this row: production has never set `X_OAUTH_CLIENT_ID`/`X_OAUTH_CLIENT_SECRET` at all (`node scripts/read-service-env.mjs '^X_OAUTH_CLIENT'` finds nothing), so the whole per-agent "connect this agent's own X account" flow (distinct from the company bot account's `X_API_KEY`/`X_ACCESS_TOKEN` posting credentials, which are set) answers "X connections are not enabled on this deployment" for every agent today; that is a pre-existing gap this order did not create and its settings UI already degrades to that state correctly. | one command | The "Answer mentions" save button in the agent settings UI | [x-grok-PROGRESS.md](x-grok-PROGRESS.md), 2026-10-11 entry for order 061 |
| 36 | **Check Cloudflare R2's own status/dashboard for the bucket behind `S3_BUCKET`: it flaps between healthy and unreachable without any corresponding change on our side** (added 2026-10-11 by the evolve scout lane). Queried `ops_alerts` directly (columns: `signature, title, detail, severity, count, environment, first_seen, last_seen`): since 2026-09-08 the `object_storage` sensor (`api/_lib/ops/object-storage-health.js`) has logged roughly 167 "DEGRADED: Object storage (Cloudflare R2)" events (`bucket reachable but slow, signed list ~1095ms` against a 1000ms threshold) and about 18 "DOWN" events, interleaved with many "RESOLVED" events minutes apart showing a healthy 150 to 300ms. Reproduced live with production's own `S3_ACCESS_KEY_ID`/`S3_SECRET_ACCESS_KEY`/`S3_BUCKET`/`S3_ENDPOINT` (pulled via `node scripts/read-service-env.mjs` one variable at a time, used in-process, then deleted from disk immediately): `gatherObjectStorageHealth()` returned `{"status":"down","detail":"bucket unreachable: Please enable R2 through the Cloudflare Dashboard.","metrics":{"latencyMs":135,"credentialFault":false}}`, a 135ms response, i.e. the bucket answered fast but Cloudflare's own API told us R2 was not enabled, which cannot be true most of the time this account is clearly serving reads. Ruled out as a code cause: the credential is not rejected (`credentialFault:false`, no `SignatureDoesNotMatch`), and the AWS SDK's Node HTTP handler already defaults to keep-alive on (`keepAlive:true, maxSockets:50` in `@smithy/node-http-handler`), so this is not the classic missing-keep-alive latency bug. The probe itself is a single signed `ListObjectsV2Command` with no retry (`api/_lib/ops/object-storage-health.js:76-92`), so a genuinely transient one-off Cloudflare hiccup is indistinguishable from a sustained outage in this sensor today, which may be inflating the DOWN/DEGRADED counts above a one-retry version would show. Two independent things to do, neither owned by this reconciliation order: (a) check Cloudflare's own R2 dashboard/status page for the account behind `S3_BUCKET` for incidents correlated with the alert timestamps above (owner/dashboard access this agent does not have); (b) if the pattern looks like a true transient flap rather than sustained Cloudflare-side degradation, a future order could add one immediate retry before `gatherObjectStorageHealth()` classifies `down`/`degraded`, with a test proving a single synthetic failure followed by a synthetic success no longer pages. Not attempted here because the current evidence does not confidently distinguish "add a retry" from "mute a real recurring problem", and CLAUDE.md is explicit that a check does not get weakened without a dated, measured reason; this row exists so neither path gets silently skipped. | Cloudflare dashboard check (owner), then optionally a small, test-covered retry (agent) | Every avatar, thumbnail and generated GLB reads through this bucket; `/cdn/*` and the forge both degrade when it flaps | `ops_alerts` table, queried 2026-10-11 |
| 37 | **Ship the cron time-budget fix with the next deploy** (added 2026-10-11 by the evolve loop, order 403, otherwise complete and retired). `wrapCron()` in `api/_lib/http.js` now races every cron handler against a real time budget (`maxDurationMs`, wired from each handler's own `export const maxDuration * 1000`, defaulting to 120000ms) and answers a clean `503 { reason: 'cron_timeout' }` instead of hanging until Cloud Run's blind 900s ingress kill, which is what `/api/cron/x402-ring-leak-scan` was hitting repeatedly before order 400 landed its own fix. Verified locally: a real `http.createServer` hosting `wrapCron` with an 800ms budget and a never-resolving handler answered `503 cron_timeout` at 0.809s (not 900s, not instantly); the new `tests/http-cron-timeout.test.js` (4 tests) and the added `wrapCron` case in `tests/http-db-unavailable-boundary.test.js` pass 10/10, and the timeout test was proven red (indefinite hang) against the pre-fix code via a path-scoped `git stash` before the fix landed. No migration, no env var, nothing else needed; this is a pure code fix sitting on `evolve` waiting for row 1's routine deploy cadence to carry it to `main` and production. Ship with `npm run deploy:gcp:full` (row 1 already tracks the general "approve the next deploy" gate; this row exists only so the new behavior is named for verification). Post-deploy verification: re-run the step 0 query from `prompts/finish/403-auto-cron-timeout-enforcement.md` (`gcloud logging read 'resource.type="cloud_run_revision" resource.labels.service_name="three-ws-api" textPayload:"maximum request timeout"' --freshness=24h --project aerial-vehicle-466722-p5`) after the deploy window; a healthy rollout shows that query going quiet (or near-quiet) while `textPayload:"exceeded its"` picks up any genuine stuck cron with its name attached, cross-referenced against order 400's `x402-ring-leak-scan` fix so a recurrence is distinguished from a different handler entirely. | one deploy (already covered by row 1's cadence) | Clean, diagnosable cron timeouts platform-wide instead of a blank "maximum request timeout" | `docs/ops/production-log-triage.md`, "HTTP timeout with no cron context" section |