Skip to content

Add 'b' bump command to patch management mode#317

Merged
subsetpark merged 3 commits into
mainfrom
zax--bump
May 24, 2026
Merged

Add 'b' bump command to patch management mode#317
subsetpark merged 3 commits into
mainfrom
zax--bump

Conversation

@subsetpark
Copy link
Copy Markdown
Collaborator

@subsetpark subsetpark commented May 24, 2026

Summary

  • New b action in the Manage Patch overlay, shown only when the selected patch is in needs-intervention.
  • Clears the patch's failure counters and resets session_fallback to Fresh_available via the existing Orchestrator.reset_intervention_state (which also refreshes the base branch). No human message is required; the poller picks the patch back up on its next cycle and re-enqueues the appropriate op (Ci, Merge_conflict, etc.) naturally.
  • Refuses with a log line if the patch isn't actually in needs-intervention (e.g. raced against a state change).

Test plan

  • Drive a patch into needs-intervention (e.g. force repeated CI failures), open the Manage Patch overlay, hit b, confirm the overlay closes, the activity log shows "Bumped — cleared intervention state", and the patch resumes work on the next poll tick.
  • Open the overlay on a healthy patch; confirm the b row is absent and that pressing b logs "Cannot bump — patch is not in needs-intervention".

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.


Summary by cubic

Add a new 'b' bump command in the Manage Patch overlay to clear a patch’s intervention state and resume automated processing without a human message. The option only shows for patches in needs-intervention.

  • New Features

    • Manage overlay shows "b Bump (clear intervention, continue patch loop)" only when the selected patch is in needs-intervention.
    • On 'b', calls Orchestrator.reset_intervention_state to clear failure counters, reset session fallback, and refresh the base branch.
    • Logs "Bumped — cleared intervention state" on success, or "Cannot bump — patch is not in needs-intervention" otherwise.
  • Bug Fixes

    • Guard bump with a real-time check of the agent’s needs-intervention state to prevent race conditions.
    • Clamp manage overlay selection to a valid index so the overlay and bump target the correct patch.

Written for commit c4fdfac. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • New Features
    • Added "bump" menu entry to manage overlay for patches requiring intervention.
    • Added keyboard shortcut ('b') to bump selected patches and reset intervention state.

Review Change Stack

Lets the operator clear a patch's intervention state without sending a
human message — the poller then re-enqueues the appropriate next op on
its next cycle. Only offered in the Manage Patch overlay when the patch
is currently in needs-intervention; refuses with a log line otherwise.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

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

Project Deployment Actions Updated (UTC)
onton Ready Ready Preview, Comment May 24, 2026 6:00pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

📝 Walkthrough

Walkthrough

The PR adds a "bump" feature that lets users press 'b' to reset intervention state on patches. Changes thread a needs_intervention flag through the manage overlay signature, conditional rendering, and frame integration, while implementing the keyboard handler that triggers intervention state reset.

Changes

Bump action for intervention recovery

Layer / File(s) Summary
Manage overlay contract and conditional bump rendering
lib/tui.mli, lib/tui.ml
render_manage_overlay signature is extended with a needs_intervention: bool parameter. The function conditionally adds a "bump" menu entry when intervention is needed.
Frame integration with needs_intervention resolution
lib/tui.ml
render_frame computes needs_intervention from the currently targeted patch view and passes both automerge_enabled and the new flag to render_manage_overlay.
Bump action keyboard shortcut handler
lib/tui_fiber.ml
New input handler for 'b' key resolves the target patch, resets intervention state via orchestrator if needed, and logs the result.

Sequence Diagram

sequenceDiagram
  participant User
  participant InputHandler as Input Handler
  participant Orchestrator
  participant State
  User->>InputHandler: Press 'b' key
  InputHandler->>InputHandler: Resolve target patch from view
  alt patch needs intervention
    InputHandler->>Orchestrator: reset_intervention_state(patch)
    Orchestrator->>State: Clear intervention flag
    InputHandler->>InputHandler: Log success
  else patch not found or no intervention needed
    InputHandler->>InputHandler: Log bump not possible
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A bump upon the path so steep,
When patches need a second leap,
Press 'b' to clear the intervention's hold,
And watch the patch loop new unfold!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a 'b' bump command for patch management, which is the core feature across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zax--bump

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

