Skip to content

Workspace Operator 2.2.5 - cached clients, durable staged operations, typed errors

Latest

Choose a tag to compare

@Artoxem Artoxem released this 18 Nov 12:52
· 3 commits to master since this release

Workspace Operator 2.2.5

Performance and durability, plus a cleaner contract for tool errors. The MCP tool list and every schema are unchanged — no client configuration or prompt needs to change.

Faster calls: one Google client per configuration

Every handler used to call get_creds(config) and build(api, version, ...) on each invocation, so the token file was read again and the discovery document parsed again for every tool call and every bulk worker. Clients are now cached per (configuration, api, version) and the credentials are read once and refreshed on expiry.

The cache belongs to the configuration object, so a second server with different settings (another token, scopes or profile) never inherits the first one's clients.

Staged Apps Script operations survive a restart

script_write → prepare, then execute or cancel, kept its state in memory: a restart, a second process or a container recreate lost the prepared operation. Prepared updates now live as JSON files under operation_dir (default data/operations), written atomically with owner-only permissions because they contain script source, and carrying an expiry:

  • operation_ttl / MCP_OPERATION_TTL — seconds a prepared operation stays executable (default 600);
  • operation_dir / MCP_OPERATION_DIR — where they are kept; the Docker template uses /home/app/data/operations;
  • the directory is now in the protected paths, so drive_write(action="upload") refuses to upload it;
  • an executed operation is removed atomically, so two concurrent execute calls cannot both apply the same update, and a failed update puts the operation back for a retry.

Tool errors: explicit signals instead of guessing from the text

The router treated any handler reply beginning with "Error" as a failure. A legitimate answer such as "Errors found: 0" was therefore reported with isError, and a handler had no way to say "this text is not an error". Handlers can now raise ToolError("...") or return ToolResult(text, is_error=...), and the legacy string convention is matched strictly (^Error(?=:|\s|$)).

Visible change: text that merely starts with the word "Error" (for example "Errors found: 0", or "ERROR: …" in capitals) is now a normal result. Every real handler error message keeps the old shape and is still reported as an error.

Compose: choose the profile in .env

docker-compose.yml now passes MCP_TOOL_PROFILE through (default core), so a deployment can select full, read-write or read-only in .env without editing the tracked config.docker.yaml. The shipped default stays conservative.

Under the hood

448 tests, coverage 58.6% (floor raised to 56%), CI green on Linux and Windows for Python 3.10/3.12/3.13.


Workspace Operator 2.2.5 (русский)

Производительность и надёжность, плюс более чистой контракт ошибок инструментов. Список инструментов и все схемы не изменились — настраивать клиентов и промпты заново не нужно.

Быстрее: один Google-клиент на конфигурацию

Каждый хендлер вызывал get_creds(config) и build(api, version, ...) при каждом обращении: файл токена перечитывался, а документ discovery парсился заново на каждый вызов инструмента и на каждый поток bulk. Теперь клиенты кэшируются по (конфигурация, api, версия), а учётные данные читаются один раз и обновляются по истечении.

Кэш привязан к объекту конфигурации, поэтому второй сервер с другими настройками (другой токен, скоупы или профиль) не получит клиентов первого.

Подготовленные операции Apps Script переживают перезапуск

script_write → prepare, затем execute или cancel: состояние жило в памяти, и перезапуск, второй процесс или пересоздание контейнера теряли подготовленную операцию. Теперь подготовленные изменения лежат JSON-файлами в operation_dir (по умолчанию data/operations), пишутся атомарно с правами владельца (внутри исходники скрипта) и имеют срок жизни:

  • operation_ttl / MCP_OPERATION_TTL — сколько секунд операция остаётся выполнимой (по умолчанию 600);
  • operation_dir / MCP_OPERATION_DIR — где она хранится; в Docker-шаблоне это /home/app/data/operations;
  • каталог добавлен в защищённые пути, поэтому drive_write(action="upload") его не выгрузит;
  • выполненная операция удаляется атомарно, поэтому два одновременных execute не применят одно и то же изменение дважды, а неудачное обновление возвращает операцию для повторной попытки.

Ошибки инструментов: явные сигналы вместо догадок по тексту

Роутер считал ошибкой любой ответ хендлера, начинающийся с «Error». Поэтому нормальный ответ вроде «Errors found: 0» помечался как isError, а хендлер не мог сказать «этот текст — не ошибка». Теперь хендлер может возбудить ToolError("...") или вернуть ToolResult(text, is_error=...), а прежняя строковая конвенция проверяется строго (^Error(?=:|\s|$)).

Заметное изменение: текст, который лишь начинается со слова «Error» (например «Errors found: 0» или «ERROR: …» заглавными), теперь считается обычным результатом. Все настоящие сообщения об ошибках хендлеров сохранили прежний вид и по-прежнему помечаются как ошибки.

Compose: профиль выбирается в .env

docker-compose.yml теперь передаёт MCP_TOOL_PROFILE (по умолчанию core), поэтому деплой может выбрать full, read-write или read-only в .env, не редактируя отслеживаемый config.docker.yaml. Значение по умолчанию осталось консервативным.

Внутри

448 тестов, покрытие 58,6% (порог поднят до 56%), CI зелёный на Linux и Windows для Python 3.10/3.12/3.13.