Skip to content

Improve apply_patch one-shot matching - #315

Merged
yyjeqhc merged 3 commits into
mainfrom
refactor/apply-patch-one-shot-ergonomics
Sep 5, 2026
Merged

Improve apply_patch one-shot matching#315
yyjeqhc merged 3 commits into
mainfrom
refactor/apply-patch-one-shot-ergonomics

Conversation

@yyjeqhc

@yyjeqhc yyjeqhc commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace model-facing strict_matching with explicit matching_mode={first_match,unique,exact_unique} and make unique the real default
  • add bounded Exact -> TrimEnd -> Trim -> Normalized matching while requiring the final mutation target to be unique
  • preserve stronger exact_unique stale-context/concurrency fencing and fail closed on legacy strict_matching at current Server ingress
  • make EOF eligibility, repeated-context handling, later-chunk no-backtracking, ambiguity diagnostics, and Server-derived recovery deterministic and bounded
  • add Runner capability migration, telemetry fields, and a deterministic matcher regression corpus

Safety / authority

  • whole patch remains preflighted before execution; later ambiguity is zero-write
  • SHA rechecks, rollback, project/session authority, PermissionEvaluator, stale/replacement Runner fencing, and outcome_unknown inspect-first behavior are unchanged
  • ambiguous recovery is body-free and Server-validated; Runner cannot choose arbitrary recovery paths or preferred candidates
  • old Server -> new Runner strict_matching remains wire-only compatibility; new Server rejects legacy strict_matching instead of silently weakening it

Validation

Fresh reviewer validation included:

  • cargo test -p webcodex-core apply_patch — 25 passed
  • deterministic matcher benchmark — 1 passed; 36 cases, ExactUnique 8/36 vs Unique 30/36, wrong-location writes 0, partial writes 0
  • cargo test -p webcodex-runner file_apply_patch — 17 passed
  • cargo test -p webcodex apply_patch — 23 passed
  • focused tool-contract / ToolCall tests — passed
  • cargo fmt --all -- --check — passed
  • git diff --check — passed

Product-level Go/No-Go for keeping apply_patch as the default high-frequency model edit path should still be based on fresh sf/dogfood telemetry after deployment, not the deterministic corpus alone.

@yyjeqhc
yyjeqhc merged commit 1be7eac into main Sep 5, 2026
2 checks passed
@yyjeqhc
yyjeqhc deleted the refactor/apply-patch-one-shot-ergonomics branch September 5, 2026 14:55
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.

1 participant