Skip to content

pitboss: sweep system#10

Merged
elicpeter merged 14 commits into
mainfrom
pitboss/play/20260501T164439Z
May 1, 2026
Merged

pitboss: sweep system#10
elicpeter merged 14 commits into
mainfrom
pitboss/play/20260501T164439Z

Conversation

@elicpeter
Copy link
Copy Markdown
Owner

This pull request introduces a major new feature to the Pitboss CLI: deferred-item sweeps, which allow the system to automatically or manually address lingering items in the deferred backlog between plan phases. It also adds new CLI flags for sweep control, documents the sweep process in detail, and refactors exit code handling for consistency across subcommands. The changes update both the codebase and documentation to support and explain these new capabilities.

Key changes:

1. Deferred-item sweeps (core feature):

  • Implements automatic and manual sweep functionality to drain the deferred.md backlog between plan phases, with configurable thresholds, caps, escalation, and audit integration. Sweeps can also be triggered or suppressed via CLI flags. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

2. CLI enhancements and sweep control:

  • Adds pitboss sweep subcommand for one-shot sweeps, and new --sweep and --no-sweep flags to pitboss play and pitboss rebuy for controlling sweep behavior per run. Updates CLI argument parsing and runner logic accordingly. [1] [2] [3] [4] [5] [6] [7]

3. Documentation and configuration:

  • Expands the README.md with a comprehensive section on sweeps, including rationale, workflow, configuration options, and manual override instructions. Documents new [sweep] config block in example configs. [1] [2] [3] [4]

4. Exit code refactor:

  • Centralizes exit code definitions in a new src/cli/exit_code.rs module, ensuring consistent semantics and numeric values across all subcommands (including sweep). Updates usage throughout CLI dispatch. [1] [2] [3] [4]

5. Miscellaneous improvements:

  • Adds strum dependency for enum utilities. Updates status reporting to include sweep-related information and stale item display cap. [1] [2] [3]

These changes collectively make deferred backlog management a first-class, configurable, and well-documented part of the Pitboss workflow, improving both automation and operator control.

…ode::Failure` to `ExitCode::MixedFailures` in the sweep subcommand
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class “deferred sweep” support to Pitboss, enabling automatic/manual backlog-draining passes between phases (and after the final phase), with new CLI controls, status/TUI visibility, prompt templates, and centralized exit code semantics.

Changes:

  • Introduces sweep trigger + staleness tracking (per-item attempt counters, stale-item events/caps) and a bounded final-sweep drain loop.
  • Adds pitboss sweep plus --sweep/--no-sweep overrides for play/rebuy, and expands prompts/docs to describe sweep behavior and invariants.
  • Refactors exit codes into a shared src/cli/exit_code.rs and updates CLI/subsystems to use it consistently.

Reviewed changes

Copilot reviewed 41 out of 42 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/cli/sweep.rs New pitboss sweep subcommand wiring a standalone sweep into the runner.
src/runner/sweep.rs Pure sweep trigger helpers + staleness-map update logic (incl. threshold-crossing detection).
src/config/mod.rs Adds [sweep] config block, defaults, validation, and unknown-key detection.
src/state/mod.rs Extends RunState with sweep-related persistence fields and legacy deserialization coverage.
src/cli/mod.rs Adds Sweep command and --sweep/--no-sweep flags to play/rebuy dispatch.
src/cli/status.rs Extends status report with a “Sweep” block and stale-item rendering.
src/prompts/mod.rs + templates/snapshots Adds sweep implementer/auditor/fixer templates, stale-item rendering, and snapshots/tests.
tests/*sweep*.rs, tests/cli_*.rs Broad integration coverage for sweep boundaries, auditor behavior, staleness, final-loop draining, and CLI plumbing.
src/cli/exit_code.rs + src/grind/budget.rs Centralizes exit codes and re-exports for compatibility.
README.md Documents sweep rationale, workflow, overrides, and config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cli/sweep.rs
Comment thread src/cli/sweep.rs
Comment thread src/cli/status.rs
… by synthesizing in-memory state and ensuring branch consistency; update documentation for clarity on state persistence during halts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 41 out of 42 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/grind_parallel.rs Outdated
// overlap assertion is the real correctness gate: in a serialized
// dispatch overlap is zero, so requiring overlap ≥ session_sleep / 2
// already rules out the regression the elapsed bound was guarding.
let _ = elapsed;
Comment thread src/cli/mod.rs Outdated
Comment on lines +125 to +126
/// `deferred.md` by hand. See `[sweep]` in `pitboss.toml` for the
/// thresholds the override bypasses.
Comment thread src/cli/sweep.rs Outdated
Comment on lines +178 to +187
// Persist state.json only when a real run is in flight. The runner
// honors `persist_state` on its success path; we mirror that on the
// halt path so a halted sweep can be retried. When `state_existed`
// is false the synthesized state was in-memory bookkeeping only and
// never touches disk.
if state_existed {
if let Err(e) = state::save(&workspace, Some(runner.state())) {
eprintln!("[pitboss] failed to persist state.json after sweep: {e:#}");
}
}
…d sweeps and enhance error handling for state saving; ensure proper cleanup of resources after execution
@elicpeter elicpeter merged commit e8156a8 into main May 1, 2026
10 checks passed
@elicpeter elicpeter deleted the pitboss/play/20260501T164439Z branch May 1, 2026 23:42
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.

2 participants