Skip to content

feat(maintenance): release or resume held follow-ups from Settings and MCP - #3427

Merged
integry merged 2 commits into
mainfrom
feat/maintenance-held-followups
Nov 9, 2026
Merged

integry merged 2 commits into
mainfrom
feat/maintenance-held-followups

Conversation

@integry

@integry integry commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Why

A follow-up handoff held for an operator blocks every later /fix, /review or follow-up on its pull request. Until now the only ways to see or settle one were the admin REST routes (/api/admin/followup-handoffs) and the propr handoffs CLI group, which the installed CLI on this host predates. #3423 sat behind a fork-publication hold for a day; every command on it waited as predecessor_awaiting_operator and nothing in the UI or MCP said so.

What

Settings → Workflow & PR Rules → Maintenance (propr-ui/src/pages/SettingsPage/MaintenanceSection.tsx). Visible only to administrators with instance.manage_runtime, like the routes. Lists every tracked handoff with status, phase, the reason it is held (in plain words for the known reasons), branch, unpublished commit, next action, task id and retained worktree path, linked to the pull request. Resume re-arms a hold and runs its keyed recovery pass; Release frees the branch. A forced release, for a worktree that still holds unpublished work, needs an explicit checkbox and the button then reads Release anyway. A refusal shows the server's reason. Client in propr-ui/src/api/followupHandoffsApi.ts.

MCP (packages/api/mcp/toolsMaintenance.ts): list_followup_handoffs, get_followup_handoff, resume_followup_handoff (optional authorizeCancelled) and release_followup_handoff (optional force). manage scope plus instance.manage_runtime, calling the same recovery entry points the routes use (ToolDeps.followupHandoffs lets tests inject them). A refusal is a failed operation receipt whose error names the recovery module's reason (HANDOFF_NOT_RELEASED, HANDOFF_NOT_RESUMED, NOT_FOUND). The retained worktree's host path is left out of MCP results (they are redacted anyway) and reported as retainedWorktree: true.

Docs: capability matrix row, a paragraph in the MCP guide, an operator workflow row, and the four operator surfaces (Settings, MCP, CLI, API) in the maintenance guide's "Stuck follow-ups settle themselves" section.

The section lives under Workflow & PR Rules rather than as a new rail category: the rail renders every category for every user, so a Maintenance category would show empty for non-administrators until the rail learns to hide categories without visible sections.

Tests

  • packages/api/test/mcpMaintenance.test.ts: permission gating before any recovery call, list/get payloads without host paths, plain release refused with the reason, forced release, not-found, resume order (resume, keyed recovery, inspect), cancellation authorization refusal.
  • propr-ui/src/pages/SettingsPage/MaintenanceSection.test.tsx: hidden for members and for admins without the runtime permission, listing, empty state, release refusal surfaced, forced release behind the checkbox, resume summary.
  • Settings page suites pass (demoViewer.test.tsx mock extended with the new section factory). mcpObservableSurface, mcpOperatorSurface, mcpDocs, mcpToolInputBudget, mcpAccessLogDispatch, followupHandoffRoutes pass.
  • mcpRequestBounds.test.ts fails identically without this change on this checkout (schema validation runs before the element budget with the installed MCP SDK); not related.

🤖 Generated with Claude Code

…d MCP

A follow-up handoff held for an operator blocks every later command on its
pull request, and until now the only ways to settle one were the admin REST
routes and a CLI release that the installed CLI did not have. integry/propr
#3423 sat behind such a hold for a day with no visible way out.

Settings → Workflow & PR Rules gains a Maintenance section (administrators
with instance.manage_runtime) that lists every tracked handoff with its
reason, branch, unpublished commit and next action, and offers Resume and
Release. A forced release, for a worktree that still holds unpublished
work, needs an explicit checkbox. Refusals show the server's reason.

MCP gains list_followup_handoffs, get_followup_handoff,
resume_followup_handoff and release_followup_handoff under the same
permission, calling the same recovery entry points as the routes. A refusal
is a failed receipt that names the reason. The retained worktree's host
path stays on the REST route and CLI; chat results are redacted anyway.

Docs: capability matrix row, MCP guide paragraph, operator workflow row, and
the four operator surfaces in the maintenance guide.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@integry integry added the AI label Nov 9, 2026
@integry

integry commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

/review

@propr-dev

propr-dev Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR adds useful UI and MCP access to existing handoff recovery operations. It needs a localized authorization fix before merge: the new MCP list exposes handoffs outside the client’s repository grant.

✅ Shared recovery semantics — Resume re-arms the handoff, runs keyed recovery, and then inspects its status using the existing recovery entry points.

✅ Explicit forced release — The UI defaults to ordinary release and requires a checkbox before sending force: true.

✅ Host-path omission — MCP payloads expose retainedWorktree without returning the retained worktree’s host path.

This review used static analysis of the supplied code; no commands or tests were run. The authoritative checks show no failures and four pending checks.

Merge blockers

Every finding below was introduced by this PR and must be resolved before merging.

F1: 🔴 Filter handoffs by repository authorization

  • Required behavior: MCP responses must respect the connected client’s repository grant and current repository access, even when the user has instance administration permission.

  • Evidence: packages/api/mcp/toolsMaintenance.ts:65–68 — list_followup_handoffs

    1. An administrator authorizes an MCP client with manage scope and access to repository A only. The instance also tracks a handoff for repository B.
    2. The client invokes list_followup_handoffs. Its empty schema supplies no args.repository, so the shared executor’s repository authorization at packages/api/mcp/toolExecution.ts:145 does not run.
    3. The new handler calls inspectFollowupHandoffs({}) without a key and returns every resulting record without consulting the principal or repository policy.
    4. The client receives B’s repository name, PR number, task identifiers, branch, commit and hold details despite B being outside its grant.

    The scope and runtime-permission checks authorize the administrative capability; they do not filter repository access. Removing host paths does not remove the remaining repository information. The added test uses one repository in both the grant and fixture, so it cannot detect this leak. The sibling get, resume and release tools supply repository and therefore receive the shared executor’s repository check.

    static trace: verified against the new list handler, the supplied executor, and inspectFollowupHandoffs, which loads all records when no key is supplied.

  • Minimum fix: Filter list results through the existing repository authorization policy for the calling principal before returning them, excluding repositories outside the grant or without current access. Add a regression with handoffs in both an authorized and an unauthorized repository.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Offer cancellation authorization in Settings

The UI’s Resume button always omits authorizeCancelled, so a cancelled handoff produces instructions to authorize cancellation without providing that control. An explicit confirmation control, or guidance to the supported MCP/CLI action, would make recovery easier. This is optional because the objective explicitly provides cancellation authorization through MCP and the UI can still release the hold.

Score

The implementation largely follows the intended workflow, but the repository-information disclosure requires correction. The focused tests cover several important paths; current checks have no reported failures, with four still pending.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 34s
  • Tokens: 63,769 (62,947 in / 822 out)
  • Cost: $0.56

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F1 S1

🤖 Review by ProPR

@integry

integry commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

/ultrafix

@propr-dev propr-dev Bot added the ultrafix label Nov 9, 2026
@propr-dev

propr-dev Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🔄 Ultrafix loop started (goal: 8/10, max cycles: 10)

First action: /fix

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ Applied the requested follow-up changes in commit 4770943

Addressed 1 AI review comment (IDs: 6729248120)

Addressed finding F1

Summary of Changes

I fixed F1: list_followup_handoffs now only returns handoffs in repositories the connected client is allowed to read. The new test passes, and it fails when the filter is taken out. One catch: CI does not run this test file at all (details below).

The fix (packages/api/mcp/toolsMaintenance.ts)

  • After loading all handoffs, the list handler runs each record's repository through the same check the shared executor uses for read tools: the repository must be in the client's grant, configured on the instance, and readable on GitHub right now.
  • A refusal (403) hides that record. Any other error is still raised, so a policy failure can't quietly empty the list.
  • Each repository is checked once per call, however many handoffs it has.
  • The tool description now says the list covers only repositories the client may access.

Sibling tools: get_followup_handoff, release_followup_handoff and resume_followup_handoff all require a repository argument, so the shared executor checks access before they run. The release and resume tools also require GitHub write access. No other new maintenance tool returns handoff data without a repository check.

Regression (packages/api/test/mcpMaintenance.test.ts)

  • The new test uses an administrator client with a narrow grant and handoffs in four repositories:
    • one fully authorized, with two pull requests.
    • one outside the grant.
    • one granted, but GitHub now denies access.
    • one granted, but not configured on the instance.
  • It asserts that only the two authorized handoffs come back, and that no name or branch from the other three appears anywhere in the result.
  • It also asserts that GitHub is called only for granted, configured repositories, once each.
  • To support this, the test's mock list of configured repositories now includes the extra repositories; the existing test is unaffected.

Verification

  • The maintenance tests (2), mcpToolInputBudget, mcpDocs, mcpObservableSurface and mcpOperatorSurface all pass: 18 of 18.
  • With the filter removed, the new test fails.
  • ESLint with --max-warnings 0 is clean, and the API typecheck shows no errors in the changed files.

Problems I found but did not fix (outside F1)

  • CI never runs mcpMaintenance.test.ts. It isn't listed in test:mcp or any other script, so the new regression and the PR's original maintenance test only protect anything once the file is added there.
  • The file hangs on its own. Run alone, the tests pass but the process never exits until the runner's timeout cancels it. The file as it was before my change does the same. Adding --test-force-exit (which the command above used) avoids it; the cause is probably a handle left open by the test setup.
  • Four type errors in the existing test body. When the file is typechecked, it reports four errors in the original test, at lines 97, 98, 140 and 144: two principal objects whose permissions type is too loose, and two calls.at(-1) lookups typed as never. My additions add none.

