Skip to content

fix(rooms): every principal's access is re-checked at wake time (trinity-enterprise#860) - #3843

Merged
vybe merged 3 commits into
devfrom
fix/ent860-room-wake-access
Oct 20, 2026
Merged

vybe merged 3 commits into
devfrom
fix/ent860-room-wake-access

Conversation

@dolho

@dolho dolho commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

A room re-checks the sender's access to an agent at wake time, so that a change in access stops future wakes even inside a room the sender already belongs to. That re-check ran for Workspace principals only. It now runs for every principal, using the same rule room creation applies:

  • _assert_can_reach_agent, as the new predicate _can_still_reach;
  • the portal roster for a Workspace principal;
  • the platform ACL for everyone else.

An agent that fails the check is not woken, and the room gets the existing "could not be reached" line. The transcript is unchanged.

An agent's reply carries the person whose turn started the chain, so a cascade of agent-to-agent mentions is held to that person's access too.

Changes

  • src/backend/shared_sessions/service.py: _can_still_reach, and the wake-time check in _after_landing applied to every principal.
  • tests/unit/test_ent860_room_wake_access.py (new, 6 tests), plus its tests/registry.json entry.

Test Plan

  • cd tests && pytest unit/test_ent860_room_wake_access.py: 6 pass, through the real _after_landing with only the wake, the wake cap and the system-line writer stubbed.
    • A platform member with access wakes the agent; one without access does not, and the room gets the line.
    • A Workspace principal is held to its roster, never the platform ACL.
    • An agent reply is held to the access of the person whose turn started the chain.
    • A deleted agent is not woken.
  • Mutation: reverting the service turns the 3 platform and agent-chain tests red. The 3 Workspace tests pass either way, because that path was already checked.

Fixes abilityai/trinity-enterprise#860

🤖 Generated with Claude Code

dolho and others added 2 commits October 20, 2026 16:57
…ity-enterprise#860)

The wake-time access re-check in shared_sessions._after_landing ran for
Workspace principals only, on the reasoning that a platform member's access
was resolved when the room was created. Access can change after that, so a
room now asks every principal the question room creation asks
(_assert_can_reach_agent, as the predicate _can_still_reach) before each
wake: the portal roster for a Workspace principal, the platform ACL for
everyone else. An agent that fails it is not woken and the room gets the
existing "could not be reached" line. An agent's reply carries the person
whose turn started the chain, so a cascade is held to that person's access.

Mutation: reverting the service turns the 3 platform and agent-chain tests
red; the Workspace tests pass either way, as that path was already checked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…check (trinity-enterprise#860) — mechanical

The source pin asserted `agent_on_roster` appears in `_after_landing`. #860
replaced that inline portal-only check with `_can_still_reach` ->
`_assert_can_reach_agent`, which still reads the roster. Pin the new chain
link by link instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vybe

vybe commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-10-20): I pushed one commit to this branch, 62725a43.

What it fixes. CI's regression diff was failing on test_ent362_workspace_participant::test_the_wake_controls_are_actually_wired_into_the_post_path. That test checked that agent_on_roster appears in _after_landing. This PR moved the roster read behind _can_still_reach → _assert_can_reach_agent, so the pin was stale and no behaviour was lost. The commit now pins each link of that chain. Locally, ent362 and ent860 pass: 29 tests.

Decision taken at the merge gate. A wake started by an agent posting directly (MCP post_to_room) is now held to that agent's own reach (agent_may_reach): itself, a permission edge, or an agent it spawned. In practice, agent A mentioning @b in a human-created room no longer wakes B unless A may reach B. This was accepted as intended, consistent with ent#629. @dolho, please confirm after the merge. A follow-up test with an agent principal (the current tests stub assert_agent_access) would pin it.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train: validated at 39d7b68 plus two merge-train commits (stale ent362 pin re-pointed; dev merged with registry.json rebuilt). Agent-principal reach at wake time accepted at the gate as intended — see comment above.

@vybe
vybe merged commit 1c56ffb into dev Oct 20, 2026
27 of 29 checks passed
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.

3 participants