Skip to content

fix: prevent resolver hang and add boss-supervised merge resolver#59

Merged
tensor-ninja merged 3 commits intonightshiftco:mainfrom
dipeshbabu:fix/issue-50-resolver-no-hang
Feb 15, 2026
Merged

fix: prevent resolver hang and add boss-supervised merge resolver#59
tensor-ninja merged 3 commits intonightshiftco:mainfrom
dipeshbabu:fix/issue-50-resolver-no-hang

Conversation

@dipeshbabu
Copy link
Contributor

Context

In daemon or server runs, the merge resolver can emit a question request. Since there is no interactive UI to answer questions in these modes, the session blocks until it times out. The resolver also ran as a single pass without a boss style validation loop, which could allow incomplete merge states to slip through.

What changed

  1. Auto reject question.asked events in agent sessions
    When the session stream emits question.asked for the active session, we immediately call client.question.reject(...) and continue streaming. This removes the deadlock that caused daemon timeouts in Issue Resolver agent needs boss validation and question suppression #50.

  2. Add visibility for rejected questions
    Introduces a session.question bus event and prints it in CLI output so it is clear when a question was emitted and rejected.

  3. Boss supervised merge resolver loop with deterministic completion checks
    The merge resolver now runs in a bounded loop. After each resolver pass, it checks:

    • merge is not in progress (MERGE_HEAD absent)
    • no conflict markers remain (<<<<<<<, =======, >>>>>>>)
    • working tree is clean (git status --porcelain empty)
    • no unresolved conflicted files (git diff --name-only --diff-filter=U)
      If these checks fail, a boss prompt produces concrete instructions for the next iteration. The loop is bounded by maxIterations to avoid unbounded retries.
  4. Wire boss client and eval model through resolver call sites
    Resolver is invoked with both the worker client and boss client, and uses evalModel for boss evaluation.

Why this fixes Issue #50

  • Daemon sessions no longer hang on question tool calls because they are rejected immediately.
  • Resolver completion is gated by deterministic git checks, so it cannot incorrectly report success while a merge is still in progress or conflict markers remain.

Test plan

Manual reproduction using a forced merge conflict:

  1. Create a merge conflict between two branches.

  2. Trigger the ralph resolver flow in non interactive mode.

  3. Confirm it does not hang even if a question is emitted (CLI prints auto rejected question when it happens).

  4. Verify post resolution state:

    • git rev-parse -q --verify MERGE_HEAD fails
    • git status --porcelain is empty
    • git grep -n -E '^(<<<<<<<|=======|>>>>>>>)' -- . returns no matches
    • git diff --name-only --diff-filter=U returns no files

Notes

This change is intentionally conservative. Questions are only auto rejected for the active session and do not affect interactive flows where a UI might exist.

@tensor-ninja tensor-ninja linked an issue Feb 13, 2026 that may be closed by this pull request
@dipeshbabu
Copy link
Contributor Author

@tensor-ninja I’m now capturing the ResolverResult and breaking out of the conflict loop immediately when rr.done is true, so we don’t run an extra abortMerge() and mergeMainIntoWorktree() cycle. I applied the same change in both ralph daemon and the CLI run handler.

Copy link
Collaborator

@tensor-ninja tensor-ninja left a comment

Choose a reason for hiding this comment

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

LGTM!

@tensor-ninja tensor-ninja merged commit 8bd39fa into nightshiftco:main Feb 15, 2026
5 checks passed
@dipeshbabu dipeshbabu changed the title Fix: prevent resolver hang and add boss-supervised merge resolver (#50) Fix: prevent resolver hang and add boss-supervised merge resolver Feb 15, 2026
@dipeshbabu dipeshbabu changed the title Fix: prevent resolver hang and add boss-supervised merge resolver fix: prevent resolver hang and add boss-supervised merge resolver Feb 15, 2026
@dipeshbabu dipeshbabu deleted the fix/issue-50-resolver-no-hang branch February 15, 2026 19: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.

Resolver agent needs boss validation and question suppression

2 participants