Skip to content

fix(goals): keep goal identity through retries, recovery and accounting - #272

Merged
BunsDev merged 1 commit into
mainfrom
d/enh/goal-callers
Oct 15, 2026
Merged

BunsDev merged 1 commit into
mainfrom
d/enh/goal-callers

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 15, 2026

Copy link
Copy Markdown
Member

Summary

A goal keeps its identity through retries, rate-limit recovery, session persistence and accounting. A retry no longer re-sends for a goal that was replaced mid-turn, and a turn that never reached the provider is rolled back rather than left in the session.

Context

  • Related request: Coven Code enhancement cycle, Unit 8b ("Unit8b accepted locally after spec, quality and parent gates" in the enhancement acceptance ledger). Follows Unit 8a (dispatch fences).
  • Scope (the eleven approved owners):
    • crates/commands/src/lib.rs, crates/query/src/goal_loop.rs, crates/core/src/goal.rs;
    • crates/cli/src/main.rs and new goal_dispatch_tests.rs;
    • crates/tui/src/{app,rate_limit_recovery}.rs;
    • crates/api/src/{provider,lib}.rs and the Codex and Claude CLI providers.
  • Non-goals: no product capability is removed. Live provider, native and human acceptance are not claimed.

Changes

  • Goal commands keep their captured authority in the payload.
  • Attempt state is per captured logical turn: retries and their child and housekeeping work share it, while each continuation gets fresh state. Old background children can't mark a later synthetic UUID.
  • Providers mark a request as attempted at the transport, and a turn that never reached a provider is rolled back, including its persisted UUID.
  • Rate-limit recovery opens only from the joined outcome. The abandoned owner is kept until that outcome is gated and the transcript is synchronized.
  • Interactive launches go through InteractiveTurn and InteractiveQuery.
  • Port note (remote control): fix(cli): queue remote prompts instead of dropping or overlapping turns #226 gave remote prompts their own FIFO, deliberately kept off the local Enter path. This PR keeps that ownership, applies this unit's launch mechanics (rollback, recovery dismissal, typed turn and query) to the shared remote launch, and treats a pending file-injection decision as busy, so remote prompts wait in their queue instead of entering queued_messages.

Validation

  • RED (accepted 8a base): the command payload lost its captured authority. A retry sent 2 rate-limit requests after replacement vs 1 expected, an owned unattempted UUID remained after a real JSON reload, and the Codex refresh+model fixture left request_attempted=false.
  • On this branch (this unit on current main, with Units 4–8a landed): cargo test --locked -p claurst --bin coven-code 135 passed (includes goal_dispatch_tests). claurst-tui lib 741, claurst-commands lib 140, claurst-query lib 215, claurst-api lib 75, claurst-core lib 695, each plus its suites: 0 failed.
  • python3 scripts/test_remote_prompt_queue.py --expect-startup-cancellation <debug coven-code> on this branch: both cases pass, with sequential turns, the literal /exit, and the cancelled request closed before headers.
  • cargo fmt --all -- --check, cargo check --workspace --locked, cargo clippy --workspace --all-targets --locked -- -D warnings: pass.
  • git diff --check: clean.
  • Accepted source: workspace 2,339 passed, 0 failed, 7 ignored, plus 48/0/0 terminal. The spec reviewer's exact-binary terminal run passed 5/0 (A429→B retries send one request each).
  • cargo test --workspace and the interactive terminal suite on this branch: hosted CI.
  • Independent spec and quality reviews passed with no required findings.

PR Readiness

  • Diff is limited to the unit's eleven owners.
  • Generated files were not edited by hand.
  • User-facing docs: not needed.
  • No secrets, credentials, local paths, or unrelated logs are included.
  • Remaining risks: the remote-control merge with fix(cli): queue remote prompts instead of dropping or overlapping turns #226 was verified with the automated queue fixture only, not a live remote service.

Goal-bearing commands lost their captured authority in the payload,
rate-limit and transport retries could re-send after the goal was
replaced, an unattempted turn's UUID stayed in the persisted session,
and old background children could mark a later turn. Track attempt
state per captured logical turn (retries and their child/housekeeping
work share it; each continuation gets fresh state), mark requests as
attempted at the transport, roll back a turn that never reached a
provider, and open rate-limit recovery only from the joined outcome,
retaining the abandoned owner until its outcome is gated. Interactive
launches go through InteractiveTurn/InteractiveQuery.

The remote-control launch keeps #226's queue ownership: remote prompts
stay in their own FIFO (never the local Enter path) and also wait while
a file-injection decision is pending.

Enhancement unit 8b.

Coven-Harness: Claude Code / claude-opus-5-5
@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 15, 2026 12:31pm UTC

Request Review

@BunsDev
BunsDev merged commit 8cb102c into main Oct 15, 2026
6 checks passed
@BunsDev
BunsDev deleted the d/enh/goal-callers branch October 18, 2026 07:49

This branch was successfully deployed

1 active deployment
Preview — ea6649db Deployed Oct 15, 2026 by vercel[bot]
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