feat(W21-MVP-3): Hermes Agent persona executor — claimed tasks produce deliverables - #263
Conversation
…e deliverables Closes Codex audit P0-#1 (W21_CODEX_COMPLETION_BACKLOG_2026-05-12.md): 'queue status can show claimed tasks, but no task deliverable is produced and no task becomes done/blocked'. The W21-A4 MVP-2 queue bridge made personas CLAIM tasks (#258). This PR makes them produce DELIVERABLES — either generating the requested handoff_path markdown or moving the task to blocked/ with an honest reason. Either outcome: the task leaves claimed/ and the orchestrator queue actually flows. Components ---------- hermes3d.services.persona_executor — new module: - classify_task(task) -> 'audit' | 'unknown' (regex on task_id + handoff_path; conservatively narrow today) - execute_one(task, workspace_root) — runs the LLM (MiniMax via the existing gateway), prepends an MVP-3 attestation header marking the doc as machine-generated + requiring operator review, writes the handoff markdown, marks done. On any failure: moves to blocked/. - execute_claimed_tasks(workspace_root) — batched wrapper, bounded by HERMES3D_PERSONA_EXEC_MAX_PER_TICK (default 2). Persona filter ensures only hermes/* claims are executed. - HERMES3D_PERSONA_EXECUTOR_DISABLED=1 honored as a fast-path no-op so tests + operators can disable without touching the poller. queue_poller integration: - tick_once() now runs heartbeats -> execute -> claim in that order so existing claims get heartbeated before potential execution moves them out of claimed/. - tick_once() return dict gains executed_done + executed_blocked. agent_queue route: - New endpoint POST /api/agents/queue/execute-now runs the executor synchronously and returns {accepted, status, results[], counts}. Operator can flush the queue without waiting for the auto-poller. Proof + safety -------------- - proof_events row written per outcome (persona_executor.task.done / persona_executor.task.blocked) with model, tokens_in/out, persona, handoff_path. Bypasses the HTTP layer so the event lands BEFORE the queue transition is finalized. - Workspace-escape guard: refuses to write handoff_path outside workspace root. - LLM timeout 30 s default (env-tunable); max-tokens 4096 default. Tests (all 57 pass on a clean run) ---------------------------------- - 10 unit: classification, blocked path, audit success, LLM failure, disabled flag, max-per-tick, persona filter (hermes/ prefix only) - 4 integration: HTTP route end-to-end with hermetic LLM stub: audit -> done with markdown on disk + queue transition, unknown -> blocked, proof_events row written, mixed batch (1 audit + 1 build). - MVP-2 regression: 3 poller tests gain HERMES3D_PERSONA_EXECUTOR_ DISABLED=1 so they stay MVP-2-scoped. Refs ---- - docs/handoffs/W21_CODEX_COMPLETION_BACKLOG_2026-05-12.md P0-#1 - docs/handoffs/W21_AUDIT_3PASS_SYNTHESIS_2026-05-12.md P0.5-A - PR #258 (MVP-2 queue bridge) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR introduces MVP-3 persona task execution: a synchronous executor that classifies claimed tasks, generates audit handoff markdown via LLM, persists proof events, integrates into the queue poller's tick cycle, and exposes an execute-now API endpoint with comprehensive test coverage. ChangesMVP-3 Persona Executor Implementation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Closes Codex audit P0-#1 (
W21_CODEX_COMPLETION_BACKLOG_2026-05-12.md):The W21-A4 MVP-2 queue bridge (#258) made personas CLAIM tasks. This PR makes them produce deliverables — either generating the requested
handoff_pathmarkdown via MiniMax, or moving the task toblocked/with an honest reason. Either way: the task leavesclaimed/and the queue actually flows.What ships
services/persona_executor.pyHERMES3D_PERSONA_EXEC_MAX_PER_TICK=2)services/queue_poller.pyexecuted_done+executed_blockedcountsapi/routes/agent_queue.pyPOST /api/agents/queue/execute-nowso operator can flush the queue synchronouslytests/unit/test_w21_mvp3_persona_executor.pytests/integration/test_w21_mvp3_queue_execute_now.pySafety
*_AUDIT_*/*_PLAN_*/*_BACKLOG_*/*_HARNESS_*/*_REVIEW_*task IDs with.mdhandoff_path are auto-executed. Everything else (build, install, configure) moves toblocked/with reasonno_automated_executor_for_task_class:unknown— operator picks it up.handoff_pathwrites refuses anything outside repo root.hermes/*claims are executed; tasks claimed by external actors (Codex sessions, etc.) are untouched.HERMES3D_PERSONA_EXECUTOR_DISABLED=1for tests + emergency operator override.Test plan
ruff check+ruff formatcleanPOST /api/agents/queue/execute-nowagainst currentclaimed/queue produces handoff for at least one W21-A* task; blocked tasks have honest reasonRules followed
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
/api/agents/queue/execute-nowendpoint to synchronously execute pending agent tasksdoneandblockedcounts for UI consumptionTests