fix(web): a room can never be the selected bench (CL-8551) - #920
Merged
Merged
Conversation
resolveSelection/isBenchMembership used to treat any non-raw-id tenant name as a bench, but rooms are named child tenants too — once selectTenant ran with a room id, the room satisfied the same check and became the selected bench, so /new, "+ Create agent", and the Agents page all operated inside the room. A bench is now defined as a top-level tenant: GET /api/tenants/:id's parentId, fetched once per membership and never guessed from the tenant's name. BenchProvider exposes the resolved set as benchMemberships, which the command palette's switch-workbench and the global Routines aggregation now read instead of re-deriving their own name-based filter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resolveSelection/isBenchMembershiptreated any tenant with a non-raw-id name as a bench. Rooms are named child tenants, so onceselectTenantran with a room's id (command palette'saction:switch-workbench→nextWorkbench), the room satisfied the same check and became the selected bench —/new, "+ Create agent", and the Agents page then all operated inside the room.GET /api/tenants/:tenantId'sparentId(already returned by the vendored route,TenantResponsein@intx/types), fetched once per membership viauseQueriesinBenchProvider.isBenchMembership/resolveSelectionnow take aparentByTenantIdmap and never guess from the tenant name.BenchProviderexposes the resolved set asbenchMembershipsonBenchState. The command palette'sswitch-workbenchand the global Routines aggregation (global-routines.ts) now readbenchMembershipsinstead of re-deriving their own name-based filter — both used to importisBenchMembershipdirectly.resolveSelectionunit tests and replaced them with parent-based ones, including one asserting a room can never resolve as the bench even when it is the stored id, and one for an unresolved parent (never guessed as a bench).Test plan
bun run check(typecheck, lint, fmt, test) passesbun test apps/web/src/bench-context.test.ts(7 pass)