Bot pinned to an engine whose CLI is not installed fails every turn with no error message

Aperta
#65 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

Start in dist-server/server/drivers/pi.js at the child process close handler and compare it with the describeSpawnFailure path. Trace how settle(false) and bot.turn.end reach the chat, then check the related driver tests or add a regression test for a child that exits before the handshake. Done means the failure appears as a visible error in chat.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What happened

An engine can be saved in config.json (and even be the default model selection) while its CLI is not installed on the machine. Bots pinned to that engine then fail every turn, and the only trace is bot.turn.end ok:false in the trail log — the chat shows the person's message, then a [digest] · no tool activity, with no error text and no "install this engine" prompt. The bot looks like it ignored the message.

Expected: either the send is refused with the engine's own explanation, or the turn fails with a visible message — the same one GET /api/instances already produces:

pi isn't installed, or isn't on this app's PATH. Install it for the user running dusk bot or use Set CLI, then check again.

Actual: the turn is accepted (POST /api/bots/<id>/messages → 202) and dies in a few hundred ms:

{"ev":"bot.turn.start","provider":"piAgent","turn":"ae7aab35-…"}
{"ev":"bot.turn.end","ok":false,"stop":"failed","ms":479}

No runtime.error event, nothing in logs/trail-server.jsonl, nothing in the chat.

Steps to reproduce
  1. Have a pi engine saved with no pi binary installed for the user running dusk bot:

    "instances": { "pi": { "driver": "piAgent" } },
    "defaultModelSelection": { "instanceId": "pi", "model": "opencode-go/hy4-flash-free" }
    
  2. Point a bot at it:

    "modelSelection": { "instanceId": "pi", "model": "opencode-go/hy4-flash-free" }
    
  3. Send the bot any message.

Version

duskbot 0.2.12 (pi 1.5.2)

Platform

Linux (Ubuntu on WSL2), DUSK_BOT_BOX=required

Engine

pi (piAgent driver)

Logs or screenshots

Trail log for the failing turn — the only record of the failure:

{"ev":"bot.turn.start","provider":"piAgent","turn":"ae7aab35-…"}
{"ev":"bot.turn.end","ok":false,"stop":"failed","ms":479}
Why it is silent

In dist-server/server/drivers/pi.js the spawn failure path emits a runtime.error (describeSpawnFailure), but a child that exits during startup lands in the close handler:

child.on("close", () => {
    rejectWaiters(new Error("pi process exited before replying"));
    settle(false);        // → stopReason "failed", no runtime.error emitted
});

settle(false) yields stopReason: "failed" with no message, so the failure never reaches the UI. Other drivers surface their failures in the chat; this path cannot.

Suggested fix
  • In the close handler, emit a runtime.error (and a bot.turn.end message) when the child exits before the handshake, e.g. describeSpawnFailure plus "the engine exited before it answered".
  • Optionally, refuse the send up front when the selected instance's snapshot is unavailable, and reuse that snapshot's reason as the chat message.
Related pi-driver issues found while diagnosing the same turn

Both are fixable on this side; happy to file separately.

  • The driver writes its per-turn MCP config under TMPDIR and passes it as DUSK_MCP_CONFIG. The bot box replaces /tmp with a private tmpfs, so the file is invisible to the boxed engine and the extension throws dusk bot Pi MCP configuration could not be read before any RPC frame is sent.
  • The box runs the engine with HOME=<data>/engine-home, into which only ~/.pi/agent/auth.json is shared (ENGINE_FOLDERS), not models-store.json. The model list is then empty and set_model answers Model not found: opencode-go/hy4-flash-free, while GET /api/instances reports the same engine as available with 34 models — the engine probe runs in the server's HOME, the turn does not.
Lingua principale
TypeScript
Stelle
277
Fork
27
Merge medio
2h 47m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DuskBotAI/duskbot

Tutte le issue di DuskBotAI/duskbot

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.