9 Commits
Author SHA1 Message Date
NB 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.
2026-11-20 13:51:50 +01:00
Aleksander DygońandClaude Opus 5.5 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>
2026-11-19 12:19:28 +01:00
Aleksander DygońandClaude Opus 5.5 30ca5cf802 End a usage limit hold after a reset outside OpenBot (#7767)
* End a usage limit hold after a reset outside OpenBot

A message from the user gives its agent one try on the held model. An
agent set to switch without asking did not use it: #usageLimitMove
checked only mayDrain, so the drain moved the agent to its backup before
the try. Now the try runs first. A refused try holds the agent again, and
the drain after it moves the agent.

A limit whose refusal named its reset was not read again before that
reset. Now it is read at the 15-minute recheck, as a reset from a reading
is. A reading with no spent window ends the hold. A spent window keeps
the reset that the refusal named. When a turn is refused again before
that reset, the reading does not show this limit, so the gate waits for
the reset with no more reads.

The Codex usage reset e2e now checks the try before the backup and the
return to the held model after a reset outside OpenBot.

Fixes #7068

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the usage limit reads correct after a reset credit

A limit that a refusal left with no known reset now reads usage again,
also when an earlier refusal had stopped its reads. Before, it waited with
no reading and no end.

A reset credit now forgets which limits a reading ended early. Before, a
new limit of that account could wait for its reset with no reading.

The try of a user message goes first only when the held model is ready.
Otherwise the agent moves to its ready backup, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 18:49:17 +01:00
NB 7dbc8f0fcf Send Codex memories and section teammates with the turns (#5647)
* Send Codex memories and section teammates with the turns

Codex keeps the developer instructions of a session, also on
thread/resume. Thus a memory change did not reach a running Codex
session, and a section change started a new session that wrote the
full conversation to the prompt cache again.

- The Codex client now has turnContext: true. It sends the memory and
  section blocks with the turn input, as the Claude client does, and
  removes the turn context fields from thread/start and thread/resume.
- The blocks go again in full after a failed turn or a compaction.
  A resumed thread gets no duplicate blocks. The history import does
  not show the blocks as user text.
- The section teammates are no longer in the Codex tool fingerprint.
  A session with the old fingerprint is accepted once and updated.
- The Codex app-server cannot change the developer instructions of a
  session. Other instruction changes still start a new session.
- scripts/codex-turn-context-e2e.ts runs the real app-server against a
  fake model and writes .openbot-build/codex-turn-context-e2e/report.json.
- The Codex instruction budget increases by 101 bytes: the short
  pointer texts that Claude already has.

* Resume a loaded session when its section-mates change

The section-mates are no longer in the Codex tool fingerprint, so a
section change kept the loaded session, and the agent did not get the
new list. Record the section-mates that each session got at its start
or resume. When they are different at the next turn, resume the session,
as a memory change does. The turn context then sends one update block.

* Fix review findings in the Codex turn context

- Release a thread's turn context also when the app server is stopped.
- Send the turn context again for each turn/start that gets no answer,
  also on a timeout or an interrupt. Remove the ephemeral-thread list.
- Keep the last content part of a history item, so a user message with
  only context blocks is not empty.
- Record the given section-mates only after the thread is prepared, and
  forget them when a provider session is released.
- Check only the legacy section form when the current form fails.

* Read only the user's message in the fake Codex of the usage reset check

The turn context blocks now go in front of the user's input. The fake read the
whole input, so a saved-memory text with "limit" spent the plan and a retry
with the blocks counted as a new message.
2026-11-07 22:41:01 +01:00
NBandClaude Opus 5.5 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>
2026-11-04 19:43:21 +01:00
NBandClaude Opus 5.5 799c55e8d3 Let users delete an agent that a usage limit holds (#4495)
* Let users delete an agent that a usage limit holds

A message that waits for a usage limit to reset stopped the delete with
"Stop the agent and cancel its queued messages before deleting it."

Only a running turn or a started message now stops the delete. Queued
messages are deleted with the agent. The drain holds an agent while it is
deleted, and the delete waits for a drain that started before it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the old delete rule unless a usage limit holds the agent

Only a held agent can be deleted with queued messages. A held channel
delivery still blocks the delete. After the drain wait, the delete waits
for a model move that runs and checks for a held compaction. Both model
moves skip an agent that is being deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Check a held compaction before and during the delete

The pre-check now refuses a compaction as delete does, so a caller that
passes the pre-check does not get a delete failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 15:13:34 +01:00
NBandClaude Opus 5.5 64b618c219 Let a user message try a turn while a usage limit holds the agent (#4136)
* Let a user message try a turn while a usage limit holds the agent

A usage limit held each queued message until the reset time. After the
user signed in to another account or got more usage, a new message still
waited. Now a message from the user lets the agent start one turn. A
refused turn queues the messages again and ends the try. A completed turn
ends the limit.

Also read the usage limit notice in the tracked part of its analytics
effect, to stop the STRICT_READ_UNTRACKED warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* End the usage limit try when its turn starts

A try stayed until a refusal. A failed or stopped turn, or a messaging
turn, left the gate open, and each lane could start a turn on one try.
The drain now ends the try when it starts the turn. The test checks that
one message starts one turn, and removes its event listener.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 22:43:20 +01:00
NBandClaude Opus 5.5 1949bf7a16 Add an Anthropic API key for Claude and fix agent cache and usage counts (#3071)
* Add an Anthropic API key for Claude and fix agent cache and usage counts

- Claude: a saved Anthropic API key starts each Claude process with
  ANTHROPIC_API_KEY. Claude Code uses it before a claude.ai sign-in.
  An account after the first does not get the key. Local and joined
  servers show the key when the host advertises claude-api-key-v1
  (a marker capability with no routes; the providers-v1 key routes
  save the key).
- A custom provider on api.anthropic.com now uses the @ai-sdk/anthropic
  adapter, so OpenCode sends cache_control breakpoints. Anthropic's
  OpenAI-compatible endpoint does not cache.
- OpenCode usage: each prompt is its own counter, and inputTokens is the
  uncached input. A missing cache or thinking field is 0.
- Provider download failures send a failure code from the catalog key,
  not "unknown".

E2E: claude-api-key, opencode-anthropic-cache (needs the OpenCode
binary), opencode-usage-metering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Release usage limit holds when a provider key changes

A saved or removed key replaces the credential of the provider's own
sign-in. A usage limit of the old credential held the agents until its
reset. Now the credential change ends those holds. Claude's Sign in on
an older joined host does not open the key dialog, because that host
does not read the key. The Codex usage reset e2e has a case for the
credential change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the provider key object across server-list updates

The key object read the active server, and each server-list update
gives new server objects. So each update cleared the key badges and
read the key status again. A boolean memo now holds the Claude key
capability, and it notifies only when the value changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Remove the unused Claude apiKeyInUse flag

Nothing read apiKeyInUse for Claude: the key card reads the key status.
The flag is Gemini only again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Let each agent choose between the Claude plan and the API key

A saved Anthropic key is now its own Claude account, "API key", with a fixed id that all released
account checks accept. Select it in an agent's model menu to bill that agent to the key; the other
agents keep the Claude plan. When Claude has no sign-in, the own sign-in uses the key, so all agents
work with no change. Removing the key removes the account and moves its agents back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep Claude plan holds when the key does not serve the own sign-in

A claude.ai login does not use the saved key, so a key change no longer
releases the usage-limit holds of that plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Remove the Claude key account before the key is cleared

The idle check of the key account now runs before the key is deleted.
When an agent on the account has work, the request fails and the key
stays, so no agent stays on the account without its key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Refuse a Claude key removal while Claude is busy, before the account goes

The key change refuses while a Claude turn runs. That check now also runs
before the key account is removed, so a busy refusal keeps both the key
and its account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:58:09 +01:00
Aleksander DygońandClaude Opus 5.5 5258c1807f Reset Codex usage limits from Settings > Providers (#2910)
* Reset Codex usage limits from Settings > Providers

Codex can give an account usage reset credits. Before, a user could spend
one only in the Codex CLI or app. Now the account ⋯ menu in Settings >
Providers shows "Reset usage" when the account has a credit. A confirmation
names the credits left; the result shows under the accounts.

- Read `rateLimitResetCredits.availableCount` from `account/rateLimits/read`
  and send `account/rateLimitResetCredit/consume` with a new idempotency key
  for each reset. Both are stable Codex app-server methods since 0.156.0.
- After a reset, read the account's usage again, and end the usage limit
  that holds its agents.
- Cover the provider's own sign-in and each account after the first.
- Add the optional Team API capability `provider-usage-reset-v1`, so an
  owner or admin can reset on a joined server, from desktop or the web
  client. The released usage routes do not change.
- Add `scripts/codex-usage-reset-e2e.ts` and route cases in
  `scripts/team-api-routes-e2e.ts`.

Closes #2859

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Release held agents when Codex has nothing to reset

- When Codex answers `nothingToReset`, no limit of the account is spent,
  so end the usage limit hold on it too. Before, the page said that no
  limit was spent while the agents still waited.
- Read the usage reset credits again when the account actions arrive
  after the provider page, as a joined server's capabilities can.
- Use the contract's outcome list in the Codex decoder, and decode the
  preload list once.
- Cover the released hold in `scripts/codex-usage-reset-e2e.ts`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 14:32:56 +02:00