8 Commits

Author SHA1 Message Date
Fam Zheng
2066a727b0 fix: shared ws_tx across reconnects, workflow runs in spawned task 2026-04-06 21:08:53 +01:00
Fam Zheng
63b577ee46 fix: worker creates venv before execution, prompt enforces uv pip install 2026-04-06 20:38:20 +01:00
Fam Zheng
c56bfd9377 feat: status_reason field for workflows + proper failure logging
- Add status_reason column to workflows table (migration)
- AgentUpdate::WorkflowStatus and WorkflowComplete carry reason
- Dispatch failure logs to execution_log with reason
- Worker disconnect marks orphaned workflows as failed with reason
- All status transitions now have traceable cause
2026-04-06 20:33:41 +01:00
Fam Zheng
214d2a2338 feat: file sync from worker to server + report.md convention
- Add AgentUpdate::FileSync (base64-encoded) for file transfer
- Worker syncs all workspace files to server after workflow completes
  (skips .venv, __pycache__, .git, node_modules, files > 1MB)
- Server writes synced files to /app/data/workspaces/{project_id}/
- Remove report field from WorkflowComplete (use report.md convention)
- Update prompts: last step should generate report.md, remove KB/worker tool references
2026-04-06 19:41:17 +01:00
Fam Zheng
fc91716d83 fix: add WebSocket ping keepalive in worker (30s interval) 2026-04-06 15:56:21 +01:00
Fam Zheng
9e07880132 fix: add parse error logging in ws_worker, fix worker workdir path 2026-04-06 15:54:06 +01:00
Fam Zheng
decabc0e8a refactor: server no longer runs agent loop or LLM
- Remove agent_loop from server (was ~400 lines) — server dispatches to workers
- AgentManager simplified to pure dispatcher (send_event → worker)
- Remove LLM config requirement from server (workers bring their own via config.yaml)
- Remove process_feedback, build_feedback_tools from server
- Remove chat API endpoint (LLM on workers only)
- Remove service proxy (services run on workers)
- Worker reads LLM config from its own config.yaml
- ws_worker.rs handles WorkerToServer::Update messages (DB + broadcast)
- Verified locally: tori server + tori worker connect and register
2026-04-06 13:18:21 +01:00
Fam Zheng
e4ba385112 refactor: worker mode — server offloads all LLM/exec to worker
- Split into `tori server` / `tori worker` subcommands (clap derive)
- Extract lib.rs for shared crate (agent, llm, exec, state, etc.)
- Introduce AgentUpdate channel to decouple agent loop from DB/broadcast
- New sink.rs: AgentUpdate enum + ServiceManager + handle_agent_updates
- New worker_runner.rs: connects to server WS, runs full agent loop
- Expand worker protocol: ServerToWorker (workflow_assign, comment)
  and WorkerToServer (register, result, update)
- Remove LLM from title generation (heuristic) and template selection
  (must be explicit)
- Remove KB tools (kb_search, kb_read) and remote worker tools
  (list_workers, execute_on_worker) from agent loop
- run_agent_loop/run_step_loop now take mpsc::Sender<AgentUpdate>
  instead of direct DB pool + broadcast sender
2026-04-06 12:54:57 +01:00