Skip to content

Workspaces phase 2j: what the fifth review of phase 2 found (#277) - #328

Merged
antiv merged 3 commits into
mainfrom
workspaces-2j
Nov 7, 2026
Merged

antiv merged 3 commits into
mainfrom
workspaces-2j

Conversation

@antiv

@antiv antiv commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

The fifth security review of phase 2 (cb8a218..e194602, 2a–2i) found the paths below. Each new test in TestFifthReviewOfPhase2 fails without its fix.

Fixed

  • Slack roles from before 1.6 led to escalation. _carry_over_roles copied every role of the legacy slack_<U> user, admin included, into the agent's workspace, whichever it was. Another workspace's admin sets the signing secret of their own integration, so they could sign an event naming a legacy admin's Slack id and get a user with the admin role. Roles now carry over only for an agent of the default workspace, where the old id lived; 1.x is unchanged. The 2h test now runs on workspace A.
  • Lazily streamed model answers. Some providers send the request only when the first chunk is read, after acompletion() has returned and the guard is off: gemini/ and vertex_ai through LiteLLM, codestral, predibase. LangGraph always streams. GuardedCompletions now returns a _GuardedStream whose __anext__/__next__ also run guarded. LiteLLM callbacks would inherit the guard, but MATE registers none.
  • Agent tools. create_agent and update_agent need the admin role, but an agent outside the default workspace follows its workspace admin's instruction. A platform admin testing it could have been led to write ${SECRET} into an MCP header. For an agent outside the default workspace:
    • update_agent refuses platform-only features (features_added);
    • create_agent refuses a name with a folder in agents/;
    • every workspace checks is_agent_name.
  • Rename. The old name was free while its sessions, ratings, keys, triggers and Slack integrations stayed under it. An agent another workspace created with that name read the old conversations.
    • agent_cleanup.rename_agent_rows (agent update and rollback) moves every row delete_agent_rows would remove, plus the ratings, to the new name. It first deletes rows a former agent left under the new name.
    • ADK's events reference their session with no ON UPDATE, so sessions are copied under the new name, the events moved, and the old sessions deleted.
  • 1.x regression in Evals → feedback. Ratings of hardcoded agents, and of agents deleted in Default, had disappeared. A name with no config now counts as the default workspace's, as it does everywhere else.
  • Replay picker. It also reads the spans carrying mate.workspace.id, so the 2i check sees them.
  • Small fixes.
    • may_run_code and the outbound checks share outbound.workspace_of_run.
    • /gdrive/mcp uses pat_auth.is_platform_admin, which counts the built-in account.
    • Type hints added.

Not changed

delete_agent_rows still keeps logs, as decided for 1.6.

Rows left by 1.x renames

Rows an agent renamed under 1.x left under its old name belong to the default workspace. An agent of another workspace may not take such a name (DashboardServer._name_unavailable, agent_cleanup.left_behind).

  • These paths now answer "this name is taken": agent create and rename, import, clone, template import and sync, and the create_agent tool.
  • Ratings don't count: the eval pages keep them to their project, so a workspace can recreate an agent it deleted.
  • A trace counts only when none of its spans records a workspace, as before V046.
  • The default workspace takes such a name, as in 1.x.

Tests

  • Full suite: 1883 OK, 1 skipped.
  • test_client_contract.py: 12/12, unchanged.
  • gen_docs.py --check: OK.

Docs

Updated:

  • docs/dev/auth-and-access.md;
  • docs/user/slack.md, agents.md;
  • documents/design/2.0-plan.md.

Listed by drift but still accurate:

  • docs/user/evals.md, sessions-and-traces.md, trace-replay.md: what the pages show, as described.
  • docs/user/personal-access-tokens.md, docs/dev/openai-api-and-mcp.md, openai-compatibility.md: is_platform_admin is the same rule, moved into a function.
  • docs/dev/mcp-servers.md: the 2i sentence on /gdrive/mcp holds.
  • docs/user/triggers.md, docs/dev/trigger-engine.md, alerts.md, template-format.md: only type hints and the update helper changed.

antiv added 3 commits November 7, 2026 16:57
- Slack roles from before 1.6 carry over for an agent of the default workspace
  only. Another workspace's admin sets their integration's signing secret, so
  they could name a legacy admin's Slack id and get a user with the admin role.
- A streamed model answer is read guarded too (_GuardedStream): gemini and
  vertex_ai through LiteLLM, codestral and predibase send the request on the
  first read, after acompletion() returned.
- create_agent and update_agent, run by an agent outside the default workspace,
  refuse platform-only features (features_added) and names with a code folder;
  every workspace checks is_agent_name.
- A rename (update or rollback) moves the agent's rows to the new name
  (agent_cleanup.rename_agent_rows): links, settings, ratings, credentials,
  memory and conversations on both runtimes; ADK sessions are copied, their
  events moved, the old sessions deleted.
- Ratings of an agent with no config count as the default workspace's, as in
  1.x; the replay picker reads the spans that record mate.workspace.id.
- may_run_code and the outbound checks share outbound.workspace_of_run;
  /gdrive/mcp uses pat_auth.is_platform_admin; type hints.
…side Default (#277)

Rows an agent renamed under 1.x left under its old name belong to the default
workspace. An agent of another workspace may not take such a name
(DashboardServer._name_unavailable, agent_cleanup.left_behind): agent create and
rename, import, clone, template import and sync, and the create_agent tool say
"this name is taken". Ratings don't count (the eval pages keep them to their
project), nor a trace that records its workspace; the default workspace takes
the name as in 1.x.
@antiv antiv closed this Nov 7, 2026
@antiv antiv reopened this Nov 7, 2026
@antiv
antiv merged commit 60f6c52 into main Nov 7, 2026
4 checks passed
@antiv
antiv deleted the workspaces-2j 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