Skip to content

Recover markerless assignment PRs safely - #3493

Draft
morganmcg1 wants to merge 1 commit into
mainfrom
agent/assignment-adoption-recovery
Draft

Recover markerless assignment PRs safely#3493
morganmcg1 wants to merge 1 commit into
mainfrom
agent/assignment-adoption-recovery

Conversation

@morganmcg1

Copy link
Copy Markdown
Member

Summary

  • add an explicit advisor/operator-only adopt_assignment transition for an existing markerless assignment PR
  • verify the authenticated PR author, configured routing, exact branch point, remote head ancestry, and absence of conflicting protocol state before and after adoption
  • make successful adoption idempotent when a student legitimately advances the branch
  • emit malformed_assignment to advisors and count only marker-valid assignments as active or duplicate work
  • expose create-assignment and adopt-assignment through one operator CLI that calls the same typed executors as OpenHands
  • clarify that repair_assignment_routing repairs labels and draft state only; it cannot create assignment identity

Root cause

An operator-created PR could receive the normal student and WIP labels while bypassing create_assignment, leaving it without the canonical assignment marker. Students detected the invalid state, but advisors neither received that failure nor had a safe operation to adopt the PR. Raw labels also made the malformed PR appear to occupy a healthy student slot.

This change keeps the harness boundary narrow: it validates identity and routing, reports invalid state, and offers one explicit repair operation. It does not infer assignments from prose or automatically mutate malformed PRs.

Safety and recovery behavior

  • adoption is advisor-only and restricted to configured students and the configured advisor base
  • the PR must be authored by the authenticated actor, open, draft, WIP, uniquely routed, and markerless
  • the supplied base must be the exact merge base of the advisor and assignment branches, not merely an older ancestor
  • the expected head may be an ancestor only when reconciling a replay after legitimate student progress; the first marker write still requires the exact current PR head
  • remote Git history is checked both before and after the marker transition
  • terminal result/disposition state and conflicting markers fail closed
  • the existing human-readable PR body and unrelated labels are preserved
  • GitHub PR body writes have no lease in this client, so concurrent body edits remain explicitly unsupported and documented

Validation

  • uv run --extra dev pytest -q --maxfail=1 — 926 passed, 6 skipped
  • git diff --check
  • python -m compileall -q senpai_agent

This PR is intentionally not rolled out to any live advisor or student deployment. It also does not perform the one-time repair for the existing Maple PRs.

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