Skip to content

Coordinators and waits - #515

Merged
kixelated merged 2 commits into
mainfrom
quest/m0/token-waste/coordinator-waits
Nov 7, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m0/token-waste/coordinator-waits

Conversation

@kixelated

@kixelated kixelated commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes Coordinators and waits from the token waste epic.

Summary

The audit measured polling at 6.8% of Claude Code cost (until grep ... sleep loops, sleeps, empty background waits), serial reads at 35% of turn cost, and a /quest-complete coordinator that grew to 966k context on 374 child reports of up to 37k characters.

  • quest setup (new): sets env.BASH_MAX_TIMEOUT_MS=3300000 in the user's Claude Code settings ($CLAUDE_CONFIG_DIR/settings.json, or ~/.claude/settings.json), keeping every other setting. A foreground wait can then block 55 minutes, just under the 1h cache TTL, instead of hitting the 10-minute default, so no session depends on a shell profile. Malformed settings fail before anything is written. Safe to rerun; prints each change. Documented in README and SETUP.md.
  • assets/CONTEXT.md Workspace: every turn re-sends the context, so batch independent reads, searches, and checks into one turn; name the banned wait shapes once (sleep, until/while re-check loops, timeouts far below the tool's limit, repeated status checks or output reads of a running task); a sub-agent's final report holds only what its caller acts on (PR URL, state, head, decisions with recommendations), with details in the PR body; a long-running coordinator lets compaction bound its context, keeps durable state in the forge and the quest tree, and re-reads a PR's state before acting on it.
  • /quest-complete: a sub-agent's brief names the PR's standing pick and its report repeats it, so a /quest-merge pick outlasts compaction.
  • Deletes the quest and its link from the epic.

Public API

New command quest setup. No breaking change; no wire impact.

Choices made without asking

  • quest setup overwrites a different existing BASH_MAX_TIMEOUT_MS and prints the old value, rather than keeping a custom one: a value above the TTL or far below it defeats the setting's purpose, and the user ran the command to get it.
  • quest setup only touches Claude Code. Codex has no equivalent cap on a command's timeout in its config.
  • quest setup lives in src/cli/setup.ts beside init; Rules load once adds its SessionStart hook install to the same command, so expect a conflict there resolved by merging.
  • Coordinator state rule goes in assets/CONTEXT.md next to the existing coordinator line rather than in each of /quest-complete, /quest-spawn, and /quest-afk, so it is said once. /quest-spawn keeps all its state in claim PRs already, so it needed no change.

Validation

  • quest gate just check: pass.
  • quest gate just test: pass (30 files, 1090 tests).
  • New test/setup.test.ts: missing file and directory, idempotence, keeping other settings, replacing a different cap, refusing malformed JSON, a non-object, or a non-object env without writing.

Caused by

None: new work from the token waste audit, not a fix of an earlier PR.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, high effort

Review

Rewritten by quest review after each round.

  • Reviewer: Codex, gpt-6.1-sol, high effort
  • Session: 01a1adde-1f52-7d92-95b3-fb41d99330a5, round 1
  • Head: afb31de
  • Base: origin/main at 73e0caf
  • Score: 10/10, No actionable defects were found in the specified diff; just check and just test were attempted but blocked by the read-only sandbox when the gate tried to write admission records.
  • Findings: none

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with high effort)

@pullfrog

pullfrog Bot commented Nov 5, 2026

Copy link
Copy Markdown

Pullfrog  | Review this ➔

Add `quest setup`, which sets Claude Code's BASH_MAX_TIMEOUT_MS to 55
minutes in the user's settings so a foreground wait outlasts the 10-minute
default without polling. The shared rules now name the polling shapes to
avoid, batch independent reads into one turn, cap a sub-agent's report at
what its caller acts on, and have coordinators lean on compaction with
durable state in the forge and the quest tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 5, 2026 22:40
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 97232d3d-7bc0-40c2-a5b3-4ad7be9f8cf2
Commits

Reviewing files that changed from the base of the PR and between 73e0caf and afb31de.

Files selected for processing: 9

  • README.md
  • SETUP.md
  • assets/CONTEXT.md
  • assets/skills/complete.md
  • quest/m0/token-waste/README.md
  • quest/m0/token-waste/coordinator-waits.md
  • src/cli/main.ts
  • src/cli/setup.ts
  • test/setup.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed head: afb31de

Findings: No actionable defects found. Reviewed all nine changed files, the CLI dispatch and setup implementation, settings-preservation/error/idempotence tests, and coordinator instructions. The setup command correctly bypasses repository healing; the documented overwrite of an existing timeout is deliberate.

Direction: Keep the current approach and complete the required landing checks.

Verification limits: GitHub-only static review; I did not execute tests or validate the timeout in a live Claude Code session. The PR reports local check/test passes. GitHub Check and Queue runs were skipped; Release succeeded, which is not a substitute for the merge-group checks.

(Written by unknown OpenAI model)

@kixelated
kixelated added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 43fd5f3 Nov 7, 2026
22 checks passed
@kixelated
kixelated deleted the quest/m0/token-waste/coordinator-waits branch November 7, 2026 08:11
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