Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Problem
#1383 accepted ApplyPatch and Code Mode as independent axes of one model-specific tool-protocol profile. GPT coding models trained on an ApplyPatch-style protocol should not receive Maka's Edit/Write surface at the same time, but Maka must retain one execution, permission, sandbox, and durability path.
Scope
Add a GPT-compatible apply_patch capability as an editing projection over the effective per-run tool surface from #1493.
- Extend the normalized run policy with an editing override: current Edit/Write or ApplyPatch.
- When ApplyPatch is selected, replace the equivalent Edit and Write tools; never advertise both editing protocols in one effective surface.
- Accept the Codex-compatible patch envelope with Add, Update, Delete, and Move operations.
- Reuse the existing workspace executor/filesystem worker, path containment, write locks, permission planners, sandbox policy, artifact/diff events, telemetry, and
ToolRuntimesettlement. - Expose the capability through the shared runtime and standard Desktop, CLI, and Headless composition paths. Do not add a Headless-only patch executor.
- Keep the current editing surface as the default. This issue adds an explicit per-run override but does not enable a model default.
Under CodeModeOnly, ApplyPatch is an ordinary nestable tool and is available only through exec; this issue must not depend on Code Mode to ship.
Patch semantics
- Parse and preflight the complete patch before the first workspace mutation.
- A syntax error, path violation, missing target, or hunk mismatch leaves the workspace unchanged.
- Apply writes through the existing per-path lock and permission boundary.
- Report every changed path and operation in the structured result.
- If an I/O failure occurs after mutation begins, return an explicit partial-failure result naming completed and uncompleted operations; never report silent success.
- Preserve existing line endings when updating an existing file unless the patch explicitly changes them.
- Reject absolute paths and paths that escape the effective workspace authority, including through symlinks.
Acceptance
- The effective surface contains exactly one editing protocol.
- ApplyPatch uses the same permission, sandbox, durable T1/T2, telemetry, artifact, and UI paths as existing file edits.
- Add, Update, Delete, Move, multi-file, mismatch, traversal, symlink, concurrency, and partial-I/O behavior have contract tests.
- Scoped child bindings cannot regain Edit/Write or ApplyPatch when the parent surface omitted them.
- Desktop, CLI, and Headless derive the same editing projection from the normalized policy.
- A small controlled A/B against Edit/Write holds model, prompt, task, executor, and orchestration mode constant. Record correctness, provider steps, tokens/context, environment actions, and wall time as PR evidence.
- The current editing protocol remains available as an explicit rollback.
Non-goals
- Adding Code Mode or
exec/wait. - Changing model defaults.
- Building a second workspace executor or patch-specific permission system.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
sunheyi6 commentedon Jul 28, 2026
I'd like to claim this issue and implement it as specified.
Planned scope (per the issue, no expansion):
Edit/WriteorApplyPatch, never both).apply_patchenvelope (Add / Update / Delete / Move) as a projection over the existing workspace executor, path containment, write locks, permissions, sandbox, artifact/diff events, telemetry, andToolRuntime— no second executor or Headless-only path.exec/wait, model defaults, and any patch-specific permission system.Please assign this issue to me if that works. I'll wait for assignment before opening a PR if preferred; otherwise I can start from the #1493 projection surface once the dependency is clear on
main.feat(runtime): add GPT-compatible ApplyPatch editing projection
feat(runtime): add GPT-compatible ApplyPatch editing projection
Astro-Han commentedon Aug 9, 2026
Closing as superseded by #2532, which implements the AI SDK native single-file ApplyPatch through Maka’s existing filesystem authority. User-facing availability is tracked separately in #2601. The former custom parser and editing-protocol projection are no longer planned.