Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Merge remote-tracking branch 'origin/main' into security/high-risk-fixes

Petr Bauch3abbea2e2bab
diff --cc .github/workflows/agent-controller-release.yml
index 23ab88f9d,14f0f5c54..56fcac383
--- a/.github/workflows/agent-controller-release.yml
+++ b/.github/workflows/agent-controller-release.yml
@@@ -1,9 -1,9 +1,9 @@@
name: switch-agent-controller release
- # Builds the installable agents controller (console/packages/agent-controller)
+ # Builds the installable agent controller (console/packages/agent-controller)
# and publishes it as a GitHub release: the npm package
# `switch-agent-controller-<version>.tgz`, installed with
-# `npm install --global <its URL>`, and the `install.sh` that finds and installs
+# `npm install --global --ignore-scripts`, and the `install.sh` that finds, verifies and installs
# the newest one. `switch-agent-controller update` and `install.sh` read these
# releases, so nothing needs an npm registry or token.
#
@@@ -108,10 -95,9 +108,10 @@@ jobs
run: |
gh release create "$TAG" \
"packages/agent-controller/dist-package/switch-agent-controller-$VERSION.tgz" \
+ "packages/agent-controller/dist-package/switch-agent-controller-$VERSION.tgz.sig" \
packages/agent-controller/install.sh \
--title "switch-agent-controller $VERSION" \
- --notes "The Switch agents controller $VERSION, for running managed agents on your own Linux or macOS machines.
+ --notes "The Switch agent controller $VERSION, for running managed agents on your own Linux or macOS machines.
- Install (Node 22.13 or later): \`npm install --global https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/switch-agent-controller-$VERSION.tgz\`, or run \`install.sh\`. Then enroll with a code from the Machines page and run \`switch-agent-controller install-service\`. An installed controller updates with \`switch-agent-controller update\`." \
+ Install (Node 22.13 or later) with \`install.sh\`, which checks the package's signature (\`switch-agent-controller-$VERSION.tgz.sig\`) before installing it. Then enroll with a code from the Machines page and run \`switch-agent-controller install-service\`. An installed controller updates with \`switch-agent-controller update\`." \
--latest=false
diff --cc CHANGELOG.md
index a10996bc0,5b4c52ebb..2199b6e26
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -44,30 -44,96 +44,119 @@@ version of their own to them without al
### [Unreleased]
+#### Security
+- **Agents are no longer handed a key that never expires.** Datadog connects
+ with an API key and an application key that do not expire and that only
+ Datadog can revoke, and an agent granted Datadog was handed both. Switch now
+ refuses: Datadog can no longer be connected or granted, and an agent with an
+ existing Datadog grant is told why when it asks. A Datadog connection made
+ before can still be disconnected; revoke the keys in Datadog if they were
+ ever granted to an agent.
+- **Service connections start off in a new workspace.** A workspace created
+ from now on has every service connection switched off until a workspace
+ admin switches each on under Connectors. Workspaces that already had members
+ keep every service on by default, as before, along with every switch an
+ admin already set.
+- **A Google Workspace token is never handed out with more than an hour
+ left,** and one Google issues for longer is refused.
+- **Withdrawing access says what it could not take back.** Removing a grant,
+ disconnecting, or switching a service off for the workspace cannot revoke an
+ Atlassian or Google Workspace token already given to an agent, since that
+ token is the owner's own. The change now marks those tokens withdrawn and
+ its warning names the service and the time until which they may keep
+ working: up to an hour for Google Workspace, and up to eight hours for
+ Atlassian, whose tokens cannot be asked for shorter.
+
+ #### Added
+ - **Templates carry packages.** A room in a template takes `packages:`, a list
+ of packages that already exist, by `id` or by `name`, attached when the room
+ is created. The person running the template must be able to attach each one
+ by hand; a package that is missing, ambiguous or not theirs stops the run
+ before the room exists. A template never creates or changes a package.
+ Capturing a room (`GET /rooms/{id}/yaml`) now lists its packages by `id`,
+ so a room built again from its capture gets them back (#910).
+ - **An agent can read its own addressing policy.** `get_agent_detail` now
+ returns `addressing`: the kind of policy (`owner_only`,
+ `owner_and_owner_agents`, `anyone` or `custom`) and, when an agent looks
+ itself up, its rules with the people, agents and rooms they name. So an
+ agent can tell someone who may answer its questions and approvals instead
+ of guessing. Another agent sees only the kind.
+ - **The Airtable connection.** A person connects Airtable from Switch Console,
+ choosing at Airtable's consent screen which bases and workspaces to share,
+ and a granted agent reads and updates records and comments in them, as that
+ person, through Airtable's MCP server. Each server's operator registers and
+ publishes an Airtable OAuth integration and saves it under Connector apps,
+ or names it in `AIRTABLE_CLIENT_CONFIG_PATH` (Helm:
+ `switchCore.airtableClientSecret`); see `docs/old/airtable-setup.md`.
+ Without it, Airtable is listed as not set up. Like Google Workspace, it
+ needs `GATEWAY_PUBLIC_URL`: Airtable sends people back to the server's own
+ callback. On a server without one, both are listed as unavailable
+ (`needs_public_url`), saying why, rather than failing when someone
+ connects.
+ Airtable offers no read-only sign-in, so every connection can write;
+ changing tables and fields is not asked for, and Airtable refuses it.
+ Airtable cannot revoke a sign-in, and an integration reaches the bases of
+ every grant a person gave it, so a sign-in Switch stops using still works
+ and widens their next connection. Disconnecting or reconnecting says so and
+ where in Airtable to remove it, as any OAuth service without revocation now
+ does rather than reporting a failed revoke.
+ - **Connector apps set up Airtable.** An app's entry in `GET /connector-apps`
+ gains `redirect_uris` (every address to register), `needs_public_url` and
+ `scopes`. The dashboard's Connectors page walks Airtable's Builder Hub, with
+ its redirect URL to copy and the scopes to tick, and saves only once the
+ operator confirms the integration's support details are set: no check can
+ see whether it is published, so a passing one says so. Saving an app
+ answers with its checks too, so the page can show them. A passing Google
+ Workspace check now says it can't see the redirect URI either: Google
+ compares it only when someone signs in.
+
+ #### Changed
+ - **Following the conversation is described the same way everywhere, and the
+ chart can turn it on.** The feature added in 0.31.0 is off unless
+ `follow_the_conversation` is among the enabled feature flags
+ (`FEATURE_FLAGS_ENABLED`, or `switchCore.featureFlags.enabled` in the Helm
+ chart). The Switch skill and the agent runtime's instructions no longer tell
+ agents that a message without their name can never reach them: a person's
+ follow-up can, while other agents' chatter still does not. The chart lists
+ the flag and, while it is on, sets `FOLLOW_THE_CONVERSATION_WINDOW_SECONDS`
+ from `switchCore.followTheConversation.windowSeconds` (default 300).
+ - **Agents name room groups by path.** `create_room` and `create_room_group`
+ take a group as a path such as `Fraud/Incidents` (the top-level group, then
+ each child), so two groups called `Incidents` under different parents no
+ longer break every agent request that names one. A bare name still works
+ when only one group has it; when several do, the error lists each match by
+ its path so the agent can retry with the right one, and an unknown path
+ names the first part that was not found. A group id is accepted too.
+ - **Room group names are unique among siblings.** Creating, renaming or moving
+ a group next to one with the same name (ignoring case) is refused with an
+ error naming the existing group, from the dashboard, the API and agents
+ alike. The same name under different parents is still fine. Deleting a
+ group whose subgroup would move up next to a namesake is refused too, and
+ the dashboard now shows why. Names can no longer contain `/` or be blank.
+ Existing duplicates are left as they are and can be reached by id.
+
#### Fixed
+ - **Agents no longer read offline while their replica shuts down.** With several
+ replicas, a stopping replica released its lease before its 5 s drain, so for
+ up to about 6 s the other replicas counted its connected agents as gone: `@role`
+ mentions did not reach the holder, rooms got false "offline" notices, and stop
+ and reset commands were refused. It now drains first and closes its sockets
+ as it releases.
+ - **A request card posted in a thread now mentions the person who can answer
+ it.** Approval and question cards go into the thread of the turn that raised
+ them, and on Slack they used to mention nobody there, so an owner who was not
+ in the thread was never told and the agent waited. A card in a thread now
+ mentions the person who asked when the agent's addressing policy lets them
+ answer, otherwise the agent's owner if they may answer, otherwise nobody.
+ It never mentions more than one person, even when the policy lets anyone
+ answer. Cards at the top of a channel mention whoever asked, as before.
+ - **`!list-references` and `!list-documents` include what packages bring.**
+ They listed only what was attached to the room directly, so a room whose
+ references all came from a package answered "No references in this room."
+ while its agents were sent them. Items from attached packages now follow
+ the direct ones, each marked with the package it comes from (for example
+ `(github, via Payments service context)`); an item attached both ways is
+ listed once, as direct (#911).
- **The template guide agents read now covers a room's `roles:`,
`references:` and `docs:`.** All three already worked in a room resource
and appear when a room is captured, but the guide stopped at `aliases:`, so
diff --cc core/switch_core/connections/broker.py
index a10da8f8b,f961a98d1..70c3284cb
--- a/core/switch_core/connections/broker.py
+++ b/core/switch_core/connections/broker.py
@@@ -1213,8 -1157,13 +1217,15 @@@ class ServiceBroker
reason = self._disabled.get(service)
if reason is not None:
return Unavailable("switched_off", reason)
+ if not _issued_to_agents(entry):
+ return Unavailable("key_never_expires", _never_expires(name))
+ oauth = entry.definition.auth.oauth
+ if (
+ oauth is not None
+ and self._public_url is None
+ and "loopback" not in oauth.redirect
+ ):
+ return Unavailable("needs_public_url", needs_public_url(name))
adapter = self._adapters.get(service)
if adapter is None:
kind = app_kind(entry.definition)
diff --cc core/tests/switch_core/gateway/test_workspace_services.py
index 5bcaba2bc,304350a08..de7dd45ef
--- a/core/tests/switch_core/gateway/test_workspace_services.py
+++ b/core/tests/switch_core/gateway/test_workspace_services.py
@@@ -233,15 -232,18 +233,21 @@@ class TestRequests
class TestResults:
- async def test_untouched_services_read_on_with_nobody_named(
- self, harness: Harness
+ @pytest.mark.parametrize("on_by_default", [False, True])
+ async def test_untouched_services_take_the_workspaces_default_with_nobody_named(
+ self, harness: Harness, on_by_default: bool
) -> None:
+ if on_by_default:
+ await services_on_by_default(harness.session_factory)
admin = await _person(harness.session_factory, "admin", member_role="admin")
services = _by_slug(await _get(harness, admin))
- assert set(services) == {"atlassian", "datadog", "github", "google-workspace"}
+ assert set(services) == {
+ "airtable",
+ "atlassian",
+ "datadog",
+ "github",
+ "google-workspace",
+ }
assert services["datadog"] == {
"slug": "datadog",
"name": "Datadog",