Skip to content

Workspaces phase 2f: what the review of phase 2 found (#277) - #321

Merged
antiv merged 1 commit into
mainfrom
workspaces-phase-2f
Nov 3, 2026
Merged

antiv merged 1 commit into
mainfrom
workspaces-phase-2f

Conversation

@antiv

@antiv antiv commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Part of #277. A review of phases 2a–2e together (cb8a218..b1e3fef) found the paths below. Each has a test that fails without the fix: TestReviewOfPhase2 in shared/test/test_cross_workspace.py, and test_an_agents_tasks_are_not_found_through_another_agent in shared/test/test_a2a_routes.py.

Cross-workspace paths

  • A subagent ran code outside the default workspace. A subagent made by delegation is named subagent_xxxxxx and has no row, so may_run_code() treated it as a hardcoded agent. It now judges a config by its project_id (the parent's), and refuses a project that doesn't exist.
  • Work Room title. session_id went into the agent-server URL unescaped, and httpx resolves ... A member of A could read the first message of a session of B and write its title. Agent, user and session id are now each escaped whole.
  • Ratings. POST /dashboard/api/feedback with no agent_name skipped the workspace check. With one of A's agents, it could point the eval pages at B's session. A rating now needs agent_name and a session of the caller with that agent; the chat already sends both.
  • Session ids shared by two agents. ADK keys a session by (app, user, id), and a client may choose the id. Detail looked a session up by id and read every event with that id, and delete removed all of them. Both now use the whole key of the session checked. The rated-answer pages read events by session and agent.
  • Widget lookalikes. caller_access() took any widget_<n>_… id for a visitor of key n. Since SSO uses the email as the id, [email protected] reached key 7's workspace. A visitor now also needs the widget role, which only the server gives out (V017 gave it to existing visitors). SSO and Users refuse ids starting with widget_ and trigger_runner.
  • A2A tasks. Every agent shared one InMemoryTaskStore, and the proxy checks only the agent in the path, so tasks/get and tasks/cancel reached other agents' tasks. Each agent now has its own store.

Other findings

  • Slack: UNIQUE (team_id) stays; the first workspace to connect a team keeps it. The 409 now says to ask a platform administrator, who can switch to the workspace holding it. Checking the bot token with Slack's auth.test would stop a workspace from claiming a team it doesn't control; it is left for later.
  • ${VAR}: the defining part of a ${VAR} reference was the model key, model base URL and MCP config taken together, so a workspace admin could not edit an unrelated MCP server. It is now each place that holds a placeholder, with where its value is sent.
  • X-MATE-Workspace: ²: isdigit() accepts digits that int() rejects, so this answered 500. It is now a 404.
  • One request context per request: context_for() keeps it on request.state, so the route reuses the workspace the middleware resolved.

Plan

documents/design/2.0-plan.md now records 2e (#320) and 2f, and ships phases 3 and 4 in 2.0.0.

Checks

  • Full suite: 1843 tests, OK (1 skipped).
  • test_client_contract.py is unchanged and passes.
  • 1.x upgrade test: a 1.6.0 database with real data (52 agents, about 2,000 usage rows, 289 sessions) on v1.6.0 and on main. Of 152 GET routes, 150 answer the same; the other two differ only by the new workspace routes and two migrations. The workspace backfill fills every row that has a project.
  • gen_docs.py --check passes. Drift: docs/dev/auth-and-access.md, docs/dev/a2a.md and docs/user/slack.md are updated. These still hold:
    • alerts.md, template-format.md and writing-a-tool.md: the dashboard and tool factory changes don't touch what they describe;
    • code-executor.md: the refusal it describes is unchanged; the subagent case is in auth-and-access.md;
    • database-and-migrations.md: no migration;
    • sso-setup.md: the reserved ids are in auth-and-access.md.

A review of phases 2a-2e together (cb8a218..b1e3fef) found these cross-workspace
paths and 1.x differences; TestReviewOfPhase2 and test_a2a_routes cover each.

- may_run_code() judges a config by its project_id. A subagent made by delegation
  has its parent's project and a name with no row, so it ran the code executor and
  stdio MCP servers for an agent outside the default workspace.
- The Work Room title escapes agent, user and session id in the agent-server URL:
  httpx resolves '..' in a path, so a session id could name another workspace's
  session, read its first message and write its title.
- A rating needs agent_name and a session of the caller with that agent; before, a
  rating with no agent skipped the workspace check, and one through an agent of A
  could point the eval pages at B's session.
- Session detail and delete use the whole ADK key (app, user, id) and read only the
  checked session's events; the rated-answer pages read events by session and agent.
- A widget visitor is a widget_<key id>_ id with the widget role, which only the
  server gives out (V017 gave it to the earlier visitors). Single sign-on and
  Users refuse ids starting widget_ and trigger_runner (is_reserved_user_id).
- Each agent gets its own A2A task store, so tasks/get and tasks/cancel through one
  agent find none of another's.
- A Slack team stays with the first workspace to connect it; the 409 says to ask a
  platform administrator.
- The ${VAR} defining part is each place holding one, so editing an MCP server
  without a placeholder is no longer refused.
- X-MATE-Workspace with a non-ASCII digit is a 404, not a 500.
- The request context is made once a request: the middleware's is reused.

The plan now ships phases 3 and 4 in 2.0.0 too, and records 2e (#320) and 2f.
test_client_contract.py is unchanged and passes.
@antiv antiv mentioned this pull request Nov 3, 2026
22 tasks done
@antiv
antiv merged commit 797c317 into main Nov 3, 2026
2 checks passed
@antiv
antiv deleted the workspaces-phase-2f branch November 22, 2026 07:26
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.

1 participant