Skip to content

Fix Oracle selection packaging and mutation ingress stalls#520

Merged
baron merged 7 commits into
mainfrom
rp/agent/a5e2fc64-agent
Jul 12, 2026
Merged

Fix Oracle selection packaging and mutation ingress stalls#520
baron merged 7 commits into
mainfrom
rp/agent/a5e2fc64-agent

Conversation

@provencher

Copy link
Copy Markdown
Collaborator

Summary

Fixes two related reliability failures in MCP/Agent workflows:

  1. Oracle / selection packaging

    • prevents deferred UI snapshots from overwriting newer canonical MCP selection
    • makes Context Builder discovery use the same canonical, per-tool-call selection persistence as ordinary Agent Mode
    • removes discovery-only selection roles, private revisions/CAS, and terminal selection publication
    • preserves newer canonical selection during terminal tab/UI application
  2. Mutation ingress / file-edit stalls

    • decouples applied ingress from retained derived codemap convergence
    • uses immediate path-local authority revocation for create/edit/delete/move
    • fixes retained root/path fence ordering and actor hot-spin starvation
    • makes freshness timeout cancellation-independent so blocked work returns an error instead of dropping MCP transport
    • reduces clean manifest publication from repeated full-store scans to a single reusable scan path
    • returns correlated applied/fresh mutation acknowledgements

Closes #515
Closes #390

Architecture

The final selection design intentionally avoids Context Builder-specific authority. Successful selection-changing tool calls commit canonical state immediately, and later discovery failure does not roll those writes back. Context Builder keeps only genuine lifecycle/routing behavior (run binding, frozen worktree/review context, tool policy, final prompt/meta publication).

Validation

  • Native architecture second opinion: no production blocker; direct Oracle packaging and terminal-race regressions added
  • ContextBuilderSelectionTransactionTests: 6/6
  • ContextBuilderWorkspaceContextTests: 12/12
  • ContextBuilderNestedMCPFailureTests: 2/2
  • ContextBuilderWorktreeInheritanceTests: 5/5
  • TabContextRoutingTests: 47/47
  • MCPMutationRetryableFailureTests: 13/13
  • CodemapAutomaticSelectionBasicTests: pass
  • CodemapStoreMutationTests: 3/3
  • CodeMapRootManifestStoreTests: 28/28
  • WorkspaceCodemapLocalGitClassificationTests: 10/10 plus repeated load-sensitive exact runs
  • non-cooperative freshness-timeout regression: pass
  • SwiftFormat/SwiftLint strict: pass
  • swift build --product RepoPrompt: pass after rebase
  • guardrails and commit/push secret scans: pass
  • live rpce-cli-debug Agent selection/Oracle smoke: PASS (2 total / 2 full; Oracle read RepoPromptCE and MCPFileToolProvider)
  • live mutation repro no longer drops transport; it now settles through the bounded tool contract under pathological loaded-workspace pressure

Two full root-suite attempts were run. The first exposed and led to hardening the Git-layout readiness budget. The second passed that boundary and failed only an untouched durable-artifact quarantine test, which then passed twice focused (0.023s each).

Notes

Rebased onto current origin/main. Main already contains the debug provenance JSON validator fix, so this PR carries no temporary packaging workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants