From 756f71700bfc31761e2fea20d2f068cff48f0775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=83=81=ED=9B=88?= Date: Sat, 1 Aug 2026 19:07:31 +0900 Subject: [PATCH] Restore ready state after browser login --- launcher/electron/browser-host.cjs | 9 ++++++- launcher/package.json | 2 +- launcher/tests/browser-host.test.cjs | 37 +++++++++++++++++++++++++++- package.json | 2 +- scripts/install.sh | 2 +- src/version.ts | 2 +- 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/launcher/electron/browser-host.cjs b/launcher/electron/browser-host.cjs index 88a86cbb2..9ebabecff 100644 --- a/launcher/electron/browser-host.cjs +++ b/launcher/electron/browser-host.cjs @@ -1119,8 +1119,11 @@ class BrowserHost { this.manualOperation = name; const contents = this.view?.webContents; if (contents && !contents.isDestroyed()) contents.setBackgroundThrottling(false); + let succeeded = false; try { - return await action(); + const result = await action(); + succeeded = true; + return result; } catch (error) { const message = error instanceof Error ? error.message : String(error); this.setState({ status: "error", message }); @@ -1128,6 +1131,10 @@ class BrowserHost { } finally { if (contents && !contents.isDestroyed()) contents.setBackgroundThrottling(true); this.manualOperation = null; + if (succeeded && !this.activeTraceId && this.state.authenticated + && ["loading", "running", "testing"].includes(this.state.status)) { + this.setState({ status: "ready", message: "ChatGPT is ready" }); + } } } diff --git a/launcher/package.json b/launcher/package.json index 511391214..41be54b9e 100644 --- a/launcher/package.json +++ b/launcher/package.json @@ -1,6 +1,6 @@ { "name": "codex-web-gpt-launcher", - "version": "1.0.1-ko.2", + "version": "1.0.1-ko.3", "private": true, "description": "Desktop control center for Codex ChatGPT Web", "author": "miuuyy; Korean localization by AgenticLab-SH", diff --git a/launcher/tests/browser-host.test.cjs b/launcher/tests/browser-host.test.cjs index 054f4b394..9d00c9bbc 100644 --- a/launcher/tests/browser-host.test.cjs +++ b/launcher/tests/browser-host.test.cjs @@ -678,10 +678,15 @@ test("launcher session refresh resolves persisted authentication before setup ac test("manual browser operations disable background throttling until completion", async () => { const throttling = []; + const states = []; const fixture = { activeTraceId: null, manualOperation: null, - setState() {}, + state: { authenticated: true, status: "loading" }, + setState(patch) { + states.push(patch); + this.state = { ...this.state, ...patch }; + }, view: { webContents: { isDestroyed: () => false, @@ -694,6 +699,36 @@ test("manual browser operations disable background throttling until completion", assert.equal(result, "ok"); assert.deepEqual(throttling, [false, true]); + assert.deepEqual(states, [{ status: "ready", message: "ChatGPT is ready" }]); + assert.equal(fixture.manualOperation, null); +}); + +test("failed manual browser operations preserve their error state", async () => { + const states = []; + const fixture = { + activeTraceId: null, + manualOperation: null, + state: { authenticated: true, status: "loading" }, + setState(patch) { + states.push(patch); + this.state = { ...this.state, ...patch }; + }, + view: { + webContents: { + isDestroyed: () => false, + setBackgroundThrottling() {}, + }, + }, + }; + + await assert.rejects( + BrowserHost.prototype.withManualOperation.call(fixture, "failing check", async () => { + throw new Error("failed check"); + }), + /failed check/, + ); + + assert.deepEqual(states, [{ status: "error", message: "failed check" }]); assert.equal(fixture.manualOperation, null); }); diff --git a/package.json b/package.json index c8094205a..c0efd497b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codex-chatgpt-web", - "version": "1.0.1-ko.2", + "version": "1.0.1-ko.3", "private": true, "description": "A focused local Responses bridge that runs Codex tasks through a user-authenticated ChatGPT web session.", "repository": { diff --git a/scripts/install.sh b/scripts/install.sh index 17415a8d6..ea119f5c1 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,7 +2,7 @@ set -eu REPOSITORY="${CODEX_CHATGPT_WEB_REPOSITORY:-AgenticLab-SH/codex-chatgpt-web}" -VERSION="${CODEX_CHATGPT_WEB_VERSION:-1.0.1-ko.2}" +VERSION="${CODEX_CHATGPT_WEB_VERSION:-1.0.1-ko.3}" BIN_DIR="${CODEX_CHATGPT_WEB_BIN_DIR:-$HOME/.local/bin}" LIB_DIR="${CODEX_CHATGPT_WEB_LIB_DIR:-$HOME/.local/lib/codex-chatgpt-web}" DOC_DIR="${CODEX_CHATGPT_WEB_DOC_DIR:-$HOME/.local/share/doc/codex-chatgpt-web}" diff --git a/src/version.ts b/src/version.ts index 9fc450ff7..31fe0b02e 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = "1.0.1-ko.2"; +export const VERSION = "1.0.1-ko.3";