diff --git a/CHANGELOG.md b/CHANGELOG.md index b98625d..d9b3bac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ All notable changes to Plan2Code will be documented in this file. ### šŸ› Fixed +- **web console**: a finished screen's press (**Commit it now**, **Update CHANGELOG first**, **Back to the dashboard**, **Continue here**, a review) that nothing picks up, because the agent's turn ended while the screen waited, no longer says "Opening Changelog…" forever. After a minute of silence the line beside Planny says Plan2Code is not running and the choice is saved, with **continue** to type in the terminal (a button that types it there, under the app). - **desktop app**: under Claude Code, the console's **continue** button also sends Claude Code's send-now chord (ctrl+x ctrl+s), so a `continue` it held as a queued message behind a stuck turn is delivered in one press instead of waiting in the terminal. - **desktop app**: links that leave the console (**Open pull request**, links in documents, the feedback button) open in the default browser instead of doing nothing; when no browser can be started, the page shows the link with a **Copy** button to paste into one. - **web console**: answers sent and not picked up bring up the "not running, type **continue**" help after a minute of the agent's silence (three when it said it was working), instead of after its quiet allowance, which a build can set to half an hour. diff --git a/scripts/test-web-console-page-session.mjs b/scripts/test-web-console-page-session.mjs index 694898a..b458113 100644 --- a/scripts/test-web-console-page-session.mjs +++ b/scripts/test-web-console-page-session.mjs @@ -148,6 +148,30 @@ test("Update CHANGELOG first shows beside Commit it now only when the finish ask assert.equal(await main.getByRole("button", { name: "Commit it now" }).isDisabled(), true, "one press locks the other buttons"); }); +// Pressed, then left: the agent's turn had ended, so nothing collects the +// press. The line stops promising it is opening and offers continue instead. +test("a finished screen's press that nothing collects says Plan2Code is not running, with continue as a button under the app", async (t) => { + const s = await openSession(await suite.browser(), { + t, + workflow: "quick-task", + clock: true, + payload: { agent: { status: "working", activity: "Task 1 of 1" } }, + env: { PLAN2CODE_IN_APP: "1" }, + init: FAKE_APP_FRAME, + }); + s.post({ finish: { headline: "Quick task done", command: "git add -A && git commit -m x -m y", commit: true, changelog: true, dashboard: true } }); + const main = s.page.locator("#main"); + await main.getByRole("button", { name: "Update CHANGELOG first" }).click(); + await lineSays(s, /^Opening Changelog…/); + await s.page.clock.fastForward(200_000); + await lineSays(s, /^Plan2Code is not running\. Your choice is saved/); + assert.match(await s.page.locator("#planny").getAttribute("class"), /\bis-adrift\b/); + const press = s.page.locator("#agent-text .agent-key-btn"); + assert.equal(await press.textContent(), "continue"); + await press.click(); + await until(async () => (await toApp(s, "agent-continue")).length === 1, 5000); +}); + test("Continue here is hidden once the session meter is red, and the command and fresh-session advice stay", async (t) => { const s = await openSession(await suite.browser(), { t, workflow: "implement", payload: { agent: { status: "working", activity: "Task 1 of 1" } } }); // Ten points: a thirty-task phase scores ten, the red level. diff --git a/src/web-console/public/selectors.js b/src/web-console/public/selectors.js index 5294be6..4bbaa06 100644 --- a/src/web-console/public/selectors.js +++ b/src/web-console/public/selectors.js @@ -223,6 +223,19 @@ function uncollectedLimit() { // them up -- but "Sent. Waiting for Plan2Code." forever does not say that. export const stranded = () => page.pendingResult && agentAdrift(); +// A press on a finished screen (Commit it now, Update CHANGELOG first, the way +// back to the dashboard, Continue here, a review) that nothing has collected. +// agentAdrift() stays quiet after a finish, where no agent is the normal end, +// but a press sent to one means somebody is waiting on it: an agent still in +// `wait` pings every five seconds, so a minute of silence says it is gone (its +// turn ended while the person was away) and the press sits saved until it +// is woken. +export function pressStranded() { + if (!finish() || page.gone || !page.pendingResult || !page.agentLastSeen) return false; + if (!page.local.afterBuild || page.local.afterBuild === "done") return false; + return Date.now() - Date.parse(page.agentLastSeen) > UNCOLLECTED_MS; +} + // The spec whose overview.md the Overview tab shows: the dashboard picker's // selection on the dashboard, the session's own spec everywhere else. export const overviewSpec = () => (isDashboard() ? selSpec()?.dir || "" : (page.S && page.S.specDir) || "");