mirror of
https://github.com/nightly-labs/openbot.git
synced 2026-11-22 04:10:36 +08:00
main
14
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6fbd8bfc20 |
Let the main chat and side threads of an agent use each other's browser tabs (#13433)
* Let every chat of an agent use the browser tabs of the agent Main chats and side threads of an agent can now use all browser tabs of that agent. list_tabs shows the chat that opened each tab and tells when another chat uses a tab now. Takeover, submit_secret and list_logins use the same rule. Channel and messaging threads still use only their own tabs and the tabs shared with an @ tag. * Keep channel tabs out of other chats and make the working hint reliable The main chat and side threads use only the tabs that the main chat, a side thread or no chat opened. Tabs of a channel or a messaging thread stay out of these chats unless a person tags them with @. otherChatWorking now also uses the last chat that used each tab in the last 2 minutes, because control sessions end 1.2 s after a call. A takeover from one chat no longer deletes the held takeover result of another chat. list_tabs looks up each chat once per call. The browser user-control E2E now covers the cross-chat access. * Keep a held takeover result for each chat of a tab Held takeover results used only the tab id as the key. When two chats of one agent took over the same tab, the second result replaced the first. The key is now the tab id and the thread id. |
||
|
|
03c2ff34c2 |
Remove code comments and add the no-comments rule (#12604)
* Remove code comments and add the no-comments rule Remove the comments from first-party code and configuration files: TS/JS, JSX, CSS, SQL migrations, Swift, Kotlin, Gradle, shell, Docker, systemd, Nix, YAML, TOML, JSONC and GritQL. Keep only what a tool reads: license headers, shebangs, compiler and lint directives, JSDoc types in plain .js files, generated file headers, GritQL scope lines, the install-server.sh help text and the openbot-boat-pre-stop marker. Vendored code, fixtures and released schemas keep their comments. Add the rule to AGENTS.md, and change the docs that asked for comments. Add two i18n keys that only comments named to RELEASED_SOURCE_KEYS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep comments that are data in strings The benchmark task files in opencode-free-models-bench.ts tell the model what each function must do. The sample file and HTML page in the two stories are display content. Put their comments back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep released migrations and mobile native inputs unchanged check:migrations compares each released migration with v0.73.0 byte for byte, so restore src/backend/migrations. A change to a native build input of apps/mobile makes a new runtime version, so restore those files and the extra fingerprint sources. List these files and the comment markers that a tool reads in AGENTS.md. Remove the last requests for comments in src/renderer/AGENTS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c858f0a42c |
Stop a Codex chat that compaction leaves full from compacting after each turn (#7502)
* Stop a Codex chat that compaction leaves full from compacting after each turn While a compaction runs, Codex 0.167.0 reports an estimate of the compacted context before the compaction item completes. The estimate can be much smaller than the next request. OpenBot read it as a real usage: it set the count of compactions that left the session almost full back to 0, and it stored the estimate as the compacted size. A chat whose requests stayed at 80% or more thus compacted after each turn, without end and with no message. Usage that arrives while a compaction of the session runs now updates only the display. The first request after the compaction judges it, as before, so the existing limit of 2 such compactions and its message work again. Fixes #6845 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Ignore usage only during a Codex compaction, and test the loop The first version read the display state to find a running compaction. A Claude, ACP or Pi compaction also sets that state, and their clients also report usage. When a Claude compaction did not report its end, the budget of that session stopped to change. It also did not cover a session with no budget yet. Keep the sessions in a compaction whose usage OpenBot compares, which only Codex and OpenBot's own requests start, and ignore their usage until the compaction ends. The queue e2e gets a chat that each compaction leaves full, while Codex reports a small estimate before the compaction ends. Without the fix it compacted 4 times in 4 turns with no notice. Now it stops after 2 and shows the notice once. Refs #6845 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
781a6829c9 |
Keep compaction results of a Codex session marked for reload (#5862)
* Keep compaction results of a Codex session marked for reload A memory save or a settings change marks the agent's sessions for reload, but the current Codex client still runs them. The compaction item and the usage update of that client were dropped, so the budget kept the old size and the queue asked for another compaction before each message, without end. Accept these notifications from the client that still runs the session (openClientFor), as #5257 proposed. The queue e2e now edits a memory during a turn and checks that the waiting message starts after one compaction. Fixes #5857 * Check that the memory edit case opens the session again The case must run the path of a session marked for reload. Without the thread/resume check, it could pass with a session that stayed loaded. |
||
|
|
30781fe605 |
Stop automatic compactions after 2 failures in a row (#5302)
A Codex compaction that failed set no limit. The next turn grew the chat past the growth rule, and OpenBot asked for a new compaction. One chat compacted every 19 seconds for 7 hours and used up the ChatGPT plan limit. Count the compactions that fail, that Codex refuses, that a handoff cannot do, or that the deadline stops. After 2 in a row, OpenBot asks for no more automatic compactions of that session and shows one notice. A completed compaction, or a session below 80% of its window, starts the count again. "Compact now" still works. The deadline now also sets the last compacted size. Before, the next message asked for a new compaction while Codex still ran the one that ignored the stop. This failed the "refused start" case of the compaction queue E2E on main. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b18d30f3c4 |
Let a user tag browser tabs and threads in chat (#5021)
* Let a user tag browser tabs and threads in chat The @ picker of the chat composer now has sections for agents, browser tabs and threads. A tag becomes a chip in the message. - A tab tag lists only the tabs of the agent of the chat. When the user sends it, the host shares that tab with the target thread of the same agent, so a side thread can use a tab of the main chat. - A thread tag gives the agent one short line: the title, the task id, the state and the start of the result. The agent reads more with history_read or history_search and the new optional taskId. - The stored text keeps the marker. The marker expands at delivery, so the agent gets the current title and state. - A click on a chip opens the tab page or the thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Share a tagged tab when its prompt is built - Share the tab with the public thread that gets the prompt, not when the message is queued. A queued message can move or change. - Use the strict name rule for tab and thread titles. - A popup keeps the shares of its opener tab. - A tag from a teammate shows as a name only. - The picker lists only tabs that have an owner agent. - Use browserDisplayUrl in the picker. - Make the thread question in chat-tags-e2e exact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep TaggedThreadState private to delivery-content Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7ee3cc91dc |
Release a compaction hold when the turn end fails (#4971)
* Release a compaction hold when the turn end fails The end of a turn reserves a context compaction, then saves the turn, and only then sends the compaction request. Only the request arms a deadline. When a step between the two failed, the orphaned-turn path settled the deliveries but kept the hold, so each next message of the agent waited with the reason "compaction" until a restart. The turn end now drops a reservation that the request did not take. The compaction E2E has a case where the preview save fails once at the turn end. Fixes #4960 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop only the compaction hold that the failed turn made The turn end now gives its turn ID to `reserve`. When the turn end fails, it drops the hold only when the same turn made it. Thus a failed turn end cannot drop a hold that a manual compaction or the queue made. Refs #4960 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
92e958ff01 |
End the compaction hold of a deleted side thread (#4246)
A side thread can be deleted while Codex compacts its session: the compaction turn has no active turn id, so deleteTask allows it. The delete released the session and forgot its compaction budget, but the compaction stayed in ContextCompaction, and no turn of the released session could end it. heldThreads kept naming the deleted session, which publicThreadId maps to the agent's own chat, so every later message to the agent stayed queued with the reason "compaction" until a restart. Deleting an execution thread now ends the compaction and any refusal hold on its sessions and drains the agent's queue. Session rotation still uses forgetThread, which keeps the hold until the rotation ends. The compaction queue E2E deletes a side thread while it compacts and checks that a message to the agent's own chat completes. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
495b1217b0 |
Stop a late usage timer and the error box from blocking a quit (#3819)
* Stop a late usage timer and the error box from blocking a quit AgentService.stop disposes ContextCompaction before the provider clients stop. A Codex client still sends usage reports until its process exits, so observeUsage started a new 250 ms timer. The timer read the runtime snapshot after the database closed and threw "OpenBot database is not initialized.". The usage timer now does not start while the service stops. Electron shows an error box for an uncaught exception when no other listener handles it. On a server nobody can close it, and the box blocks the main thread and the shutdown deadline. The main process now adds its own listener in server mode and when a quit starts. The monitor still logs the exception. The compaction E2E has a new last case: the fake Codex reports usage when OpenBot stops it. Fixes #3808 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Hide the error box also for a session end, and share the usage delay A Windows session end runs `before-quit` but not `prepareForShutdown`, so it now hides the error box there too. The E2E reads USAGE_CHANGE_DELAY_MS from ContextCompaction instead of a copy of the value. The guard comment now names the stop, not `dispose`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Hide the error box on a Windows session end Windows sends no `before-quit` for `session-end`, so the `session-end` handler now hides the error box itself. The `before-quit` comment now names the case that it covers: a quit after a session-end query. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
9985008701 |
Show the context meter and Compact in side threads (#3521)
* Show the context meter and Compact in side threads A side thread now shows the context usage meter of its own provider session, with the Compact action, as the agent's own chat does. - The runtime snapshot gets an optional, local-only threadContextStates field. The backend already tracked the usage of side-thread sessions but sent only the agents' own chats. fitRuntimeSnapshot drops the new field first. Team adapters project fixed keys, so Team clients do not get it. - New local-only endpoint agent:tasks:compact-context compacts one open side thread. It refuses while the thread has a turn or queued work. - A handoff provider cannot compact a side thread, so its thread meter shows no automatic compaction and no Compact action. Fixes #3503 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Tighten side-thread compaction checks and snapshot cost - compactTaskContext refuses while the thread session compacts or waits after a refused start, as the agent's own chat does. It uses taskBusy, so a queued message that is being edited also stops it. - The snapshot reads only open side threads, the newest first, and does nothing when no session reported its context. The rotatesSession call was removed: it is never true for a side thread. - The thread state is read lazily, so a new runtime snapshot does not build the threads of the conversation again. - The thread meter is keyed by thread, so a pending Compact or an open popover does not move to another thread. - docs/architecture/providers.md describes threadContextStates and agent:tasks:compact-context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d71a4eb984 |
Let a started context compaction run past 2 minutes (#3467)
* Let a started context compaction run past 2 minutes The 120 s deadline started with the compact request and stayed after the provider started the compaction turn, so a long Codex compaction was interrupted and a long Pi compaction was abandoned (#3466). Keep 120 s only until the provider starts the compaction. A started compaction gets ten times as long (20 min), then the existing stop and grace logic applies. The e2e adds a case that runs past the start deadline. Fixes #3466 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Give the Pi compact request the run deadline Pi stopped its `compact` RPC at its own 120 s default, so the 20 min run deadline never applied to a Pi compaction. Pass the run deadline as the request timeout for a `request` compaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
357f168fc9 |
Let an agent use a browser session of its own (#2907)
* Let an agent use a browser session of its own Add the per-agent setting "Own browser session" (local only, off by default). When it is on, new tabs of the agent open in the persistent partition persist:openbot-browser-agent-<key>. The key is a hash of the agent id. Two agents can then use different accounts on the same site. - A tab keeps its session for its life. Popups use the session of the opener. The state file saves the key, and a restart restores each tab in its saved session. A tab without a key opens in the shared session; a tab with a malformed key is dropped. - Every partition gets the same session configuration. Shutdown and flushPersistentStorage flush every persistent partition. - A change of the setting closes the agent's tabs. Deleting an agent clears its own session. - Add the browser-agent-session E2E check. Part of #2646. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Apply the local review findings to agent browser sessions - Count active downloads across all sessions, so an agent's own session does not raise the download limit. - Make clearAgentSession fail when a tab still uses the session, so the agent deletion logs it. - Do not configure or keep a session only to clear it. - Choose the session of a tab in one place. - Run the agent browser session E2E in the Browser smoke CI job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the agent session key check inside browser-state knip reported isAgentBrowserSessionKey as an unused export. Only browser-state.ts uses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add clearAgentSession to the channel manage E2E browser host main added this fake after the branch point. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3088e2fc0b |
Show the browser as a full view with tabs and a floating composer (#2445)
* Give the browser code card the island design The code card shows the site, the value and Submit in one compact glass layout. A new island variant has no page preview, for the browser dock. OtpInput gets a compact size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add the browser dock with the island, queue and composer The dock shows the step of the agent, the code card and the reply of the agent over the page, with the queue and the composer of the tab's agent. It uses the draft and the queue of the conversation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Let the user take control of a browser tab A person can take a tab from the agent and give it back. While the user holds the tab, the agent's browser tools wait for the release and then tell the agent to take a fresh snapshot. A window close, a session end or a member end releases only its own holds. The new optional capability browser-user-control adds the Team API routes and the browser-user-control-changed event. Protocols v1-v7 do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Show the browser as a full view with tabs in the top row The full view replaces the expanded browser panel. It shows every tab of the agent as chips in the top row, an address field with suggestions from open tabs and the session history, a page menu, and the dock of the tab's agent over the page. A narrow window shows one tab switcher in place of the chips. - Tabs: drag to move, a tab menu (duplicate, move, close left, right or others), reopen a closed tab at its place, and middle click to close. - The keys of other browsers work in the full view and on the page. - The tab order, the closed tabs and the history stay in memory in the renderer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Show the browser dock over the native page A local tab is a native view above the renderer, so the dock now shows in a transparent overlay view above the page. The main renderer publishes what the dock shows and does the actions that the overlay sends back. Main draws a native blur under each glass shape of the dock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Translate the browser full view and add its release notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix issues that the browser full view smoke found - An address typed quickly after a new tab no longer closes the tab: a failed first load closes the tab only when no later load started. - The narrow tab list is modal, so focus goes to the active tab and Escape closes the list, not the browser view. - Two effects read the tab order and the queue rows in their compute functions, so Solid no longer warns about untracked reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the browser dock off the overlay seams in the web client The web client has no window.openbot, so the full view crashed when the dock subscribed to the overlay. Subscribe and publish only while the desktop overlay is in use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Hold the agent's tab list while the user controls a tab While the user controls a tab, the agent's open, list_tabs and status calls now wait for the release, as calls on the held tab do. Before, a tab list ran and the agent could read the page title during the hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Stop a loading page and show when a tab can go back or forward The address bar shows Stop in place of Reload while a page loads, and Back and Forward are off when the tab has no page to go to. A stop ends the load at once, before the queued tab operations, and the load that it ends counts as done. A joined server sends the history state through the new optional `browser-page-state-v1` capability, because the frozen tab event and list drop unknown keys. A client shows Stop only for a host that reports the page state; for an older host, Back and Forward stay enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Open the tab owner's chat when the user selects its tab The dock is the conversation's composer, so it acts on the active agent. A tab of a different agent now brings that agent's chat, and the full view stays open. A tab that an agent brings to the front still offers "Open {name}", which also keeps the page open. The reply marker is kept for each agent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Accept undefined on the optional browser dock props The type ratchet checks exactOptionalPropertyTypes. The dock, the island and the full view pass optional values through, so their props and the shared queue and editor props they fill now accept undefined. The baseline goes down. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * List the tabs of all agents in the browser full view The full view showed only the tabs of the active agent, so the user could not select a tab of another agent. The full view now lists all tabs of the server. A tab of another agent opens the chat of its owner, and that chat shows the selected tab. The side panel keeps the agent's tabs only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix the review findings of the browser full view - Release a user hold when the first load of a tab fails, and let a woken tab restore while it is held. - Show the dock overlay again when main publishes the same presentation after the view failed. - Find the owner of a tab from its thread when it has no agent id. - Release the tabs that the user took when the full view closes. - Clear the draft of the message that the answer was for, not the draft that is open when the answer arrives. - Keep IME input, menus and dialogs out of the full view shortcuts. - Decode "+" in a search address, and clear typed values in the inert dock copy. - Count a visit only once for each page of a tab. - Remove the dead "open agent" dock branch, the address editing state and the unused browser route keys. - Use the glossary term for a remote host in pt and tr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Check that a session end gives back browser control in the Team API routes E2E Logout and session revoke now call releaseUserControlHeldBy. The stub threw, so two checks failed. The stub records the holders, and the checks assert the release of the ended session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix the NorbiAI review findings of the browser full view - The last event socket of a session that closes gives back the browser control of that session, so the agent does not wait for a client that went away. team-session-revoke-e2e checks it on a real host. - The dock adapter cuts the deliveries, the skills, the step label and the reply body to the presentation limits, so main does not refuse the whole presentation. - Remove canOpenChat: it was always true. - Move forwardKeyToWindow and sendBrowserPageState above the doc comments of the methods that they split. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4d50f804bf |
Keep queued messages through a Codex compaction (#2395)
* Keep queued messages through a Codex compaction
Codex 0.160.1 refuses turn/start while a compaction turn runs, with
"ActiveTurnNotSteerable { turn_kind: Compact }". The input did not reach
Codex, so the batch now goes back to the queue in the same position and
waits for the compaction turn to end.
When the compaction deadline comes and Codex still reports the compaction
turn, OpenBot sends turn/interrupt for it and waits a short time for the
turn to end before the queue continues. Each hold has a time limit and
ends when the provider client stops.
scripts/codex-compaction-queue-e2e.ts runs the agent service with a fake
Codex app-server and checks three cases: a short compaction, a stopped
compaction, and a compaction that does not stop.
Thanks to @Johnny-xuan for the report and the first fix in #1766.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Ignore a late interrupt failure after the compaction state resets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|