Skip to content

Handle coordination-backend activation for in-flight PR batches - #719

Draft
justin808 wants to merge 1 commit into
mainfrom
jg-codex/issue-455-backend-transition
Draft

justin808 wants to merge 1 commit into
mainfrom
jg-codex/issue-455-backend-transition

Conversation

@justin808

Copy link
Copy Markdown
Member

Why

In-flight batches can start under coordination_backend: n/a and later refresh onto a private backend. The preflight now reconciles that seam explicitly instead of inventing a retroactive backend history.

What changed

  • Added a focused transition replay fixture that captures the issue's original n/a workflow revision and later private-backend revision.
  • Taught completed-batch-publication-preflight to either authenticate a no-backend -> active-backend reconciliation into an explicit transition snapshot, or stop early with one precise activation blocker.
  • Preserved the original no-backend terminal handoff inside the transition record so the result cannot masquerade as native private-backend history.
  • Added a coordination-backend seam doc note and a contract-test assertion for the trusted-base refresh transition rule.

How to verify

  • ruby skills/post-merge-audit/bin/completed-batch-publication-preflight-test.rb -n '/test_trusted_base_refresh_/'
  • ruby skills/pr-batch/bin/goal-completion-contract-test.rb -n '/coordination_backend_doc_requires_explicit_transition_handoff_on_trusted_base_refresh/'
  • git diff --check
  • .agents/bin/lint (passes rubocop and markdownlint; stops because yamllint is not installed in this workspace)

Fixes #455

deferred_to_update_changelog

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Comment on lines +95 to +105
unless no_backend_evidence
return blocked_result(
"typed no-backend coordination evidence is absent or invalid",
source_input: input
)
end

authenticated_status = coordination_verifier&.call(backend:, batch_id:)
unless authenticated_status.is_a?(Hash)
return blocked_result(COORDINATION_BACKEND_ACTIVATION_BLOCKER, source_input: input)
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These two early return blocked_result(...) calls break the fail-closed-with-full-detail pattern used everywhere else in assess. Every other failure path (invalid batch_id, invalid expected_targets, coordination drift, etc.) keeps accumulating into the shared blockers array and lets the method fall through to build a complete snapshot, so a blocked receipt still reports batch_id, coordination_backend, and every blocker that was found.

Here, if no_backend_evidence or authenticated_status resolution fails, the method instead returns a bare blocked_result, which:

  • Discards any blockers already pushed earlier in this call (e.g. "publication batch id is invalid", "configured coordination backend is unavailable", or validated_target_set errors on expected_targets), replacing them with only the single new message.
  • Hardcodes batch_id/coordination_backend to nil in the returned receipt even though both were already resolved successfully at this point (batch_id on line 71-72, backend on line 68), so an auditor looking at this blocked receipt can't tell which batch/backend it was even for.

Since this is fail-closed either way (eligible stays false), it's not exploitable, but it does make this one failure mode uniquely opaque compared to every other blocked outcome in this file, and could hide unrelated pre-existing validation problems in the same request. Consider passing the already-resolved batch_id: / coordination_backend: backend into blocked_result, and/or accumulating this new blocker into blockers and letting the method continue instead of returning early.

@claude

claude Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review summary

Reviewed the new no-backend → active-backend transition handling in completed-batch-publication-preflight, its tests/fixtures, and the doc/contract-test additions.

Overall: the design is sound and fails closed — a batch that started under coordination_backend: n/a and later observes an active backend either produces an authenticated transition snapshot that preserves the original no-backend terminal handoff, or blocks with one precise repair action. valid_receipt? and reassessed_receipt_valid? are extended consistently to validate the new transition field, and the doc/contract-test additions keep the prose and code in sync.

One correctness/quality issue (left as an inline comment): the two new early return blocked_result(...) calls in the elsif transitioning_from_no_backend branch (lines 95–105) discard any blockers already accumulated earlier in the same assess call (e.g. invalid batch_id, invalid expected_targets) and hardcode batch_id/coordination_backend to nil in the returned receipt, even though both were already resolved. Every other failure path in this method instead keeps building the full snapshot and blockers list, so this makes the two new failure modes uniquely opaque compared to the rest of the file's audit receipts. Not exploitable (verdict stays BLOCKED either way), but worth aligning with the established pattern.

No other correctness, security, or performance concerns found. Nice test coverage for both the happy-path transition and the fail-closed case.

@justin808 justin808 added agent-claimed Active agent coordination claim; reconciled from private backend and removed agent-claimed Active agent coordination claim; reconciled from private backend labels Sep 3, 2026
@justin808 justin808 added complexity:complexify Adds enduring logic, modes, contracts or operational obligations; value is judged separately. P2 Useful follow-up: schedule after higher-impact work triage:reconcile Check superseded, duplicate or partly completed work; avoid another implementation lane. labels Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

complexity:complexify Adds enduring logic, modes, contracts or operational obligations; value is judged separately. P2 Useful follow-up: schedule after higher-impact work triage:reconcile Check superseded, duplicate or partly completed work; avoid another implementation lane.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle coordination-backend activation for in-flight PR batches

1 participant