diff --git a/docs/environment-variables.md b/docs/environment-variables.md index c7892bd05..3c89143a5 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -287,7 +287,6 @@ Extra conditional behavior: | `OLLAMA_BASE_URL` | Default implicit Ollama discovery base URL override (`http://127.0.0.1:11434` if unset) | | `LLAMA_CPP_BASE_URL` | Default implicit Llama.cpp discovery base URL override (`http://127.0.0.1:8080` if unset) | | `PI_EDIT_VARIANT` | Forces edit tool variant when valid (`patch`, `replace`, `hashline`, `atom`, `vim`, `apply_patch`) | -| `PI_STRICT_EDIT_MODE` | If truthy, disables automatic edit-mode fallback | | `PI_FORCE_IMAGE_PROTOCOL` | Forces supported image protocol (`kitty`, `iterm2`/`iterm`, `sixel`, `none`) where used | | `PI_ALLOW_SIXEL_PASSTHROUGH` | Allows SIXEL passthrough when `PI_FORCE_IMAGE_PROTOCOL=sixel` | | `PI_NO_PTY` | If `1`, disables interactive PTY path for bash tool | diff --git a/packages/coding-agent/src/utils/edit-mode.ts b/packages/coding-agent/src/utils/edit-mode.ts index 515a47d1a..eb20a0cba 100644 --- a/packages/coding-agent/src/utils/edit-mode.ts +++ b/packages/coding-agent/src/utils/edit-mode.ts @@ -1,4 +1,4 @@ -import { $env, $flag } from "@oh-my-pi/pi-utils"; +import { $env } from "@oh-my-pi/pi-utils"; export type EditMode = "replace" | "patch" | "hashline" | "vim" | "apply_patch" | "atom"; @@ -38,13 +38,11 @@ export function resolveEditMode(session: EditModeSessionLike): EditMode { const envMode = normalizeEditMode($env.PI_EDIT_VARIANT); if (envMode) return envMode; - if (!$flag("PI_STRICT_EDIT_MODE")) { - if (activeModel?.includes("spark")) return "apply_patch"; - if (activeModel?.includes("nano")) return "replace"; - if (activeModel?.includes("mini")) return "replace"; - if (activeModel?.includes("haiku")) return "replace"; - if (activeModel?.includes("flash")) return "replace"; - } + if (activeModel?.includes("spark")) return "apply_patch"; + if (activeModel?.includes("nano")) return "replace"; + if (activeModel?.includes("mini")) return "replace"; + if (activeModel?.includes("haiku")) return "replace"; + if (activeModel?.includes("flash")) return "replace"; const settingsMode = normalizeEditMode(String(session.settings.get("edit.mode") ?? "")); return settingsMode ?? DEFAULT_EDIT_MODE; diff --git a/packages/coding-agent/test/edit-mode.test.ts b/packages/coding-agent/test/edit-mode.test.ts index 80be6f54a..0da79f516 100644 --- a/packages/coding-agent/test/edit-mode.test.ts +++ b/packages/coding-agent/test/edit-mode.test.ts @@ -2,7 +2,6 @@ import { afterEach, describe, expect, test } from "bun:test"; import { type EditMode, type EditModeSessionLike, resolveEditMode } from "@oh-my-pi/pi-coding-agent/utils/edit-mode"; const originalEditVariant = Bun.env.PI_EDIT_VARIANT; -const originalStrictEditMode = Bun.env.PI_STRICT_EDIT_MODE; function restoreEnv(): void { if (originalEditVariant === undefined) { @@ -10,11 +9,6 @@ function restoreEnv(): void { } else { Bun.env.PI_EDIT_VARIANT = originalEditVariant; } - if (originalStrictEditMode === undefined) { - delete Bun.env.PI_STRICT_EDIT_MODE; - } else { - Bun.env.PI_STRICT_EDIT_MODE = originalStrictEditMode; - } } function createSession(args: { @@ -38,26 +32,23 @@ describe("resolveEditMode", () => { test("defaults Spark models to apply_patch mode", () => { delete Bun.env.PI_EDIT_VARIANT; - delete Bun.env.PI_STRICT_EDIT_MODE; expect(resolveEditMode(createSession({ activeModel: "openai-codex/gpt-5.3-codex-spark" }))).toBe("apply_patch"); }); test("keeps explicit model variants ahead of Spark fallback", () => { delete Bun.env.PI_EDIT_VARIANT; - delete Bun.env.PI_STRICT_EDIT_MODE; expect( resolveEditMode(createSession({ activeModel: "openai-codex/gpt-5.3-codex-spark", modelVariant: "replace" })), ).toBe("replace"); }); - test("strict edit mode disables Spark fallback", () => { + test("keeps model-specific fallbacks ahead of settings mode", () => { delete Bun.env.PI_EDIT_VARIANT; - Bun.env.PI_STRICT_EDIT_MODE = "1"; expect( resolveEditMode(createSession({ activeModel: "openai-codex/gpt-5.3-codex-spark", settingsMode: "hashline" })), - ).toBe("hashline"); + ).toBe("apply_patch"); }); }); diff --git a/scripts/edit-benchmark.py b/scripts/edit-benchmark.py index 86d1926dc..6ed967d8c 100755 --- a/scripts/edit-benchmark.py +++ b/scripts/edit-benchmark.py @@ -58,7 +58,7 @@ def build_spec(variant: str) -> BenchmarkSpec: description=f"Benchmark edit tool in {variant} mode across models with simple edit tasks.", workspace_prefix=f"{variant}-benchmark", tools=("edit", "read"), - env={"PI_EDIT_VARIANT": variant, "PI_STRICT_EDIT_MODE": "1"}, + env={"PI_EDIT_VARIANT": variant}, initial_prompt=prompt, retry_instruction=retry, ) diff --git a/scripts/rate-edit-tool.py b/scripts/rate-edit-tool.py index 0142dc330..915ed2f74 100755 --- a/scripts/rate-edit-tool.py +++ b/scripts/rate-edit-tool.py @@ -1632,7 +1632,6 @@ def run_model_sync( executable=omp_bin, model=model, cwd=workspace, - env={"PI_STRICT_EDIT_MODE": "1"}, thinking="high", tools=TOOL_WHITELIST, no_skills=True, @@ -1852,7 +1851,6 @@ def run_oracle_review_sync( executable=omp_bin, model=model, cwd=results_dir, - env={"PI_STRICT_EDIT_MODE": "1"}, thinking="high", tools=(), no_skills=True,