This change has nothing visible in the UI, so there are no previews.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 19m 52s
  • Tokens: 1,377,851 (1,377,638 in / 213 out)
  • Cost: $0.54

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 6736432714✓

…ffs in repositories the connected client is allowed to read. The new test passes, and it fails when the filter is taken out. One catch: CI does not run this test file at all (details below).

I fixed F1: `list_followup_handoffs` now only returns handoffs in repositories the connected client is allowed to read. The new test passes, and it fails when the filter is taken out. One catch: CI does not run this test file at all (details below).

**The fix (`packages/api/mcp/toolsMaintenance.ts`)**
- After loading all handoffs, the list handler runs each record's repository through the same check the shared executor uses for read tools: the repository must be in the client's grant, configured on the instance, and readable on GitHub right now.
- A refusal (403) hides that record. Any other error is still raised, so a policy failure can't quietly empty the list.
- Each repository is checked once per call, however many handoffs it has.
- The tool description now says the list covers only repositories the client may access.

**Sibling tools:** `get_followup_handoff`, `release_followup_handoff` and `resume_followup_handoff` all require a `repository` argument, so the shared executor checks access before they run. The release and resume tools also require GitHub write access. No other new maintenance tool returns handoff data without a repository check.

**Regression (`packages/api/test/mcpMaintenance.test.ts`)**
- The new test uses an administrator client with a narrow grant and handoffs in four repositories:
  - one fully authorized, with two pull requests.
  - one outside the grant.
  - one granted, but GitHub now denies access.
  - one granted, but not configured on the instance.
- It asserts that only the two authorized handoffs come back, and that no name or branch from the other three appears anywhere in the result.
- It also asserts that GitHub is called only for granted, configured repositories, once each.
- To support this, the test's mock list of configured repositories now includes the extra repositories; the existing test is unaffected.

**Verification**
- The maintenance tests (2), `mcpToolInputBudget`, `mcpDocs`, `mcpObservableSurface` and `mcpOperatorSurface` all pass: 18 of 18.
- With the filter removed, the new test fails.
- ESLint with `--max-warnings 0` is clean, and the API typecheck shows no errors in the changed files.

**Problems I found but did not fix (outside F1)**
- **CI never runs `mcpMaintenance.test.ts`.** It isn't listed in `test:mcp` or any other script, so the new regression and the PR's original maintenance test only protect anything once the file is added there.
- **The file hangs on its own.** Run alone, the tests pass but the process never exits until the runner's timeout cancels it. The file as it was before my change does the same. Adding `--test-force-exit` (which the command above used) avoids it; the cause is probably a handle left open by the test setup.
- **Four type errors in the existing test body.** When the file is typechecked, it reports four errors in the original test, at lines 97, 98, 140 and 144: two principal objects whose `permissions` type is too loose, and two `calls.at(-1)` lookups typed as `never`. My additions add none.

This change has nothing visible in the UI, so there are no previews.

PR: #3427
Comment by: @integry (ID: 6736432714)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

Merge-ready within the reviewed scope. The PR adds focused UI and MCP maintenance surfaces while reusing the existing recovery operations.

✅ Repository access filtering — MCP listing checks each repository against current policy and excludes denied repositories before returning records.

✅ Explicit force control — The UI defaults to ordinary release and requires a checkbox before sending force: true.

✅ Recovery sequencing — MCP resume re-arms the handoff, runs keyed recovery, and then inspects its resulting state.

This assessment is based on static review of the supplied diff and context. No commands were run; no current-head check runs were reported.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S2: 🟢 Clarify cancelled-work recovery in UI

MaintenanceSection.tsx always resumes without cancellation authorization, while followupHandoffsApi.ts tells users to resume with that authorization when required. Consider offering an explicit authorization control or directing users to MCP, CLI, or API. This is optional because cancellation authorization remains available through those surfaces, and the UI correctly preserves the refusal.

S3: 🟢 Show incomplete recovery outcomes

The UI resume message includes published, settled, and awaiting-operator counts but omits errors, failed-closed outcomes, and skipped recovery. Consider displaying those counters when nonzero so operators can distinguish successful settlement from an incomplete recovery pass. The refreshed handoff list already provides continued visibility, so this is a diagnostic improvement.

Score

The implementation follows the intended scope, preserves backend refusal handling, and includes targeted permission and operation tests. Static review found no merge blockers; current-head automated verification remains unreported.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 35s
  • Tokens: 61,526 (61,028 in / 498 out)
  • Cost: $0.53

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S2 S3

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 9, 2026
@integry
integry merged commit 622c553 into main Nov 9, 2026
45 checks passed
@integry
integry deleted the feat/maintenance-held-followups branch November 9, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants