Skip to content

fix(ci): the upgrade check counts entities of every type - #512

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-200yii
Oct 17, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-200yii

Conversation

@adeelahmad

Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: since #395 merged, the Upgrade check fails on every pull request that changes the backend ("entities: Friday, Monday gone"). #395's entity-types upgrade step retypes Terms such as Monday as Dates, and GET /entities leaves Dates and Numbers out unless asked for, so the check read them as lost.

After: the check also lists the quiet types (types=DATE,NUMBER), so an entity may change type in an upgrade but none may go. v0.13.0 hides the same quiet types, so the before and after lists are built the same way.

Motivation and Context

Unblocks the Upgrade check on every open backend PR. The same commit is in #408 (9c46640, verified locally there); split out so it lands without waiting on #408's conflicts.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (pre-commit run --files ci/upgrade/lens_upgrade.py passes).
  • Tests: this is the test; its Upgrade run on this PR is the proof.
  • Documentation: n/a, no behaviour change.
  • CHANGELOG: n/a, CI only.

Done questions (AGENTS.md)

  • Goal: merged on green CI (pending).
  • Agents, Zero setup, Clicks, Configurable, Light, Private, Cost, User decides, Honest, Open: n/a, CI harness only.
  • Upgrades: the check still fails if any entity is gone; it only stops counting a retype as a loss.
  • Tests, docs and generated files: the test itself.
  • Reported: the Upgrade run on this PR; nothing to refine later.
  • Reuse: uses the existing types filter of GET /entities.

Generated by Claude Code

Since #395 the entity-types upgrade step types Terms such as Monday as
Dates, which the entities list leaves out unless asked for, so the check
read them as gone. It now lists the quiet types too: an entity may change
type in an upgrade, but none may go.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013sC1p4dJXjteytbxDXnk5g
@adeelahmad adeelahmad self-assigned this Oct 17, 2026
adeelahmad pushed a commit that referenced this pull request Oct 17, 2026
Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B
adeelahmad pushed a commit that referenced this pull request Oct 17, 2026
Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B
adeelahmad pushed a commit that referenced this pull request Oct 17, 2026
Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B
adeelahmad pushed a commit that referenced this pull request Oct 17, 2026
Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AjJqXgjj1cNdKGRQbX5frb
@adeelahmad
adeelahmad merged commit 8fa6f87 into main Oct 17, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-200yii branch October 17, 2026 05:32
adeelahmad pushed a commit that referenced this pull request Oct 17, 2026
Brings in #512, the fix for the upgrade check's entity count.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YHrWfYDCaCbKKDX4w9at9C
adeelahmad added a commit that referenced this pull request Oct 17, 2026
…ings (#495)

* feat(assistant): run Python and bash in an OpenShell sandbox per conversation

The assistant gets run_python, run_bash, sandbox_files and import_sandbox_file
once an admin turns on Settings > Code sandbox (sandbox.enabled, off by
default) and points Lens at an NVIDIA OpenShell gateway. Each conversation
gets its own sandbox (lens-chat-<id>) with none of Lens's data or keys, no
egress unless sandbox.network allows the package registries or public
addresses, and its files kept between runs. Attachments go in by id; a file
comes out only through an import_files approval. With the network on, a run
after outside text asks first. Idle sandboxes are stopped and unused ones
deleted by the routines loop, and deleting a conversation deletes its sandbox.

OpenShell's Python client is the `sandbox` extra, fetched as a component when
the sandbox is turned on; tests run it against a fake gRPC gateway.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(notes): keep the daily notes test from failing on 2026-10-17

The last check asked for 2026-10-17's note after the call without a date had made today's note, so on that day it
found the note the deleted root had left behind. It now asks for a day no earlier call makes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(assistant): start the code sandbox's OpenShell gateway from Settings

The Docker Compose install gets a sandbox profile: openshell-init makes the
gateway's certificates once, openshell-key copies the client's to a volume
only Lens reads, and openshell-gateway runs NVIDIA OpenShell 0.1.4 with the
Docker driver (no capabilities, read-only, telemetry off). Lens signs in to it
over mutual TLS.

Settings > Code sandbox > Run the gateway on this machine asks the upgrade
agent to start it (action=services, profile=sandbox) and turns the sandbox on
at openshell-gateway:17670, after a preflight (the Compose install, a 64-bit
machine, Landlock 3). Off deletes every sandbox first. The same over
GET/PUT /api/v1/admin/sandbox and the MCP tools sandbox_gateway and
set_sandbox_gateway. An agent that knows only monitoring says to start it by
hand, with the line to run.

The network setting web becomes hosts: OpenShell resolves only names its
policy lists, so the sandbox reaches the package registries and the names an
admin lists in sandbox.hosts, at public addresses only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* docs(threat-model): the code sandbox's gateway profile and its hosts network

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(ci): the upgrade check counts entities of every type

Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

---------

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
adeelahmad added a commit that referenced this pull request Oct 17, 2026
)

* fix(assistant): let the assistant's tools be imported first

Importing app.domain.ai_tools on its own failed: it imported automations,
which loads the actions, and the agent's action subclasses Toolbox before
ai_tools had defined it. Running one test file (tests/api/test_chats.py)
hit it. ai_tools now imports automations last.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): each answer records what produced it

Every answer keeps `meta`: the model and the host name of its server,
the tools offered and asked for, the scope it answered in (after
auto-scope), its limits and what it used, how it ended (answered,
direct, limit, fallback, stopped, error), tool results that read like
instructions to an AI, how long it took, Lens's version, and tokens and
cost from the ledger rows that name it. Questions keep how they were
sent (web, api, voice, room, automation) and their options.

The answer's id is taken once the question is saved and the answer
runs in activity.scope(chat:<cid>, chat_message:<mid>), in the web
chat, chat rooms and the automations' agent; the streamed answer holds
the scope across its steps (activity.scoped). App completions keep no
messages, so their record comes back in lens.record. The stream sends
`meta` before `done`; GET /chats/{cid}/messages/{mid} returns one
message with its record and ledger rows. Each tool step keeps its time
and whether it failed. The web app shows it all from an i in the
answer's header (a sheet on a phone); old answers say they weren't
recorded.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(notes): keep the daily notes test from failing on 2026-10-17

The last check asked for 2026-10-17's note after the call without a date had made today's note, so on that day it
found the note the deleted root had left behind. It now asks for a day no earlier call makes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): choose tools, a tool-call limit and a scope per answer

Group the assistant's tools (GET /chats/tools lists the groups and tools a
person has, what each does and why a group is missing), offer an answer only
the tools picked (an admin's switch still wins), stop at a tool-call limit up
to the new ai.max_tool_calls setting, and narrow one answer to its own
namespaces. A conversation keeps its choice and new ones start with the last.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* docs(chat): choosing tools, namespaces and a limit; regenerate the client

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): a choice made as a conversation starts is the latest choice

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(chat): setting the server up keeps every tool, whatever the latest choice

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(entities): wait for the typed search before counting merge options

The find box empties while the list for what was typed loads, so on a busy
runner the first list could pass the wait and then vanish.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(settings): the AI section's server values include ai.max_tool_calls

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(chat): find_resources belongs to the archive's tools

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* docs(chat): a new built-in tool joins a tool group

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(ci): the upgrade check counts entities of every type

Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

---------

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
adeelahmad added a commit that referenced this pull request Oct 17, 2026
…load the files it makes (#497)

* feat(assistant): run Python and bash in an OpenShell sandbox per conversation

The assistant gets run_python, run_bash, sandbox_files and import_sandbox_file
once an admin turns on Settings > Code sandbox (sandbox.enabled, off by
default) and points Lens at an NVIDIA OpenShell gateway. Each conversation
gets its own sandbox (lens-chat-<id>) with none of Lens's data or keys, no
egress unless sandbox.network allows the package registries or public
addresses, and its files kept between runs. Attachments go in by id; a file
comes out only through an import_files approval. With the network on, a run
after outside text asks first. Idle sandboxes are stopped and unused ones
deleted by the routines loop, and deleting a conversation deletes its sandbox.

OpenShell's Python client is the `sandbox` extra, fetched as a component when
the sandbox is turned on; tests run it against a fake gRPC gateway.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(notes): keep the daily notes test from failing on 2026-10-17

The last check asked for 2026-10-17's note after the call without a date had made today's note, so on that day it
found the note the deleted root had left behind. It now asks for a day no earlier call makes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(assistant): start the code sandbox's OpenShell gateway from Settings

The Docker Compose install gets a sandbox profile: openshell-init makes the
gateway's certificates once, openshell-key copies the client's to a volume
only Lens reads, and openshell-gateway runs NVIDIA OpenShell 0.1.4 with the
Docker driver (no capabilities, read-only, telemetry off). Lens signs in to it
over mutual TLS.

Settings > Code sandbox > Run the gateway on this machine asks the upgrade
agent to start it (action=services, profile=sandbox) and turns the sandbox on
at openshell-gateway:17670, after a preflight (the Compose install, a 64-bit
machine, Landlock 3). Off deletes every sandbox first. The same over
GET/PUT /api/v1/admin/sandbox and the MCP tools sandbox_gateway and
set_sandbox_gateway. An agent that knows only monitoring says to start it by
hand, with the line to run.

The network setting web becomes hosts: OpenShell resolves only names its
policy lists, so the sandbox reaches the package registries and the names an
admin lists in sandbox.hosts, at public addresses only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* docs(threat-model): the code sandbox's gateway profile and its hosts network

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): show the code sandbox's runs in the conversation and download the files it makes

Each run_python or run_bash step carries the start of its stdout, the end of its stderr and how it ended; the web app shows it folded under the answer with the code. share_sandbox_file copies a file out of the sandbox, kept encrypted with the conversation, as a download button on the answer (GET /api/v1/chats/{cid}/files/{fid}), deleted with the conversation or the account.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(ci): the upgrade check counts entities of every type

Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

---------

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
adeelahmad added a commit that referenced this pull request Oct 18, 2026
* fix(assistant): let the assistant's tools be imported first

Importing app.domain.ai_tools on its own failed: it imported automations,
which loads the actions, and the agent's action subclasses Toolbox before
ai_tools had defined it. Running one test file (tests/api/test_chats.py)
hit it. ai_tools now imports automations last.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): each answer records what produced it

Every answer keeps `meta`: the model and the host name of its server,
the tools offered and asked for, the scope it answered in (after
auto-scope), its limits and what it used, how it ended (answered,
direct, limit, fallback, stopped, error), tool results that read like
instructions to an AI, how long it took, Lens's version, and tokens and
cost from the ledger rows that name it. Questions keep how they were
sent (web, api, voice, room, automation) and their options.

The answer's id is taken once the question is saved and the answer
runs in activity.scope(chat:<cid>, chat_message:<mid>), in the web
chat, chat rooms and the automations' agent; the streamed answer holds
the scope across its steps (activity.scoped). App completions keep no
messages, so their record comes back in lens.record. The stream sends
`meta` before `done`; GET /chats/{cid}/messages/{mid} returns one
message with its record and ledger rows. Each tool step keeps its time
and whether it failed. The web app shows it all from an i in the
answer's header (a sheet on a phone); old answers say they weren't
recorded.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(notes): keep the daily notes test from failing on 2026-10-17

The last check asked for 2026-10-17's note after the call without a date had made today's note, so on that day it
found the note the deleted root had left behind. It now asks for a day no earlier call makes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): choose tools, a tool-call limit and a scope per answer

Group the assistant's tools (GET /chats/tools lists the groups and tools a
person has, what each does and why a group is missing), offer an answer only
the tools picked (an admin's switch still wins), stop at a tool-call limit up
to the new ai.max_tool_calls setting, and narrow one answer to its own
namespaces. A conversation keeps its choice and new ones start with the last.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* docs(chat): choosing tools, namespaces and a limit; regenerate the client

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): a choice made as a conversation starts is the latest choice

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(chat): setting the server up keeps every tool, whatever the latest choice

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(entities): wait for the typed search before counting merge options

The find box empties while the list for what was typed loads, so on a busy
runner the first list could pass the wait and then vanish.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(settings): the AI section's server values include ai.max_tool_calls

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(chat): find_resources belongs to the archive's tools

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* docs(chat): a new built-in tool joins a tool group

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(ci): the upgrade check counts entities of every type

Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): deep research, a plan to approve and a cited report

A goal (/research, research: true, POST /chats/{cid}/research, the assistant's and MCP's start_research) gets one planning call: follow-up questions and a plan with a labelled estimate, waiting as an approval of the assistant's (tool research). Approved in the web app, the inbox or with a yes in a chat room (an API key or an app only declines, unless research.agents_skip_review), it runs in the background: claimed by one process with a heartbeat, resumed from the last finished stage, one run per person, within its tool calls, research.max_minutes and budgets, stoppable. Gather uses only the plan's sources' read tools; write and check renumber citations and rewrite or mark unsupported claims. The report saves as a note (chat links) or makes a podcast.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

---------

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
adeelahmad added a commit that referenced this pull request Oct 18, 2026
* feat(automations): more operators for conditions

Match trees gain in, not_in, starts_with, ends_with, matches, between,
before, after, within, weekday, time_between and changed. Time and state
come from env (now, timezone, state), never from globals. Patterns are
refused when they could backtrack without end, read at most 20,000
characters and give up after 50 ms (the regex module's timeout).
changed keeps the last value seen per automation, trigger and key in a
new automation_state table, tidied hourly.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AjJqXgjj1cNdKGRQbX5frb

* fix(automations): drop an automation's oldest state first, to the microsecond

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AjJqXgjj1cNdKGRQbX5frb

* docs(automations): list the condition operators as built, with their checks

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AjJqXgjj1cNdKGRQbX5frb

* fix(ci): the upgrade check counts entities of every type

Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AjJqXgjj1cNdKGRQbX5frb

---------

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
adeelahmad added a commit that referenced this pull request Oct 18, 2026
…p, with ready-made MCP servers (#491)

* feat(assistant): turn the MCP runner and a browser on from the web app, with ready-made MCP servers

The host upgrade agent's services action now takes a profile (mcp,
browser or monitoring, a fixed list) and turn=on|off, so the web app,
the API (GET /admin/services, PUT /admin/services/{profile}) and the MCP
tools services and set_service can start or stop any of Lens's optional
containers; the old monitoring=on|off request still works.

The new browser profile runs Playwright MCP in a hardened container on
an internal network whose only way out is browser-proxy, netguard run
on its own (public addresses, ports 80 and 443, a byte budget per
connection). Add MCP server gains Ready-made: Browser (one click once
its container answers, browser_run_code_unsafe off) and GitHub (a field
for the token). ${NAME} values get their own fields, and a spec with
keep: true reuses one MCP session between calls.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(sources): give the routing rules preview time to show on a busy machine

The preview waits 600 ms after the last keystroke, and findByText gives
up after 1 s, so the test failed when the machine was busy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(browser): give the browser's home in memory to the user it runs as

The tmpfs at /home/node was root's, so Playwright couldn't make its profile
there and every navigation failed with EACCES. Mount it with node's uid and
gid (1000), in both compose files.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(ci): the upgrade check counts entities of every type

Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

---------

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
adeelahmad added a commit that referenced this pull request Oct 18, 2026
…a live progress card (#517)

* fix(assistant): let the assistant's tools be imported first

Importing app.domain.ai_tools on its own failed: it imported automations,
which loads the actions, and the agent's action subclasses Toolbox before
ai_tools had defined it. Running one test file (tests/api/test_chats.py)
hit it. ai_tools now imports automations last.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): each answer records what produced it

Every answer keeps `meta`: the model and the host name of its server,
the tools offered and asked for, the scope it answered in (after
auto-scope), its limits and what it used, how it ended (answered,
direct, limit, fallback, stopped, error), tool results that read like
instructions to an AI, how long it took, Lens's version, and tokens and
cost from the ledger rows that name it. Questions keep how they were
sent (web, api, voice, room, automation) and their options.

The answer's id is taken once the question is saved and the answer
runs in activity.scope(chat:<cid>, chat_message:<mid>), in the web
chat, chat rooms and the automations' agent; the streamed answer holds
the scope across its steps (activity.scoped). App completions keep no
messages, so their record comes back in lens.record. The stream sends
`meta` before `done`; GET /chats/{cid}/messages/{mid} returns one
message with its record and ledger rows. Each tool step keeps its time
and whether it failed. The web app shows it all from an i in the
answer's header (a sheet on a phone); old answers say they weren't
recorded.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(notes): keep the daily notes test from failing on 2026-10-17

The last check asked for 2026-10-17's note after the call without a date had made today's note, so on that day it
found the note the deleted root had left behind. It now asks for a day no earlier call makes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): choose tools, a tool-call limit and a scope per answer

Group the assistant's tools (GET /chats/tools lists the groups and tools a
person has, what each does and why a group is missing), offer an answer only
the tools picked (an admin's switch still wins), stop at a tool-call limit up
to the new ai.max_tool_calls setting, and narrow one answer to its own
namespaces. A conversation keeps its choice and new ones start with the last.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* docs(chat): choosing tools, namespaces and a limit; regenerate the client

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): a choice made as a conversation starts is the latest choice

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(chat): setting the server up keeps every tool, whatever the latest choice

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(entities): wait for the typed search before counting merge options

The find box empties while the list for what was typed loads, so on a busy
runner the first list could pass the wait and then vanish.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* test(settings): the AI section's server values include ai.max_tool_calls

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(chat): find_resources belongs to the archive's tools

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* docs(chat): a new built-in tool joins a tool group

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* fix(ci): the upgrade check counts entities of every type

Ported from #512 so this PR's upgrade check passes while that lands: the
entity-types step re-types weekday Terms as Dates, which the default entity
list leaves out, so the check read them as gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): deep research, a plan to approve and a cited report

A goal (/research, research: true, POST /chats/{cid}/research, the assistant's and MCP's start_research) gets one planning call: follow-up questions and a plan with a labelled estimate, waiting as an approval of the assistant's (tool research). Approved in the web app, the inbox or with a yes in a chat room (an API key or an app only declines, unless research.agents_skip_review), it runs in the background: claimed by one process with a heartbeat, resumed from the last finished stage, one run per person, within its tool calls, research.max_minutes and budgets, stoppable. Gather uses only the plan's sources' read tools; write and check renumber citations and rewrite or mark unsupported claims. The report saves as a note (chat links) or makes a podcast.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

* feat(chat): deep research in the web app, a plan card to approve and a live progress card

The composer's Deep research switch (and /research) sends a goal; its answer is a plan card: the follow-up questions with answers to tap, the sub-questions to reword, add or remove, where it looks, a tool-call stepper with the estimate, and Enter approves it (or revises it once a question is answered), with Decline. Approved, it becomes a progress card read from GET /research/{id}, so it survives a reload: stage, sub-questions ticked off, sources, tool calls, cost and minutes, Go on anyway when a budget holds it, and Stop. The report saves as a note (picking the namespace when there are several), reads aloud, makes a podcast or exports as Markdown. Notes open chat: links, and Settings > AI assistant > Deep research holds the research limits.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXPWXcSCQb9hWPr7xkZu7B

---------

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
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.

2 participants