Skip to content

feat(panel): --allow-fresh flag + fix cube feedback stdin double-read#185

Merged
jacsamell merged 1 commit into
mainfrom
feat/allow-fresh-and-feedback-stdin
May 19, 2026
Merged

feat(panel): --allow-fresh flag + fix cube feedback stdin double-read#185
jacsamell merged 1 commit into
mainfrom
feat/allow-fresh-and-feedback-stdin

Conversation

@jacsamell
Copy link
Copy Markdown
Contributor

@jacsamell jacsamell commented May 19, 2026

Two fixes batched into one PR.

1. --allow-fresh CLI flag on cube peer-review and cube pr-review (alias prv). Soft-fall-through to fresh for judges with missing/stale sessions instead of hard-crashing the whole panel. Default stays hard-crash so cube state-management bugs surface loudly; operators opt in when they already know the sessions are dead. Plumbs through launch_judge_panelpeer_review_command_run_pr_review_run_branch_review.

2. cube feedback /dev/stdin <<EOF no-op fix. Typer consumed stdin during arg parsing; feedback_path.read_text() then saw EOF and sent codex an empty prompt. Special-case /dev/stdin and - to drain sys.stdin once into a temp file. Errors loud on empty input.

Test plan

  • cube prv <pr> --allow-fresh against a task with deleted/stale session files — proceeds with that judge fresh, others resume
  • cube prv <pr> without the flag — still hard-crashes on missing session (default behavior preserved)
  • cube feedback writer-a my-task /dev/stdin <<EOF ... EOF — codex actually receives the heredoc content
  • All 237 tests pass (verified locally)

Overview

This PR adds two independent features to improve panel reliability and feedback UX:

1. --allow-fresh Flag

Adds optional --allow-fresh to cube peer-review and cube pr-review (alias prv) commands. When enabled, judges with missing or stale session files soft-fall through to launching a fresh instance instead of hard-crashing the entire panel. Default remains strict (hard-crash) to surface state-management bugs; operators opt in when expecting dead sessions. The flag threads through: CLI → peer_review_command / pr_review_cmd_run_pr_review / _run_branch_reviewlaunch_judge_panel.

2. Feedback stdin Double-Read Fix

Fixes silent no-op when running cube feedback writer-a task /dev/stdin <<EOF ... EOF. Typer's argument parsing consumes stdin during setup, leaving subsequent reads seeing EOF. Now special-cases /dev/stdin and - to drain remaining sys.stdin into a temporary file under .prompts/, with loud error on empty input to surface the issue immediately.

Files Modified

  • judge_panel.py: launch_judge_panel() gains allow_fresh parameter with conditional soft-fall-through logic
  • cli.py: Adds --allow-fresh option to peer-review and pr-review command definitions
  • peer_review.py: Threads allow_fresh through peer_review_command(), _run_pr_review(), _run_branch_review()
  • feedback.py: Detects stdin paths and buffers content to temp file before processing

Test Coverage

Existing test suite (237 tests) passes. Test test_run_judge_retries_fresh_when_saved_session_missing validates judge retry logic with missing sessions.

Review Change Stack

Two fixes batched:

1. --allow-fresh CLI flag on 'cube peer-review' and 'cube pr-review' (alias prv). Soft-fall-through to fresh for judges with missing/stale sessions instead of hard-crashing. Default stays hard-crash so cube state bugs surface loudly; operators opt in when they know sessions are dead. Plumbs through launch_judge_panel -> peer_review_command -> _run_pr_review -> _run_branch_review.

2. 'cube feedback /dev/stdin <<EOF' was silently no-op'ing because typer consumed stdin during arg parsing, then feedback_path.read_text() saw EOF and codex got an empty prompt. Special-case /dev/stdin and - to drain sys.stdin once into a temp file. Errors loud on empty input.
@jacsamell jacsamell merged commit a2b0ed5 into main May 19, 2026
0 of 2 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 463c1c16-d717-43bd-b97d-a599bd557262

📥 Commits

Reviewing files that changed from the base of the PR and between a3ed1c0 and 5495f6c.

📒 Files selected for processing (4)
  • python/cube/automation/judge_panel.py
  • python/cube/cli.py
  • python/cube/commands/feedback.py
  • python/cube/commands/peer_review.py

Walkthrough

This pull request introduces an allow_fresh parameter to gracefully recover from stale judge sessions during panel resume, adds CLI options and end-to-end wiring to expose this feature, and separately adds stdin support to feedback submission.

Changes

Allow-fresh graceful judge panel resume

Layer / File(s) Summary
Judge panel allow-fresh fallback logic
python/cube/automation/judge_panel.py
launch_judge_panel now accepts allow_fresh: bool = False and conditionally starts a judge fresh (by clearing session_id) when session loading fails, instead of raising immediately.
CLI option declaration for peer-review and pr-review commands
python/cube/cli.py
New --allow-fresh boolean option added to both peer-review and pr-review commands with descriptive help text. The pr-review docstring is updated with a usage example.
CLI argument propagation to peer_review_command
python/cube/cli.py
All peer-review and pr-review CLI code paths (GitHub PR mode, local/branch mode, and default PR mode) now pass allow_fresh through to underlying peer_review_command calls.
Command layer threading through peer_review_command and sub-functions
python/cube/commands/peer_review.py
peer_review_command exposes allow_fresh and forwards it to _run_pr_review, _run_branch_review, and all launch_judge_panel calls across single-judge, fresh, and resume execution paths.

Stdin feedback submission support

Layer / File(s) Summary
Stdin input and temporary file handling in feedback_command
python/cube/commands/feedback.py
When feedback_file is /dev/stdin or -, the function reads remaining stdin content, validates it is non-empty, writes it to a temporary markdown file under .prompts/ using task_id, and uses that path for submission. Non-stdin inputs follow existing resolve_path() logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • aetheronhq/agent-cube#177: Modifies session resume fallback in judge_panel.py to tolerate missing judge sessions instead of crashing, complementary to the new allow_fresh graceful handling.
  • aetheronhq/agent-cube#175: Updates the PR peer-review workflow in peer_review.py to verify worktree HEAD matches PR head, affecting the same judge panel launch entry points.
  • aetheronhq/agent-cube#153: Extends the shared peer_review_command interface in the same CLI and command modules, adding parameter-threading patterns similar to allow_fresh.

Poem

🐰 A rabbit's ode to fresh starts

When sessions grow stale and panels won't wake,
A gentle fallback is all that it takes—
With allow_fresh set, judges start anew,
And feedback flows freely through stdin too! 🎯


Comment @coderabbitai help to get the list of available commands and usage tips.

@jacsamell jacsamell deleted the feat/allow-fresh-and-feedback-stdin branch May 19, 2026 22:46
jacsamell added a commit that referenced this pull request May 20, 2026
…l delete (#195)

PR #185 added --allow-fresh which auto-falls-through stale judge sessions without nuking the panel state or making the operator hand-delete files. Old advice predates that flag and tells operators to delete sessions + use --fresh (heavier). Updated to recommend --allow-fresh as the primary remedy in both drift and missing-session messages.
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