Skip to content

feat: tole serve — token-authenticated HTTP daemon (D3 v1, issue #96) - #131

Merged
ajianaz merged 1 commit into
developfrom
feat/serve-mode-v2
Sep 28, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/serve-mode-v2

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

What

tole serve: tole as a long-running, token-authenticated HTTP daemon — REST endpoints for the session host (create/list sessions, run turns, poll status). Server-side durable JSONL sessions; turn execution serialized per session.

Why

The ecosystem already operates this way for uteke (uteke-serve): shared services on the box, reachable from any device. tole's capabilities (durable sessions, jailed tools, memory loop) should be reachable the same way — without SSH-ing into the machine.

Changes

  • tole-cli/src/serve.rs: hand-rolled HTTP/1.1 on std::net (zero new deps — Content-Length bodies, Connection: close), bearer-token auth on everything except /health, refuses to start without a token; 30s read/write timeouts (thread-exhaustion DoS — CodeCora finding); routes: health/sessions-create/list/status/prompt; non-blocking status route (try_lock — never blocks on a running turn)
  • tole-cli/src/session_host.rs (refactor): the session machinery extracted from acp.rs into a shared module used by BOTH acp and serve — open_session takes the approver as a parameter (ACP: interactive editor prompt; serve: non-interactive allowlist; Destructive registers only behind interactive approvers, so serve keeps Destructive structurally absent); plan_mode filters to read-only tools
  • integration test + live E2E with real provider

Testing

  • fmt / clippy -D warnings / test --workspace ✅ (239 tests)
  • Live E2E: health ✓, auth matrix (401 without/wrong token) ✓, create session ✓, prompt turn (real provider: end_turn) ✓, list/status ✓, duplicate registration removed after Cora flagged it
  • cora review --staged: No issues found

Remaining (issue #96 stays open)

MCP Streamable HTTP transport on the same daemon; auth hardening beyond a static token.

tole as a long-running HTTP daemon: REST endpoints for the session
host — create/list sessions, run turns, poll status. Remote clients
drive durable tole sessions without SSH-ing into the box.

- session_host.rs: the session machinery extracted from acp.rs into a
  shared module — ONE implementation used by both ACP and serve
  (open_session takes the session's approver as a parameter: ACP wires
  the interactive editor prompt, serve wires a non-interactive
  allowlist; Destructive registers only behind interactive approvers,
  so serve mode keeps Destructive structurally absent). plan_mode
  filters to read-only tools; run_session_turn returns
  (stop_reason, final_text).
- tole serve: hand-rolled HTTP/1.1 on std::net (zero new deps),
  Content-Length bodies, Connection: close, 30s read/write timeouts
  (thread-exhaustion DoS — CodeCora finding), bearer-token auth on
  everything except /health, refuses to start without a token.
- Endpoints: GET /health, POST/GET /sessions, GET
  /sessions/{id}[.status] (non-blocking: try_lock — never blocks on a
  running turn, CodeCora finding), POST /sessions/{id}/prompt
  (serialized per session — concurrent prompts get 409).
- Live E2E: health/auth-matrix (401 without/wrong token)/create/
  prompt (real provider turn)/list/status, all green.

MCP-over-HTTP on the same daemon is the remaining D3 follow-up; issue
#96 stays open for it.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant