Skip to content

backport: upstream #2392 — terminated session with open PR reads as merged #12

Description

@polymath-orchestrator

Problem

Upstream PR AgentWrapper/agent-orchestrator#2392 (fixes upstream AgentWrapper#2390), not yet merged upstream: deriveStatus's terminated branch returns merged whenever any owned PR was merged, even when the session still owns an open PR — contradicting the documented invariant ("merged/closed PRs only matter once no open PR remains"). Regression from the single-PR → multi-PR change.

This breaks our supervision sweep: a dead worker holding a stranded open PR reads as merged, so the orchestrator never respawns with --claim-pr and the PR rots.

How we got here

Our fork stays vanilla; useful not-yet-merged upstream PRs are backported as-is. Fork main is currently synced with upstream main.

Fix

Backport upstream PR AgentWrapper#2392 (head branch fix/terminated-status-open-pr):

git fetch upstream pull/2392/head:backport/2392

Rebase onto our main in a worktree, run backend gates, open a PR in our fork referencing the upstream PR. Tiny diff: backend/internal/service/session/status.go + status_test.go. Not on the sensitive-path list — normal autonomous merge gate applies.

Acceptance criteria

Context / pointers

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions