feat: wire cost mode enforcement + poll_tasks spawn path #71

Merged
clawdie merged 1 commit from feat/cost-enforcement-pi-spawn into main 2026-06-14 17:25:53 +02:00
Owner

Implements priorities 2 and 3 from PRIORITY-HANDOFF-ISO-SPAWN-COST.md.

Priority 3 — Cost mode enforcement:

  • Cost mode string is single source of truth (removed session_max_bytes/max_uncompacted_turns from DaemonConfig)
  • Per-append compaction, background rotation, tool result compaction, prompt trimming all derive from CostMode
  • auto_escalate() wired into session_rotation()
  • set-cost-mode socket command actually works now (RwLock runtime cost mode)

Priority 2 — Pi spawn path:

  • poll_tasks() spawns agents for claimed tasks (was a stub)
  • End-to-end integration test proves: task → claim → spawn → glasspane lifecycle (Idle→Working→Blocked→Done)

Gates: fmt/clippy/test all green. (Sam & Hermes)

Implements priorities 2 and 3 from PRIORITY-HANDOFF-ISO-SPAWN-COST.md. **Priority 3 — Cost mode enforcement:** - Cost mode string is single source of truth (removed session_max_bytes/max_uncompacted_turns from DaemonConfig) - Per-append compaction, background rotation, tool result compaction, prompt trimming all derive from CostMode - auto_escalate() wired into session_rotation() - set-cost-mode socket command actually works now (RwLock runtime cost mode) **Priority 2 — Pi spawn path:** - poll_tasks() spawns agents for claimed tasks (was a stub) - End-to-end integration test proves: task → claim → spawn → glasspane lifecycle (Idle→Working→Blocked→Done) Gates: fmt/clippy/test all green. (Sam & Hermes)
clawdie added 1 commit 2026-06-14 17:25:40 +02:00
feat: wire cost mode enforcement + poll_tasks spawn path (Sam & Hermes)
Some checks failed
CI / rust (pull_request) Has been cancelled
CI / markdown (pull_request) Has been cancelled
9d443a498c
Priority 3 — Cost mode enforcement:
- Removed session_max_bytes/max_uncompacted_turns from DaemonConfig; cost
  mode string is now the single source of truth for all thresholds
- maybe_compact_or_rollover() derives thresholds from CostMode, not static
  config fields
- compact_oldest_turns() takes a keep parameter (derived from cost mode)
- compact_tool_result() wired into build_prompt_messages() — tool results
  are truncated when cost mode says to compact
- trim_to_budget() called in build_prompt_assembly()
- auto_escalate() wired into session_rotation() — escalates cost mode
  when compaction is insufficient
- set-cost-mode socket command now updates runtime cost_mode (RwLock on
  DaemonState) instead of just acknowledging

Priority 2 — Pi spawn path end-to-end:
- poll_tasks() now queries claimed tasks, spawns the configured agent
  binary (COLIBRI_AGENT_BINARY), creates a session, wires stdout to
  glasspane, and transitions the task to Started
- stream_agent_stdout_to_glasspane made pub for cross-module access
- poll_tasks called from scheduler_tick_fn after the scheduler runs
- New integration test: poll_tasks_spawns_agent_for_claimed_task validates
  the full path: create task → claim → poll_tasks spawns → glasspane
  observes Idle → Working → Blocked → Done lifecycle

Gates: fmt/clippy/test all green (207 tests, 0 failures).
clawdie merged commit 4e1437ae9d into main 2026-06-14 17:25:53 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: clawdie/colibri#71
No description provided.