Skip to content

fix interrupt latency and process-wake double turns#116

Merged
jbj338033 merged 6 commits into
mainfrom
fix/interrupt-and-process-wake
Jul 11, 2026
Merged

fix interrupt latency and process-wake double turns#116
jbj338033 merged 6 commits into
mainfrom
fix/interrupt-and-process-wake

Conversation

@jbj338033

Copy link
Copy Markdown
Collaborator

Summary

Two turn-lifecycle bugs plus the surrounding cleanup they exposed. Interrupts were ignored while a turn was parked in provider.stream(request).await (HTTP send + time-to-first-token), so pressing Esc did nothing until the request returned. And a watched background process re-woke the agent with a (process activity) turn even when the agent had already consumed that output/exit itself, because the read cursor and the watch cursor were tracked separately.

  • interrupt: race provider.stream() open against token.cancelled() in run_round/compaction so cancellation drops the in-flight request immediately.
  • process wake: unify read_cursor/watch_cursor into one seen_cursor and mark exit observed on read, so output already read via ProcessOutput never wakes a fresh turn; clarify the watch tool docs.
  • cleanup surfaced along the way: coalesce process wakes through tokio::sync::Notify, share now_ms/truncate_chars, extract the triplicated mid-turn op pump, drop top_regime's constant sandbox tuple.

Verification

  • cargo fmt --all --check — passed
  • cargo clippy -p goat-agent -p goat-tool --all-targets -- -D warnings — passed
  • cargo test -p goat-agent -p goat-tool — passed (113 + 31)

@jbj338033
jbj338033 merged commit bbcb7f4 into main Jul 11, 2026
4 of 5 checks passed
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