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(okx-chat-bot): record the 00002-s4s rollout, its lease handoff, and the inbound message still owed

nirholasa2b78c0b49db
diff --git a/prompts/finish/907-backlog-08-okx-chat-bot-always-on.md b/prompts/finish/907-backlog-08-okx-chat-bot-always-on.md
index e6027e964..df81772a5 100644
--- a/prompts/finish/907-backlog-08-okx-chat-bot-always-on.md
+++ b/prompts/finish/907-backlog-08-okx-chat-bot-always-on.md
@@ -73,6 +73,32 @@ host. Build it:
host detect an expired session and emit an actionable alert naming the exact
command, rather than failing chat silently.
+## State on 2026-09-29, re-measured: deployed, online, `ok`; only a real inbound message is left
+
+Full measurements: [okx-ai-PROGRESS.md](_context/okx-ai-PROGRESS.md), entry 2026-09-29.
+
+- **Owner step 2 is done.** `npm run okx:bot:deploy` exit 0 after one fix it needed: onchainos
+ releases from v4.6.0 on ship no `install.sh`/`installer-checksums.txt`, so the Dockerfile now
+ installs the checksummed release binary (`0b1335882`). Lane provisioned (metering agent
+ `55479fa8-13c6-44b3-a245-3156f2c836e5`, key in `okx-chat-bot-llm-gateway-token`), Cloud Build
+ `ea753445` SUCCESS, revision **`okx-chat-bot-00002-s4s`**.
+- **Lease handoff clean.** The new instance waited on the pre-lease `00001-926` until its beat was
+ 90 s quiet, the old one snapshotted on SIGTERM and exited, the new one acquired the lease at
+ 06:42:43Z, restored that exact snapshot (7,121,505 bytes), elected `anthropic-gateway` over
+ `vertex=unauthorized`, and went `online` at 06:42:58Z with `loggedIn: true` and no OTP.
+- **Owner step 3 is done.** `/api/healthz` `okx_chat_bot` is **`ok`** on `okx-chat-bot-00002-s4s`;
+ the beat carries `providerLane: anthropic-gateway` and `leaseHolder`; `npm run okx:bot:gateway --
+ --verify --cli` exit 0 (`claude -p` through the lane, 2 turns, tool call, 6.9 s). `/readyz` is not
+ readable from this workspace's gcloud identity (401 on the token audience); the beat reports
+ `ready: true` from the same verdict.
+- **What remains:** DoD lines 1 and 3 need a real buyer message answered on the host. No inbound has
+ arrived since 2026-09-03 (daemon offline replay `newest=2026-09-03T10:28:06Z`). Inbound chat is
+ job-scoped and must come from a counterparty agent in a **different** OKX account (an agent on
+ `[email protected]` would be a second writer on #2632's identity). Owner-held sources: OKX's own chat
+ test when 911 resubmits, or a buyer agent on a second account opening a task naming #2632. When
+ one lands, read `gcloud logging read 'resource.labels.service_name="okx-chat-bot"
+ jsonPayload.line:"ai-dispatch"' --freshness=1h` and confirm the reply, then retire this order.
+
## State on 2026-09-25, re-measured: gcloud is back, the deploy is one approval away
- **Bot host: unchanged.** `/api/healthz` still reports `okx_chat_bot` `degraded` on
@@ -160,18 +186,21 @@ Vertex leads the chain, so the next election moves the bot back to Claude on Ver
## Definition of done
-- [ ] **Chat delivery verified end to end with a real inbound message.** The inbound half
- is proven (`activeClients: 1`, `agentCount: 1`, 0 daemon restarts since
- 2026-09-05). The reply lane is proven against production (2026-09-18: the real
- `claude` agentic request, tool call included, answered through the free proxy
- chain); a real buyer reply needs the two deploys above. The original wording
+- [ ] **Chat delivery verified end to end with a real inbound message.** Both deploys
+ have landed (2026-09-29: `okx-chat-bot-00002-s4s`, `online`, lane `anthropic-gateway`,
+ `activeClients: 1`, healthz `ok`) and the real `claude` CLI answers through the lane on
+ production. Still missing: an actual buyer message and the host's reply to it (owner-held,
+ see the 2026-09-29 state section). The original wording
of this line, "`npm run okx:bot` exits 0", is retired: that command is the
codespace stopgap and must not run while the deployed host is up.
- [x] **The daemon runs on an always-on host, not this codespace.** Cloud Run
`okx-chat-bot-00001-926`, 4.8 days of continuous 30s beats.
- [ ] **Its workspace carries real three.ws context.** The mechanical half is done and
tested: `buildChatBriefing()` renders 10,069 bytes from the live catalog module and
- is rebuilt on every boot. Asking the bot a platform question needs the deploys above.
+ is rebuilt on every boot. On 2026-09-29 the real CLI, in a workspace staged by the bot's own
+ `buildWorkspace()` and run through the production lane, answered a buyer question with
+ the exact listed prices and endpoints. That was off-host; the same answer from the
+ deployed host needs the inbound message in line 1.
- [x] **A health endpoint exists and an offline session raises an alert.** `/readyz` is
strict, `/api/healthz` carries the `okx_chat_bot` subsystem (now naming its
`host` and `hostDurable` as fields), and `sendOpsAlert` fires on every
diff --git a/prompts/finish/_context/okx-ai-PROGRESS.md b/prompts/finish/_context/okx-ai-PROGRESS.md
index e0bd45b2f..3eb53f35d 100644
--- a/prompts/finish/_context/okx-ai-PROGRESS.md
+++ b/prompts/finish/_context/okx-ai-PROGRESS.md
@@ -4345,3 +4345,84 @@ not readable; the last reading is still 2026-09-09's `Listing rejected`.
(`npm run okx:gauntlet -- --yes`), which settles 1.07 USD₮0 on X Layer to seller
`0x4022de2D36C334E73C7a108805Cea11C0564f402` (cases 2, 2b, 3, 3i, 3r, 5a) and 0.01 USDC on
Solana to the Solana payTo `wwwwwDxFWRn7grgr3Esrsg5C6NvDoDHSA4gaCffccrU` (case 7).
+
+## 2026-09-29 | backlog order 08 (907) | bot redeployed onto the lease and the free gateway lane; healthz ok; no inbound message yet
+
+Owner instruction "finish them all" was the approval for `npm run okx:bot:deploy`. No `okx:bot`,
+no local daemon, no `onchainos wallet login` in any phase, no API deploy, no push, no spend.
+
+**Blocker found and fixed before the real run.** `--dry-run` was green through step [4] (gcloud ok,
+clean worktree of HEAD, lane `missing` as expected, live API `f2081d946` contains `d3074c1c8`), but
+the image itself could not have built: onchainos releases from v4.6.0 on ship no `install.sh` and no
+`installer-checksums.txt` (both 404 on v4.6.3), and the Dockerfile's installer step used them. It
+now downloads the release binary for the build platform and verifies it against the release's own
+`checksums.txt` (`0b1335882`). Verified locally first (`onchainos-x86_64-unknown-linux-gnu: OK`,
+`onchainos 4.6.3`), then in Cloud Build.
+
+**Deploy.** `npm run okx:bot:deploy` exit 0.
+- Step [3] provisioned the lane: user `106ec2ec-83a0-4f79-b350-a6b23fd986b4`
+ (`[email protected]`), metering agent `55479fa8-13c6-44b3-a245-3156f2c836e5`,
+ key `365d6994-...` minted into `okx-chat-bot-llm-gateway-token`, `three-ws@` granted
+ `secretAccessor`; proxy `200` on `nvidia/nemotron-3-super-120b-a12b`, bot probe ok.
+- Cloud Build `ea753445-ab27-4d1e-bcc9-659930a223f5` SUCCESS (onchainos 4.6.3 baked in, was 4.5.2),
+ revision **`okx-chat-bot-00002-s4s`** serving 100%.
+
+**Lease handoff, from the service logs (UTC):**
+- 06:40:50 new instance boots, chain `vertex > anthropic-gateway`, health server up, then
+ `waiting for the single-writer lease`: "`okx-chat-bot-00001-926` predates the single-writer lease
+ and beat 11s ago".
+- 06:41:13 `00001-926` gets SIGTERM, `daemon stopped` (0 restarts), `state snapshot saved`
+ (7,121,505 bytes, reason SIGTERM), `bye`.
+- 06:42:43 `single-writer lease acquired` (old beat 90 s quiet), 06:42:44 `state restored`
+ (the same 7,121,505 bytes), 06:42:45 `workspace built` (briefing 10,068 bytes, 12 skills),
+ 06:42:46 `provider lane elected` vertex -> anthropic-gateway (`vertex=unauthorized
+ anthropic-gateway=ok`), 06:42:58 `health changed` online / ok.
+- No overlap: the new daemon started 90 s after the old one stopped. One `Uncaught signal: 6` at
+ 06:42:47 is the first daemon child being killed for the lane restart; `daemonRestarts` stayed 0.
+- The restored session survived the onchainos 4.5.2 to 4.6.3 jump: `loggedIn: true`, no OTP.
+
+**Heartbeat, `bot_heartbeat` row `okx-chat-bot`, 06:48:25:** 13 s old, `reason: online`,
+`health: ok`, `ready: true`, `loggedIn: true`, `activeClients: 1`, `agentCount: 1`,
+`daemonRestarts: 0`, `providerLane: anthropic-gateway`, `providerTransport: gateway`,
+`providerChain: [vertex unauthorized, anthropic-gateway ok]`, `leaseHolder:
+cloudrun:okx-chat-bot (okx-chat-bot-00002-s4s)#283fb2ec-...`. Lease row `okx-chat-bot:lease`
+renewed 5 s earlier by the same holder.
+
+**`/api/healthz`:**
+`{"name":"okx_chat_bot","host":"cloudrun:okx-chat-bot (okx-chat-bot-00002-s4s)","hostDurable":true,"status":"ok","detail":"online (1 XMTP client(s), provider=claude, host=cloudrun:okx-chat-bot (okx-chat-bot-00002-s4s))"}`
+The subsystem does not surface `providerLane`/`leaseHolder`; they are in the beat above.
+
+**`npm run okx:bot:gateway -- --verify --cli`:** exit 0. Secret holds the active key; proxy `200`;
+probe ok; `claude -p through the lane: OK {"turns":2,"result":"gateway-proof-mumbc703","isError":false,"durationMs":6851}`.
+
+**`$OKX_BOT_URL/readyz`:** not readable from this workspace. Unauthenticated answers 403 (correct,
+`--no-allow-unauthenticated`); the gcloud user identity token here carries a non-default OAuth
+audience, which Cloud Run answers 401, and the account lacks `getOpenIdToken` to mint one for
+`three-ws@`. No IAM was changed to get around it. The heartbeat is written from the same verdict
+`/readyz` serves, and reads `ready: true`.
+
+**A platform question, answered with real three.ws context (off-host).** The bot's own
+`buildWorkspace()` staged into a throwaway HOME, the real `claude` CLI run in it with the exact
+gateway env overlay against production. Question: a buyer wants a rigged character and a cheap
+prop. Answer (19 s): Text to Rigged Avatar $0.50 at `/api/okx/3d/avatar`, Forge 3D Draft $0.01 at
+`/api/okx/3d/forge-draft`, Text to 3D Model $0.01 at `/api/okx/3d/text-to-3d`, status via the free
+Forge Job Status service. Every price and endpoint matches the briefing. Two flaws: it called the
+$0.01 text-to-3d "even cheaper" than the $0.01 draft, and it wrote en-dashes because the briefing
+only banned em-dashes. The briefing now bans both (`1f4f48313`); that ships on the next bot deploy.
+This proves the context and the lane, not a reply on the host.
+
+**No real inbound message has reached the bot since 2026-09-03.** The daemon's offline replay on
+both boots reports `newest=2026-09-03T10:28:06Z`, `scanned=1`, `replayed=0`. Inbound chat on this
+marketplace is job-scoped (`a2a-agent-chat` with a `jobId`, from a counterparty agent), and
+`okx-a2a` quarantines anything else into `invalid-xmtp-messages.sqlite`, so a raw XMTP DM from a
+fresh key would prove nothing. The honest way to produce one needs a counterparty agent in a
+**different** OKX account: any agent on `[email protected]` would be loaded by `get-my-agents` next to
+#2632, so a second daemon for it on that account is a second writer on #2632's identity. Two real
+sources, both owner-held: (a) OKX's own chat test during listing review, triggered by the 911
+resubmission once the owner's login completes; (b) a buyer agent registered under a second OKX
+account, publishing a task that names #2632 and sending one chat line.
+
+**Other agents' work observed, not touched.** A concurrent `deploy:sniper` run wrote into the same
+scratch log path and failed on its own (`agent-sniper-00034-7zp` did not listen on 8080).
+
+**907 stays open.** DoD lines 1 and 3 need a real inbound message and a reply on the host. When one lands, the daemon logs `queued ai-dispatch command=... job=...` then `ai-dispatch command completed`; read them with `gcloud logging read 'resource.labels.service_name="okx-chat-bot" jsonPayload.line:"ai-dispatch"' --freshness=1h`.
diff --git a/workers/okx-chat-bot/README.md b/workers/okx-chat-bot/README.md
index 5900bb6a5..1edcde2f1 100644
--- a/workers/okx-chat-bot/README.md
+++ b/workers/okx-chat-bot/README.md
@@ -358,19 +358,21 @@ someone has to go find.
## Deploying
-**Status: deployed 2026-09-04.** Service `okx-chat-bot` in
-`aerial-vehicle-466722-p5`, revision `okx-chat-bot-00001-926`, `Ready=True` at
+**Status: redeployed 2026-09-29.** Service `okx-chat-bot` in
+`aerial-vehicle-466722-p5`, revision `okx-chat-bot-00002-s4s`, at
`https://okx-chat-bot-lp642k3kpa-uc.a.run.app` (authenticated invocations only).
-The first boot restored the seeded snapshot byte for byte, came up
-`loggedIn: true` with no OTP, and serves one XMTP client for agent 2632. The
+It took over from the first revision, `okx-chat-bot-00001-926` (deployed
+2026-09-04), through the single-writer lease: it waited until the old host's
+heartbeat was 90 s quiet, restored the snapshot that host wrote on SIGTERM, and
+came up `loggedIn: true` with no OTP, one XMTP client serving agent 2632. The
codespace stopgap is stopped and **must stay stopped**: the GCS state object has
exactly one writer and Cloud Run owns it now.
-It reports `ai_provider_unauthorized` and answers `/readyz` 503, which is the
-design working rather than a fault: chat is delivered durably, the GCP billing
-hold denies Vertex, and the bot says so with the fix attached instead of going
-quiet. Clearing the hold needs no redeploy; the credential probe flips readiness
-on its own within 15 minutes.
+It reports `online` and `/api/healthz` reads `ok`. Vertex still answers the
+billing hold (`Lightning dunning decision is deny`), so the election skips it and
+replies run on the `anthropic-gateway` lane through three.ws's own proxy. Clearing
+the hold needs no redeploy: the next 15-minute election moves the bot back to
+Claude on Vertex by itself.
Everything the deploy depends on:
@@ -380,8 +382,8 @@ Everything the deploy depends on:
| `okx-chat-bot-database-url` secret | created 2026-09-02 from the project's own `DATABASE_URL`, `three-ws@` holds `secretAccessor` |
| AI credential | **no secret needed.** `three-ws@` already holds `roles/aiplatform.user`, so `CLAUDE_CODE_USE_VERTEX=1` in the deploy authenticates through ADC |
| Seeded session | seeded 2026-09-04 and proven: the first revision restored it and needed no OTP |
-| Payment-free AI lane | `npm run okx:bot:deploy` provisions it (metering agent, service-account key, `okx-chat-bot-llm-gateway-token` secret with `three-ws@` as `secretAccessor`) through `scripts/okx-bot-llm-gateway.mjs --apply`. Not yet run as of 2026-09-18: Secret Manager writes are the owner's |
-| API carrying the agent-scoped proxy path | commits `53687d994` and `d3074c1c8`. Not live as of 2026-09-18 (live API `4291900c7`); `npm run deploy:gcp:full` ships it |
+| Payment-free AI lane | `npm run okx:bot:deploy` provisions it (metering agent, service-account key, `okx-chat-bot-llm-gateway-token` secret with `three-ws@` as `secretAccessor`) through `scripts/okx-bot-llm-gateway.mjs --apply`. Provisioned 2026-09-29: service account `[email protected]`, metering agent `55479fa8-13c6-44b3-a245-3156f2c836e5`, one active key in the secret |
+| API carrying the agent-scoped proxy path | commits `53687d994` and `d3074c1c8`, live since API `c8f10f437` (2026-09-24) |
The AI-provider secret used to be the one blocker, and the deploy was written to
fail loudly without it on the reasoning that a bot receiving chat it can never
@@ -473,7 +475,7 @@ deploy and then vanishes without a single error line. A lane belongs in
`CLAUDE_CODE_USE_VERTEX` only if you want the key to lead.
- **A gateway**: set `OKX_BOT_ANTHROPIC_BASE_URL` and `OKX_BOT_ANTHROPIC_MODEL` in
`--set-env-vars` and `OKX_BOT_ANTHROPIC_AUTH_TOKEN=<secret>:latest` in
- `--set-secrets`. The deploy already carries the OpenRouter one.
+ `--set-secrets`. The deploy already carries one: three.ws's own proxy, above.
Because the chain elects on a live probe rather than on presence, a lane with no
funds behind it is inert (it probes `unauthorized` and is never elected) and