Skip to content

feat(web): profile scope on Tools, Activity, Sessions and Usage (Spec 108-j) - #1448

Merged
github-actions[bot] merged 18 commits into
mainfrom
108-j-webui-profile-scope-ui
Oct 1, 2026
Merged

github-actions[bot] merged 18 commits into
mainfrom
108-j-webui-profile-scope-ui

Conversation

@Dumbris

@Dumbris Dumbris commented Oct 1, 2026

Copy link
Copy Markdown
Member

What changes for the user

Spec 108-j (specs/108-profiles-v3, tasks T104 to T109a) puts the profile, client and token filters on the pages that did not send them yet. Spec 109-k registered the parameters and 108-e advertises them, but only the Sessions view sent them to the backend.

Tools

  • /ui/tools?client= and ?profile= now call GET /tools with that subject. Before, the page loaded the unfiltered list.
  • An administrator sees every tool with the subject's verdict: a state badge (Callable, Not callable, Hidden), the reason in words (for example "Denied by rule", "Server not in profile", "Above tier cap") and a "Why?" button that opens the access explainer. A status banner reads "Viewing as Cursor (Work · Read-only): N visible · N callable · N hidden" and says that nothing on the page changes the subject's access. A page-local "Show: All, Callable, Not callable" control narrows the rows.
  • A tenant viewing a profile gets the visible rows and "N tools hidden by this profile". There is no reason and no "Why?".
  • A "View as" select writes the same URL parameters the header Viewing chip writes. Naming both a client and a profile is a two-button conflict state with no request. client=-, profile=- and a tenant client= are disabled chips that are never sent. A 404 is an inline "Client not found" or "Profile not found" with "Clear filter". Selection and batch actions are disabled while viewing as a subject.
  • The banner says how many disabled servers are not listed (Follow-ups from Spec 108-e scope attribution review (#1436) #1437 item 2).

Activity

  • The list, the 24h summary and the export send profile, client and token. Removable chips and Profile, Client and Token pickers (with "Unattributed") write the URL.
  • Each row has a Scope column (client, profile with how it was resolved, token); the client's own credential client-<id> is not repeated as a token chip. Below the md breakpoint the same chips are in the detail drawer's new Attribution section.
  • A blocked row offers "Allow in profile…" (the profile editor focused on the tool), "Open profile…" for code execution and management refusals, and "Why?", which asks the explainer about the record's client, else its token, else an anonymous caller, else its recorded profile. The dialog says it evaluates the current configuration.
  • A blocked filter on the Tool calls view now also asks for policy_decision records. A call a profile refuses is stored as one, so the view used to hide exactly the rows the filter asks for.

Sessions

  • The table shows the client (display name, a link to Clients), the profile with its source and the token, and a "Tools it sees" link that opens Tools as that client.

Usage

  • Sends the three parameters, shows the chips and pickers, and replaces the tokens-saved tile with "not computed for a filtered view" under a scope, because the backend zeroes that field and "0 saved" would be false.

All pages: a URL that names a profile, client or token waits for GET /status before its first fetch, so no unfiltered request precedes the filtered one (rule 1). When the feature list never arrives in 2 seconds the filter stays hidden and the page shows a disabled "Filter unavailable on this server" chip.

Backend (#1437 item 3): a scoped SSE subscriber's own activity.internal_tool_call.completed frame now carries its attribution. The session records the credential's display prefix and the internal-tool funnel reads it back, only for the token name the session recorded.

Findings fixed

Audit UX findings on scope consistency (the "profile filter ignored on Tools, Usage and Activity" family) and #1437 items 2, 3 and 4. Refs #1437 (items 1 and 5 stay with 109-l).

Specs

specs/108-profiles-v3: tasks T104 to T108a ticked, T109 and T109a added (they close with the live run), D37 records J1 to J20, FR-032, FR-045, FR-046 and the US3 reason words are amended, the quickstart 108-j recipe is extended, ROADMAP.md is regenerated.

Deviations from the plan

  • 108-i shipped the sweep seed as e2e/web-ui-sweep/profiles-seed.ts; profiles-scope.spec.ts extends it additively instead of adding helpers/profile-seed.ts.
  • AccessExplainer already accepted every subject kind (J17), so it only gains title and note props and a stale-response ticket (Follow-ups from Spec 108-i Web UI profiles review (#1444) #1446 F5.2).
  • One reason map: utils/profiles.ts reasonText is extended with the remaining access reasons; accessReasonLabel adds the row-dependent "Disabled". The word for unannotated_hidden stays "Unannotated — hidden" (the existing editor word).
  • A tool the subject cannot call is marked by a tinted row, not opacity, because opacity dropped the row's text under AA contrast (the contrast sweep caught it).
  • The J15 fix is on the session (SetSessionTokenPrefix), not the request context: the internal-tool funnel has about 60 call sites and no context.
  • /tools request ordering is asserted by holding the scoped answer back and checking that no rows render, because the sidebar issues its own unscoped tool-count request.

Tests added

  • Vitest: tools-view-as, activity-attribution, activity-scope-params, sessions-attribution, usage-scope-params, scope-chips, scope-features-wait, scope-params-api, access-reason-label. The existing activity-sessions-scope-params case "does not send scope params outside the Sessions view" is inverted on purpose: the calls view now narrows /activity, and the general /sessions fetch that feeds name resolution stays unscoped.
  • Go: TestInternalToolCall_AttributionCarriesTokenPrefix, TestInternalToolCall_NoCredentialCarriesNoTokenPrefix, TestSSEInternalAttribution.
  • Playwright: e2e/web-ui-sweep/profiles-scope.spec.ts (registered in scripts/run-web-smoke.sh), plus the scoped Tools and Activity pages in the contrast sweep.

Review

Cross-model review with codex gpt-6-luna, read-only, in six chunks over three rounds. The last round of every chunk has no critical or high finding. Verified false positives that were not changed: "Tools it sees" for a build that advertises only profile and token (the link needs the client filter itself, now pinned by a test) and a profile_missing block reason (it is not a block reason in the backend). The 2 second fallback of waitForScopeFeatures is plan decision J3 and is documented in stores/system.ts. Low leftovers: the scope sweep seed overwrites and then clears an instance's existing anonymous_profile, the same pattern as the 108-i seed.

…on (Spec 108-j)

A scoped SSE subscriber's own activity.internal_tool_call.completed event
carried no ownership proof, so its attribution was withheld. The session now
records the credential's display prefix and the ctx-less internal-tool funnel
reads it back, only for the token name the session itself recorded.
… 108-j)

Tools sends client/profile to GET /tools and renders the subject's verdict per
row (administrator) or a hidden count (tenant), with a Why? that opens the
access explainer. Activity, the Sessions table and Usage send profile, client
and token, show them as removable chips and pickers, and Activity rows carry
attribution chips plus Allow in profile and Why? on a blocked call. A page
whose URL names a scope waits for /status so the first request is filtered.
…rows readable (Spec 108-j)

A call a profile refuses is stored as a policy_decision, so the Tool calls view
hid exactly the rows a blocked filter asks for; the blocked filter now includes
them. Tools view-as marks a tool the subject cannot call with a tinted row
instead of opacity, which dropped its text under AA contrast, and the Sessions
table folds its capabilities column away below 2xl and wraps its actions.
Adds e2e/web-ui-sweep/profiles-scope.spec.ts (seeded through profiles-seed.ts),
registers it in the web smoke script, extends the contrast sweep to the scoped
Tools and Activity pages, ticks T104-T108a, records D37 and amends FR-032,
FR-045, FR-046 and the quickstart recipe.
…gate (Spec 108-j)

Ticks T109 and T109a (the sweep ran green against a built binary), adds the
both-subjects scenario to profiles-scope.spec.ts, pins that Tools it sees needs
the client filter itself and documents why waitForScopeFeatures times out.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

- F3.2: runIdentity() now keys on client_id, client_name, profile,
  profile_source and token_name, so repeat folding never shows one caller's
  attribution chips for another caller's calls (FR-029).
- F5.1: "Tools it sees" clears the sticky profile param (linkTo treats an
  empty patch value as "drop this param"), so it no longer opens the
  two-subject conflict state.
- F5.2: after the startup /status wait, any scope param named in the URL and
  still unavailable gets the disabled "Filter unavailable on this server"
  chip, including when /status failed or does not advertise scope_filters.
  The three rule-7 tests now assert the disabled chip instead of no chip.
- F3.1/F4.1/F2.1: Activity, Usage and Tools loaders (loadActivities, reload,
  loadTools) wait on a ready promise released by firstLoad(), so SSE events,
  window/status/sort controls and Refresh cannot send an unfiltered request
  during the startup wait; the action runs once the wait ends.
- F2.2: Tools resets to page 1 on Show and view-as subject changes and
  clamps the page when the result shrinks.
CodeQL alert 640 (js/insecure-randomness): the element ids were built from
Math.random. useId() gives the same per-instance uniqueness deterministically
(SSR-safe). A vitest assertion mounts two instances and checks the ids differ
and each label targets its own select.
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 108-j-webui-profile-scope-ui

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (28 MB)
  • archive-linux-amd64 (18 MB)
  • archive-linux-arm64 (17 MB)
  • archive-windows-amd64 (31 MB)
  • archive-windows-arm64 (27 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (26 MB)
  • installer-dmg-darwin-arm64 (24 MB)
  • smart-mcp-proxymcpproxy-goO96648.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 36858585017 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/server/session_store.go 71.42% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

…der the explainer (Spec 108-j)

The drawer panel was a fixed 500px, so at 390px its left 110px sat off-screen
and clipped the new Attribution section and the Allow in profile / Why? actions.
It is now full width capped at 500px. Escape pressed in the access explainer
opened from the drawer also closed the drawer, dropping focus to body; the
explainer now owns Escape while open and focus returns to the Why? button.
Adds unit tests and drawer bounding-box and focus assertions to the live sweep.
- Home: live-client age text uses text-base-content/60 (AA contrast)
- Activity: Scope column from xl, narrower; below xl the drawer carries the chips
- Activity: no duplicate /activity and /activity/summary requests on a scope change
- Tools: no view-as banner over a profile/client not found alert
- Tools/spec: disabled-server banner and FR-032 describe the real listing behaviour
- sweep: assert the Activity table fits its card at 768+
QA.0: already merged. origin/main (including #1442) is an ancestor of the head,
no conflict markers remain in specs/ or ROADMAP.md, and GitHub reports
mergeable.

QA.1: the sweep no longer depends on spec order. profiles-seed.ts now opens the
seed MCP session through openMcpSession() and closes it (HTTP DELETE) once the
calls are made, so no live "Connected" client lingers on Home. New tests: a
profiles-scope check that the seeded session is closed (fails when the close is
removed), and visual-a11y-sweep "contrast AA: / with a live MCP client" in both
themes, which opens a live session on purpose (fails at 3.32:1 with the old
opacity-50 timestamp, verified by rebuilding with it). Home's timestamp on this
head is already text-base-content/60 and measures above AA in both themes, so
no Home.vue change was needed.

QA.2: the Scope column already folds below xl, but the inline "Why?" button in
the Status cell still overflowed the card by 23px at 1024px (sidebar open). It
now shows from xl only; the drawer carries Why? at every width. The layout
sweep covers 1440, 1280, 1100, 1024, 900, 768 and 390 and asserts the inline
button's visibility per width.

QA.3 and QA.4: already fixed on this head (banner says a disabled server's tools
"may not be listed", FR-032 says the same; the view-as banner is hidden under
the Profile/Client not found alert). Both are covered by tools-view-as.spec.ts.

QA.5: not reproducible on this head (one /activity and one /activity/summary
request per profile pick, verified in a browser); covered by the existing
"picking a profile in the filter panel" vitest.

F2.3: ScopeFilterSelects loads the token and client lists when a picker first
becomes visible (watch on the shown list), not only in onMounted. New vitest
scope-filter-selects-late-features.spec.ts fails without the fix.
…f clipping both ends (Spec 108-j)

The chips were inline-flex badges with truncate on the badge itself, which
cannot ellipsise: a long profile label was cut at both ends in the Activity
Scope column at 1280/1440px. The label now truncates in an inner span, and
the layout sweep asserts no chip has scrollWidth > clientWidth or leaves its cell.
The attribution chip fix (inner truncating span, ellipsis, full text in title)
and its layout assertion were already on the branch; the assertion was verified
to bite: against the previous AttributionChips.vue the 1440px sweep fails with
'attribution-profile content 202 > box 180', against the fixed one all 98
sweep tests pass.

Merging origin/main changed emitActivityInternalToolCall to take a context
first, which broke the build of internal/server tests; the 108-j attribution
test now passes context.Background(). ROADMAP.md and the 108 task count were
reconciled after the merge.

Deferred: shortening the 'locked by credential' source label (the full text
stays in the title; no clipping remains).

@github-actions github-actions Bot 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.

Approved (Model B): Paperclip review verdicts = ACCEPT and qa-gate green at this head SHA. Arming auto-merge; GitHub merges when all required checks pass.

@github-actions
github-actions Bot merged commit 9bff2f3 into main Oct 1, 2026
67 of 68 checks passed
github-actions Bot pushed a commit that referenced this pull request Oct 2, 2026
…on Servers and row links (Spec 109-l) (#1457)

## Summary

Spec 109-l (specs/109-ux-navigation-consistency, Phase 14, T151 to T159)
integrates Spec 108 into the needs-attention list and renders the three
link-map rows that 109-k registered but never showed. It also fixes two
items of #1437.

Spec 108 warnings now appear as needs-attention items, ranked 4 to 9 so
they sit above every server item. They come from the same function that
fills the Clients page banner, so the two cannot disagree, and they
never read a client config file.

Closes #1437 (items 2, 3 and 4 landed with 108-j in #1448; this PR owns
items 1 and 5).

## User-visible changes

**Core, REST, SSE**
- Six new attention kinds with exact wire names equal to the Spec 108
warning codes: `anonymous_denied_by_binding_guard` (4),
`client_holds_admin_key` (5), `client_token_name_conflict` (6),
`profile_missing` (7), `client_rotation_pending` (8),
`client_credential_expiring` (9). The binding guard is a single item
with the new subject type `setting`; every other item is one per client.
Each carries a fix verb equal to the Spec 108 warning action and a
target the Web UI already serves.
- Scoped callers (agent tokens, non-admin server-edition sessions) are
now filtered by an allow-list on REST and SSE: only server items they
can enumerate. The new kinds are administrator-only and an unknown
future subject type fails closed.
- The attention subscriber also recomputes on `client.binding_changed`,
`profiles.changed`, `config.reloaded` and `config.saved`, re-reads the
client warnings every 30 seconds (rotations, forgets and token creation
emit no event), and wakes when an active credential enters its 14-day
window. `since` for the expiring kind is the start of that window.
- `client_holds_admin_key` appears once a client's credential state has
been observed (an on-demand read persists it). There is deliberately no
background config read, which would trigger the macOS privacy prompt.
Recorded in FR-093.
- #1437 item 1: `GET /servers?profile=<viewed>` from a caller pinned to
a narrower profile now counts only tools both profiles admit and drops
servers outside the caller's own pin, so it agrees with `GET /tools`.
Administrator output is unchanged.
- #1437 item 5: a revoked token's name stays reserved because activity
history references it. `POST /tokens` (and `mcpproxy token create`) now
say so: `A revoked token named "x" still holds this name for activity
history; choose another name`.
- OpenAPI regenerated (subject type enum and the attention scoping
description).

**Web UI**
- Servers page: a Profile select and a removable chip, backed by `GET
/servers?profile=`. The list is page-local, so the shared servers store
(sidebar, header, Dashboard) is untouched. It shows the spinner instead
of the unfiltered list while `/status` features are pending, "Profile
not found" with Clear on a 404, a disabled chip for `-`, and "No servers
in this profile" with Clear.
- Clients expanded row: Activity, Sessions, Tools it sees, Usage, each
carrying `client=<id>`.
- Tokens tab: Activity and Usage links on agent token rows (client
credentials are filtered as clients, from the Clients page).
- All of these stay hidden until `features.scope_filters` lists the
parameter, and the URL keeps the parameter untouched meanwhile.
`useScopeQuery.ts`, `navModel.ts` and `SidebarNav.vue` are not touched.
- Generated `contracts.ts` gains the six kinds and the `setting`
subject.

**macOS**
- Home attention rows and the tray "Needs Attention" rows for the new
items are actionable: a pure `AttentionWarningAction` mapper feeds
108-k's warning dispatcher, so each opens Settings (scrolled to
`require_mcp_auth`), the Clients page, the upgrade sheet, the connect
sheet or the Agent Tokens tab filtered by the token. The tray never
mutates config or a credential.
- `ScopeFilterTests` additions for the un-hide, the URL round trip and
the profile links.

**CLI**
- No format change. `mcpproxy attention`, `status` and `doctor` render
the new items generically; a golden pins the table with a setting
subject and an admin-key client.

## Audit findings

No audit finding carries a dedicated id for this PR. It implements
FR-093, FR-002 (kinds), FR-007 (scoped filtering), FR-082 (the deep
links 109-k registered) and parity row 30 of Spec 109.

## Spec documents

specs/109 tasks (T151 to T156 plus T152a, T154a, T157, T158, T159; 185
tasks), spec FR-002, FR-007, FR-082, FR-093,
contracts/rest-api.md#attention (the kind table), data-model section 4,
quickstart recipe 109-l, research D33 (P1 to P15). Spec 108 FR-043 and
the Tokens contract gain the revoked-name sentence.
docs/features/needs-attention.md lists the new kinds and
docs/development/web-ui-verification.md the new sweep spec. ROADMAP
regenerated.

## Tests added

- Go: `internal/runtime` `attention_108_kinds_test.go` (table, ordering,
truncation, no secrets, name equality with the Spec 108 codes),
`attention_108_source_test.go` (the set equals
`ClientsService.Warnings`, zero config reads, no clients service),
`attention_108_subscriber_test.go` (events, periodic tick, expiry
threshold, `firstSeen`), `attention_108_contract_test.go` (exact
TypeScript lines), `attention_108_bench_test.go` (cost at the 100-token
deployment cap, about 1 ms); `internal/httpapi`
`attention_108_scope_test.go` (REST and SSE allow-list),
`servers_profile_caller_pin_test.go` (both list branches),
`tokens_revoked_name_test.go`; `cmd/mcpproxy`
`attention_108_cmd_test.go` with a golden.
- Frontend: `profiles-unhide.spec.ts` (features x `/profiles` route
table), `servers-profile-scope.spec.ts`, `attention-108-targets.spec.ts`
(each target resolves in the real router).
- Playwright: `e2e/web-ui-sweep/profiles-unhide.spec.ts` (sidebar and
Add menu, Viewing chip, Clients and Token links, Servers scope, an
expiring credential becoming the first attention item within seconds,
1440/900/390 layout, keyboard order). The 108-i sweep step that clicked
a link named "Tools" now clicks the renamed "Tools it sees" link by its
test id.
- Swift: `Attention108KindsTests`, three `ScopeFilterTests` cases.

## Deviations from the plan, recorded

- The plan's helper path `helpers/profile-seed.ts` is
`e2e/web-ui-sweep/profiles-seed.ts` on main.
- `AttentionClientWarning` also carries `BindingNames` (display names
for the guard detail) next to `BindingCount`, and `Since`.
- The plan's 500-token cost case cannot exist: the store caps tokens at
100, so the cost test runs at the cap.
- `AttentionList.vue` gets no `aria-describedby`: item ids can contain
spaces (custom client ids), which are invalid id references; the summary
sits directly above the fix button.
- Token-row links render only when the Activity and Usage routes are
registered, so routers without them (the 108-i unit specs) keep passing
unmodified.

## Follow-ups

- Agent-token expiry as an attention kind (not a Spec 108 warning).
- Background admin-key detection without config reads.
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