Skip to content

Keep a tab leave-page prompt from wedging task cleanup - #85

Merged
wolfiesch merged 6 commits into
mainfrom
fix/finish-task-timeout
Oct 26, 2026
Merged

wolfiesch merged 6 commits into
mainfrom
fix/finish-task-timeout

Conversation

@wolfiesch

Copy link
Copy Markdown
Owner

Problem

chrome.tabs.remove settles only after the tab is destroyed. A page beforeunload ("Leave site?") prompt can hold a tab open indefinitely, and browser_finish / task close awaited that removal inside the serial ownership queue. Every later ownership change, browser_open, browser_tabs, tab event, and native reconnect then stalled until the extension was reloaded. The host reported the resulting timeout as state_store_error with advice to repair ~/.agenttab.

Change

  • Task cleanup and the browser_act close action wait at most two seconds for Chrome to remove a tab. A tab still held by its prompt is left out of closed_tab_ids/retained_tab_ids (cleanup) or returned as close_pending: true (close action); its removal stays requested.
  • One shared BoundedChain helper caps how long a single operation can hold the ownership (10 s), handoff (10 s), and startup event (30 s) queues. An overrunning operation keeps running and is logged; the next operation starts.
  • Host: cleanup timeouts map to extension_timeout with reload advice and leave the task open; extension refusals (e.g. ownership_denied) pass through their own code and message instead of native_protocol_error.

Verification

  • Extension typecheck, unit tests, and build; cargo test in host-rs. New regression tests fail on the previous code.
  • Live Chrome: armed a beforeunload prompt on a task tab via a trusted click, then agenttab.finish returned in 2.0 s with the tab excluded from closed_tab_ids; a fresh task then opened, listed, and finished normally.

chrome.tabs.remove settles only once Chrome destroys the tab, and a beforeunload prompt can hold it open indefinitely. Finish and close awaited that removal inside the ownership queue, so every later ownership change, browser_open, tab event, and native reconnect stalled behind it. Cleanup now waits at most two seconds for removals after ownership is already persisted, and each queued background operation holds the event queue for at most 30 seconds.
A finish or close the extension did not confirm in time was reported as state_store_error with advice to repair ~/.agenttab or free disk space. Map native cleanup failures by their native error instead, and tell the agent the task is still open and can be finished again once the extension answers.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T07:05:55.950384Z 0ad8861 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ad8861962

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/extension/src/bounded.ts Outdated
Comment thread packages/extension/src/ownership.ts
@wolfiesch
wolfiesch merged commit 83d41cd into main Oct 26, 2026
9 checks passed
@wolfiesch
wolfiesch deleted the fix/finish-task-timeout branch October 26, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant