Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

feat(server): expand /cowork/health with diagnostics and add chaos harness

3 months ago

4eda7a5
Authored
Max Weinbach7/1/2026, 3:38:21 PM
Expand the cheap /cowork/health liveness endpoint to return useful
diagnostics (version, uptimeMs, cwd, activeSessions, db, journal,
sendQueue, startup.ready) while keeping it HTTP 200 / ok:true. Detail
rides in body booleans; the detailed cowork/runtime/diagnostics/read
JSON-RPC route is unchanged. Adds SessionDb.ping(), a cheap in-memory
ThreadJournal.getAggregateHealth(), a HealthSnapshot on the runtime, and
a startupReady flag owned by startAgentServer.

Add a deterministic chaos harness covering server death after
server_listening, kill during turn/start, slow handshake, reconnect
during approval, health 503, send-queue overflow, and DB lock
contention -- driven through injectable seams (fake WebSocket / fake
child / injected fetch / paired coordinators), no spawned processes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Parent128f290

12 files changed
  • apps/desktop/test/helpers/fakeServerChild.ts+52−0
  • apps/desktop/test/server-manager.chaos.test.ts+164−0
  • docs/diagnostics.md+20−0
  • src/server/runtime/ServerRuntime.ts+45−0
  • src/server/runtime/ThreadJournal.ts+36−0
  • src/server/sessionDb.ts+15−0
  • src/server/startServer.ts+9−1
  • test/chaos/dbLock.chaos.test.ts+126
−0
  • test/chaos/jsonRpcSocket.chaos.test.ts+140−0
  • test/chaos/sendQueue.chaos.test.ts+79−0
  • test/helpers/chaos.ts+190−0
  • test/server.test.ts+28−2