Skip to content

fix(FR-2899): disable session row actions on access key mismatch#7424

Open
yomybaby wants to merge 3 commits into
mainfrom
05-15-fix_fr-2899_disable_session_row_actions_on_access_key_mismatch
Open

fix(FR-2899): disable session row actions on access key mismatch#7424
yomybaby wants to merge 3 commits into
mainfrom
05-15-fix_fr-2899_disable_session_row_actions_on_access_key_mismatch

Conversation

@yomybaby
Copy link
Copy Markdown
Member

@yomybaby yomybaby commented May 15, 2026

Resolves #7423 (FR-2899)

Summary

Sister fix to FR-2586 (#7409): when the user has switched keypairs after a session was created, per-session manager APIs return 403 Forbidden with "Only admins can perform operations on behalf of other users.". Today the session row's action buttons (view logs, terminate, app launcher, terminal, container commit, SFTP) still look enabled — the user only discovers the problem after clicking and gets a backend error that reads as if they don't own the session (they do — they're just acting under a different access key).

This change detects the mismatch on the client (session.access_key !== baiClient._config.accessKey) and disables those buttons up front, with a tooltip explaining the cause and the recovery path. FR-2586 already produced a friendly post-failure error for app launch; preemptive disable is preferable because the user no longer has to attempt the action first.

Implementation

react/src/components/ComputeSessionNodeItems/SessionActionButtons.tsx:

  • Added isAccessKeyMismatch derived from session.access_key vs baiClient._config.accessKey.
  • Added a resolveTooltip(defaultTitle) helper that swaps the tooltip text for the explanation message when the mismatch is in effect, otherwise returns the original title.
  • ORed isAccessKeyMismatch into the disabled prop of every per-session action button: logs, terminate, app launcher, terminal, SFTP, container commit, and the two primary-app buttons (Jupyter / File browser).
  • Routed every action-button tooltip (both Tooltip title and the title HTML attr used in isButtonTitleMode) through resolveTooltip.
  • Suppressed the terminate icon's danger color when the button is disabled by mismatch (consistent with how it dims when isActive is false).

resources/i18n/*.json (21 locales): added session.AccessKeyMismatchTooltip with native translations.

Test Plan

  • As a user with multiple keypairs, create a session under access key A, switch to access key B, open the sessions list. All row buttons (logs, terminate, app launcher, terminal, container commit, SFTP where applicable) are disabled with the explanatory tooltip.
  • Click any disabled button — nothing happens; no 403 surfaces.
  • Switch back to access key A. All buttons re-enable with their original tooltips. Logs / terminate / app launch behave as before.
  • System session row (only SFTP visible) is also gated by the mismatch.
  • bash scripts/verify.sh passes (no new TypeScript / lint / format / Relay errors introduced).

Copy link
Copy Markdown
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added area:ux UI / UX issue. area:i18n Localization size:L 100~500 LoC labels May 15, 2026
@yomybaby yomybaby marked this pull request as ready for review May 15, 2026 02:33
Copilot AI review requested due to automatic review settings May 15, 2026 02:33
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

Coverage Report for react-coverage (./react)

Status Category Percentage Covered / Total
🔵 Lines 6.44% 1783 / 27644
🔵 Statements 5.3% 1978 / 37280
🔵 Functions 5.17% 296 / 5715
🔵 Branches 3.71% 1293 / 34830
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
react/src/components/SessionNodes.tsx 0% 0% 0% 0% 42-391
react/src/components/ComputeSessionNodeItems/SessionActionButtons.tsx 0% 0% 0% 0% 57-488
Generated in workflow #745 for commit 46838e2 by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to prevent session actions from surfacing backend 403 errors when the selected access key differs from the key used to create a session.

Changes:

  • Adds access-key mismatch detection and disables affected SessionActionButtons.
  • Replaces action tooltips with an explanatory i18n message when mismatch applies.
  • Adds session.AccessKeyMismatchTooltip translations across locale files.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
react/src/components/ComputeSessionNodeItems/SessionActionButtons.tsx Adds mismatch gating and tooltip routing for session actions.
resources/i18n/en.json Adds English tooltip text.
resources/i18n/de.json Adds German tooltip text.
resources/i18n/el.json Adds Greek tooltip text.
resources/i18n/es.json Adds Spanish tooltip text.
resources/i18n/fi.json Adds Finnish tooltip text.
resources/i18n/fr.json Adds French tooltip text.
resources/i18n/id.json Adds Indonesian tooltip text.
resources/i18n/it.json Adds Italian tooltip text.
resources/i18n/ja.json Adds Japanese tooltip text.
resources/i18n/ko.json Adds Korean tooltip text.
resources/i18n/mn.json Adds Mongolian tooltip text.
resources/i18n/ms.json Adds Malay tooltip text.
resources/i18n/pl.json Adds Polish tooltip text.
resources/i18n/pt-BR.json Adds Brazilian Portuguese tooltip text.
resources/i18n/pt.json Adds Portuguese tooltip text.
resources/i18n/ru.json Adds Russian tooltip text.
resources/i18n/th.json Adds Thai tooltip text.
resources/i18n/tr.json Adds Turkish tooltip text.
resources/i18n/vi.json Adds Vietnamese tooltip text.
resources/i18n/zh-CN.json Adds Simplified Chinese tooltip text.
resources/i18n/zh-TW.json Adds Traditional Chinese tooltip text.

Comment thread react/src/components/ComputeSessionNodeItems/SessionActionButtons.tsx Outdated
Comment thread react/src/components/ComputeSessionNodeItems/SessionActionButtons.tsx Outdated
Comment thread react/src/components/ComputeSessionNodeItems/SessionActionButtons.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:i18n Localization area:ux UI / UX issue. size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable session row actions when access key differs from current user's keypair

2 participants