agents-chat-starter: spawn PUT goes to the durable-streams proxy, so no entity is created and agents never wake

オープン 初心者向け
#4,687 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@adityavkk がすでに取り組んでいます。

2026年7月5日 から。

  • #4688 @adityavkk による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
typescript
領域
backend

調査の方向性

examples/agents-chat-starter/src/server/index.ts の spawn fetch と、starter の AGENTS.md にある Entity Bootstrap スニペットから始めます。それらのリクエストパスを packages/agents-server/src/routing/entities-router.ts の entity route と比較し、その後 Quick Start を実行して、entity が /_electric/entities に表示され、メッセージ後に agent が起動することを確認します。

索引モデルが issue の本文から書いたものです。

説明

What happens

Follow the starter's Quick Start, create a room, and send a message. No philosopher ever replies. Nothing reports an error. POST /api/rooms returns {"agentCount": 1} and the spawn PUT returns 201 Created.

The spawn call in examples/agents-chat-starter/src/server/index.ts PUTs to the bare entity path:

const entityUrl = `/${type}/${agentId}`
const putRes = await fetch(`${AGENTS_URL}${entityUrl}`, { method: `PUT`, ... })

On the current agents-server, that path never reaches the entity API. packages/agents-server/src/routing/global-router.ts sends /_electric/* to the internal router and everything else to the durable-streams proxy:

globalRouter.all(`/_electric/*`, internalRouter.fetch)
globalRouter.all(`*`, durableStreamsRouter.fetch)

So the PUT creates a raw durable stream named /socrates/<id> and returns 201. No entity is created, no dispatch subscription is registered, and the agent never wakes. The only route that creates an entity is PUT /_electric/entities/:type/:instanceId (packages/agents-server/src/routing/entities-router.ts).

Repro

Against @electric-ax/agents-server 0.6.3 (run via pnpm dlx, embedded streams, port 4510) with the starter's backend running so the socrates/camus/simone types are registered:

$ curl -s -o /dev/null -w '%{http_code}\n' -X PUT localhost:4510/socrates/repro-bare \
    -H 'content-type: application/json' \
    -d '{"args":{"chatroomId":"repro"},"initialMessage":"You have joined."}'
201

$ curl -s localhost:4510/_electric/entities
# only the principal entity; /socrates/repro-bare is not there

$ curl -s -X PUT localhost:4510/_electric/entities/socrates/repro-entity \
    -H 'content-type: application/json' \
    -d '{"args":{"chatroomId":"repro"},"initialMessage":"You have joined."}'
{"url":"/socrates/repro-entity","type":"socrates","status":"idle","streams":{"main":"/socrates/repro-entity/main"},"dispatch_policy":{"targets":[{"url":"http://localhost:4710/webhook","type":"webhook",...

After the second PUT the entity appears in /_electric/entities, the dispatch webhook is registered, and the first wake runs the handler. Nothing at all happens after the first PUT.

Why it broke

The starter was correct when it was written. At the original Electric Agents commit (#4151), the server matched bare /{type}/{name} paths and spawned on PUT. The routing refactor in #4307 moved entity creation under /_electric/entities and pointed the catch-all at the durable-streams proxy. The starter (added in #4199, before the refactor) kept the old path, so it has been silently broken since #4307. The failure mode is nasty because the proxy answers 201 and the starter's putRes.ok check passes.

Everything else in the repo already uses the canonical path: ctx.spawn through runtime-server-client.ts spawnEntity(), the electric-ax CLI (entity-api.ts), and the conformance DSL, which prefixes /_electric/entities onto every entity request.

Fix

Point the starter's spawn fetch at ${AGENTS_URL}/_electric/entities/${type}/${id}, and fix the same snippet in the starter's AGENTS.md ("Entity Bootstrap" section). PR incoming.

Versions: @electric-ax/agents-server 0.6.3, @electric-ax/agents-runtime 0.6.3, repo main at 9e3af10c3.

A separate, smaller problem found on the way: pnpm install on a freshly scaffolded copy (npx electric-ax agents init) fails because the template's package.json pins "@electric-ax/agents-runtime": "workspace:*", which does not resolve outside the monorepo. Happy to file that separately.

主要言語
TypeScript
スター
10.4k
フォーク
399
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

electric-sql/electric のほかの issue

electric-sql/electric の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。