Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: decline counts only as the last step; engine ux3-cmd4

Samrat Talukdar2a144ba83ec2
diff --git a/apps/app/src/app/lib/good-session.ts b/apps/app/src/app/lib/good-session.ts
index d66a5015..22dc7583 100644
--- a/apps/app/src/app/lib/good-session.ts
+++ b/apps/app/src/app/lib/good-session.ts
@@ -882,7 +882,8 @@ function turnEndOf(turn: readonly UIMessage[], last: UIMessage): TurnEnding {
afterLastTool = false;
finalText = "";
if (value.state === "input-streaming" || value.state === "input-available") unfinished = true;
- else if (value.state === "output-error" && str(value.errorText).startsWith(DECLINED_TOOL)) declined = true;
+ // Only the turn's last tool call counts: a decline the model went on from is no stop.
+ declined = value.state === "output-error" && str(value.errorText).startsWith(DECLINED_TOOL);
} else if (part.type === "text" && str(value.text).trim()) {
afterLastTool = true;
finalText = str(value.text);
diff --git a/apps/app/tests/good-session.test.tsx b/apps/app/tests/good-session.test.tsx
index 49340111..a8b9a70c 100644
--- a/apps/app/tests/good-session.test.tsx
+++ b/apps/app/tests/good-session.test.tsx
@@ -724,6 +724,9 @@ describe("the server's auto-retry and one-more-turn nudge", () => {
const facts = messageFacts([prompt(), assistant("a1", [declined], { finish: "tool-calls" })]);
expect(facts.ended).toBe("stopped");
expect(autoRetryMessage({ ...base, ended: facts.ended, retryable: facts.retryable })).toBeNull();
+ // A decline the model went on from (with feedback) and then ran another tool: no stop.
+ const goneOn = messageFacts([prompt(), assistant("a3", [tool("bash", { command: "git push" }, "output-error", "The user rejected permission to use this specific tool call with the following feedback: no"), tool("bash", { command: "ls" }, "output-available", "x")], { finish: "tool-calls" })]);
+ expect(goneOn.ended).not.toBe("stopped");
// Any other failed tool call that cut the chain is still retried once.
const failed = messageFacts([prompt(), assistant("a2", [tool("bash", { command: "make" }, "output-error", "exit 2")], { finish: "tool-calls" })]);
expect(autoRetryMessage({ ...base, ended: failed.ended, retryable: failed.retryable })).toBe("Continue.");
diff --git a/apps/app/tests/permission-approval-shortcuts.test.tsx b/apps/app/tests/permission-approval-shortcuts.test.tsx
index bf3a74a0..d6b34e6a 100644
--- a/apps/app/tests/permission-approval-shortcuts.test.tsx
+++ b/apps/app/tests/permission-approval-shortcuts.test.tsx
@@ -28,6 +28,14 @@ function pendingPermission(id = "permission-1"): PendingPermission {
const mounted: { root: Root; container: HTMLElement }[] = [];
+// The card counts keys only PERMISSION_SHORTCUT_ARM_MS after it appeared and after the last key.
+let clockOffset = 0;
+const realNow = Date.now.bind(Date);
+Date.now = () => realNow() + clockOffset;
+const advance = (ms = 700) => {
+ clockOffset += ms;
+};
+
async function mount(props: { busy?: boolean; id?: string } = {}) {
const replies: string[] = [];
const container = document.createElement("div");
@@ -59,12 +67,18 @@ afterEach(async () => {
});
test("Y allows once, A allows for the chat, N and Escape deny", async () => {
- for (const [key, reply] of [["y", "once"], ["Y", "once"], ["a", "always"], ["n", "reject"], ["Escape", "reject"]] as const) {
- const { replies } = await mount({ id: `p-${key}` });
- await press(key);
- expect({ key, replies }).toEqual({ key, replies: [`p-${key}:${reply}`] });
+ for (const [keys, reply] of [[["y"], "once"], [["Y"], "once"], [["a", "y"], "always"], [["a", "Enter"], "always"], [["n"], "reject"], [["Escape"], "reject"]] as const) {
+ const id = `p-${keys.join("-")}`;
+ const { replies } = await mount({ id });
+ advance();
+ for (const key of keys) {
+ await press(key);
+ advance(200);
+ }
+ expect({ keys, replies }).toEqual({ keys, replies: [`${id}:${reply}`] });
// One reply per request, even when the key is pressed again before the card goes away.
- await press(key);
+ advance();
+ await press(keys[0]!);
expect(replies).toHaveLength(1);
for (const { root, container } of mounted.splice(0)) {
await act(async () => root.unmount());
@@ -73,6 +87,38 @@ test("Y allows once, A allows for the chat, N and Escape deny", async () => {
}
});
+test("a key right after the card appears, or while you keep typing, answers nothing", async () => {
+ const { replies } = await mount();
+ await press("y");
+ advance(300);
+ await press("n");
+ advance(300);
+ await press("y");
+ expect(replies).toEqual([]);
+ advance();
+ await press("y");
+ expect(replies).toEqual(["permission-1:once"]);
+});
+
+test("A asks for a confirming key; N or Escape cancels it", async () => {
+ const { replies, container } = await mount();
+ advance();
+ await press("a");
+ expect(container.querySelector('[data-permission-confirm="always"]')).not.toBeNull();
+ advance(200);
+ await press("n");
+ expect(replies).toEqual([]);
+ expect(container.querySelector('[data-permission-confirm="always"]')).toBeNull();
+ advance();
+ await press("a");
+ advance(200);
+ await press("Escape");
+ expect(replies).toEqual([]);
+ advance();
+ await press("y");
+ expect(replies).toEqual(["permission-1:once"]);
+});
+
test("shows the keys on the buttons", async () => {
const { container } = await mount();
const hints = [...container.querySelectorAll("kbd")].map((element) => element.textContent);
@@ -83,6 +129,7 @@ test("shows the keys on the buttons", async () => {
test("never takes keystrokes from the composer or other text fields", async () => {
const { replies } = await mount();
+ advance();
const textarea = document.createElement("textarea");
const input = document.createElement("input");
const select = document.createElement("select");
@@ -106,6 +153,7 @@ test("never takes keystrokes from the composer or other text fields", async () =
test("ignores modifier chords, other keys, other dialogs and a busy card", async () => {
const { replies } = await mount();
+ advance();
await press("y", document.body, { metaKey: true });
await press("a", document.body, { ctrlKey: true });
await press("n", document.body, { altKey: true });
diff --git a/apps/desktop/electron/runtime.test.mjs b/apps/desktop/electron/runtime.test.mjs
index 1f247448..aee67992 100644
--- a/apps/desktop/electron/runtime.test.mjs
+++ b/apps/desktop/electron/runtime.test.mjs
@@ -96,14 +96,14 @@ describe("bundled OpenCode runtime", () => {
const constants = JSON.parse(await readFile(path.resolve(here, "../../../constants.json"), "utf8"));
const release = JSON.parse(await readFile(path.resolve(here, "../scripts/engine-release.json"), "utf8"));
- // OmniRush.ai's build of opencode 1.18.32 (engine-1.18.32-ux3-cmd3 of
+ // OmniRush.ai's build of opencode 1.18.32 (engine-1.18.32-ux3-cmd4 of
// omnirush-ai/omnirush-cli), the engine the CLI ships; the 2.x engine
// bundled from 2.2.0 is gone (its sessions are imported, engine2/import.ts).
assert.equal(constants.opencodeVersion, "v1.18.32");
assert.equal(release.version, "1.18.32");
// A public pre-release of this repo, never marked latest: no token needed.
assert.equal(release.repo, "omnirush-ai/omnirush-gui");
- assert.equal(release.tag, "engine-1.18.32-ux3-cmd3");
+ assert.equal(release.tag, "engine-1.18.32-ux3-cmd4");
for (const target of ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]) {
assert.match(release.assets[target].name, /^omnirush-engine-[a-z0-9-]+-1\.18\.32\.tar\.gz$/);
assert.match(release.assets[target].sha256, /^[0-9a-f]{64}$/);
diff --git a/apps/desktop/scripts/engine-release.json b/apps/desktop/scripts/engine-release.json
index e98fbcff..bf6bb396 100644
--- a/apps/desktop/scripts/engine-release.json
+++ b/apps/desktop/scripts/engine-release.json
@@ -1,8 +1,8 @@
{
"repo": "omnirush-ai/omnirush-gui",
- "tag": "engine-1.18.32-ux3-cmd3",
+ "tag": "engine-1.18.32-ux3-cmd4",
"version": "1.18.32",
- "origin": "The same archives as release engine-1.18.32-ux3-cmd3 of omnirush-ai/omnirush-cli (the CLI's engine), copied to a public pre-release of this repo that is never marked latest.",
+ "origin": "The same archives as release engine-1.18.32-ux3-cmd4 of omnirush-ai/omnirush-cli (the CLI's engine), copied to a public pre-release of this repo that is never marked latest.",
"license": {
"name": "LICENSE-opencode-MIT",
"sha256": "625f0f619133f89bbbb2abe37369613dfa1885eba1e50d02170deb62bb42cb6b"
@@ -10,27 +10,27 @@
"assets": {
"aarch64-apple-darwin": {
"name": "omnirush-engine-darwin-arm64-1.18.32.tar.gz",
- "sha256": "f2b3cf91a03a0890cb4643b83ec04bfcebfa08f69bfd71290b04d098c897df85"
+ "sha256": "113520660ea7a7d8b0a5e77fe5bbe6f696c5b9affcac46629bd2384ecdbf6d25"
},
"x86_64-apple-darwin": {
"name": "omnirush-engine-darwin-x64-1.18.32.tar.gz",
- "sha256": "38fbdeba644f3b3ee5910e3641b5f6fc8319536148b8ae99b6cd1d6208c99cc7"
+ "sha256": "4d2734db4f0dba9bd12d3a6e899ca0a15d314947dbcf45ab21cc803a6af9f5cf"
},
"x86_64-unknown-linux-gnu": {
"name": "omnirush-engine-linux-x64-1.18.32.tar.gz",
- "sha256": "cb6d1a18a4f31f5f81523eebdf7ae9ac428026aa0396e9c12e9bd15c5b376c65"
+ "sha256": "a556a1878d25f8c4526e7e70c8474d155d4f0d08e6c9f544051f222d6cc1fa01"
},
"aarch64-unknown-linux-gnu": {
"name": "omnirush-engine-linux-arm64-1.18.32.tar.gz",
- "sha256": "c78209d647b79242a2473e70b70cd73a262dd3f78c28baa645e00dd8f6a65eca"
+ "sha256": "5d08b0df5ec16d742ed1d9b48670719fa43e2c1893e7e2437a728df872cdf43c"
},
"x86_64-pc-windows-msvc": {
"name": "omnirush-engine-win32-x64-1.18.32.tar.gz",
- "sha256": "28de1d0ba4db55b54c78ca1e7f3bc409273e5de05211bcea136ba403c1d2d7fd"
+ "sha256": "056ce9cff3847bbbbf9a63a0f17cf1807bdac5bbafbde2daceeffa4d5750a0da"
},
"aarch64-pc-windows-msvc": {
"name": "omnirush-engine-win32-arm64-1.18.32.tar.gz",
- "sha256": "69a7174c0759b36402bbf697ecb0cc6afbbb16dfa1f102ab61ed1807eb7a1da4"
+ "sha256": "766e7b896f9ab650f895d230a073856b510571113c58a4e9a68507d16915e6bd"
}
}
}
diff --git a/constants.json b/constants.json
index 40566041..55fa9f37 100644
--- a/constants.json
+++ b/constants.json
@@ -1,5 +1,5 @@
{
"opencodeVersion": "v1.18.32",
"opencodeV2Version": "0.0.0-beta-19086",
- "engineReleaseTag": "engine-1.18.32-ux3-cmd3"
+ "engineReleaseTag": "engine-1.18.32-ux3-cmd4"
}