Copy link
Copy Markdown

@flowglad-review-service flowglad-review-service Bot left a comment

Choose a reason for hiding this comment

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

Code Review: 1 comment

Comment thread lib/tui_fiber.ml Outdated
@flowglad-review-service
Copy link
Copy Markdown

Review Summary

This is a behavior patch. The core functionality is correct — the bump action is properly wired, needs_intervention is the right predicate, reset_intervention_state behaves as documented, and the overlay conditional rendering is consistent between tui.ml (rendering side) and tui_fiber.ml (action side).\n\nOne finding: the 'b' handler uses a separate Runtime.read followed by Runtime.update_orchestrator, creating a TOCTOU gap. The existing 'a' handler in the same match block uses the safer update_orchestrator_returning pattern that folds the check and update atomically. The gap is data-safe (the operation is idempotent) but can produce a spurious success log message.

Severity Count
Must-fix 0
Should-fix 1
Note 0

Variant: convergence-v2

Candidates: 1 | Posted: 1 | Suppressed: 0


1 comment posted · Model: claude-sonnet-4-6 (sonnet) · Tokens: 3833 in / 3031 out · Cache: 69599 created / 255337 read · Review mode: agentic · Turns: 15 · Tool calls: 24 · Forced submit: yes · Tool mix: read_file=12, search_codebase=12

@flowglad-review-service
Copy link
Copy Markdown

Review Summary

Clean delta. The 'b' handler uses the atomic update_orchestrator_returning pattern (check + update in one call), directly resolving the outstanding Turn 1 race-condition comment. The render_manage_overlay refactor correctly derives both automerge_enabled and needs_intervention from a shared target_pv without introducing new issues. No further findings.

Severity Count
Must-fix 0
Should-fix 0
Note 0

Variant: convergence-v2

Candidates: 0 | Posted: 0 | Suppressed: 0


0 comments posted · Model: claude-sonnet-4-6 (sonnet) · Tokens: 3987 in / 1406 out · Cache: 38921 created / 113636 read · Review mode: agentic · Turns: 8 · Tool calls: 5 · Tool mix: read_file=3, search_codebase=2

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/tui.ml`:
- Around line 1166-1179: The code uses the raw selected index when resolving
target_pv (match on view_mode / List.nth views selected), which can go out of
bounds if the views list shrinks; clamp selected to the valid range before any
use. Change usages that call List.nth views selected (and the subsequent
Option.value_map accesses for automerge_enabled and needs_intervention) to use a
clamped_index computed from selected and (List.length views) so List.nth is
always called with a valid index; apply the same clamping wherever selected is
used to resolve a Patch_view to avoid transient None results.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 82ba99d3-edad-4695-9c02-dd21caaa028f

📥 Commits

Reviewing files that changed from the base of the PR and between b9f08ce and b63ee23.

📒 Files selected for processing (3)
  • lib/tui.ml
  • lib/tui.mli
  • lib/tui_fiber.ml

Comment thread lib/tui.ml
@flowglad-review-service
Copy link
Copy Markdown

Review Summary

Clean push. The b handler in tui_fiber.ml directly addresses the outstanding Turn 1 concern: it folds both the needs_intervention check and the reset_intervention_state mutation into a single update_orchestrator_returning call, making them atomic under the same runtime lock — consistent with the 'a' automerge handler. The render-side refactor (target_pv extraction, index clamping, ~needs_intervention parameter) is correct and introduces no new issues. No further findings.

Severity Count
Must-fix 0
Should-fix 0
Note 0

Variant: convergence-v2

Candidates: 0 | Posted: 0 | Suppressed: 0


0 comments posted · Model: claude-sonnet-4-6 (sonnet) · Tokens: 4019 in / 1195 out · Cache: 39223 created / 114036 read · Review mode: agentic · Turns: 8 · Tool calls: 5 · Tool mix: read_file=3, search_codebase=2

@subsetpark subsetpark merged commit b1bae12 into main May 24, 2026
9 checks passed
@subsetpark subsetpark deleted the zax--bump branch May 24, 2026 18:20
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