Skip to content

fix(ui): isolate MCP context removal feedback - #179843

Merged
steipete merged 2 commits into
mainfrom
solid2/w-s2-mcp-context-actions
Oct 21, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-s2-mcp-context-actions

Conversation

@steipete

@steipete steipete commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Whole assigned-scope AST census at exact integrated base 40a236feb0c3 → head. Counts are syntax/adoption inventory; plain owner and lifecycle exceptions are classified below.

Family 1 Handler candidates 2 Cleanup 3 Async memos 4 Actions 5 Imports 6 Structured seeds 7 Factories 8 Contexts 9 Reveal 10 Owner APIs
solid 4 → 4 10 → 10 0 → 0 0 → 1 3 → 3 0 → 0 0 → 0 0 → 0 0 → 0 3 → 3
config 0 → 0 0 → 0 0 → 0 0 → 0 0 → 0 1 → 1 0 → 0 0 → 0 0 → 0 0 → 0
menus 0 → 0 5 → 5 0 → 0 0 → 0 3 → 3 2 → 2 2 → 2 0 → 0 0 → 0 0 → 0
rest 4 → 4 18 → 18 2 → 2 1 → 1 6 → 6 2 → 2 0 → 0 2 → 2 0 → 0 1 → 1
pagesA 3 → 3 3 → 3 10 → 10 12 → 12 6 → 6 1 → 1 0 → 0 0 → 0 0 → 0 0 → 0
pagesB 1 → 1 12 → 12 2 → 2 2 → 2 22 → 22 4 → 4 0 → 0 1 → 1 1 → 1 0 → 0
pagesC 4 → 4 30 → 30 1 → 1 3 → 3 43 → 43 11 → 11 20 → 20 0 → 0 0 → 0 0 → 0
app 2 → 2 3 → 3 0 → 0 0 → 0 67 → 67 0 → 0 0 → 0 1 → 1 0 → 0 1 → 1
lib 0 → 0 5 → 5 0 → 0 1 → 1 12 → 12 1 → 1 3 → 3 1 → 1 0 → 0 4 → 4
plugins 0 → 0 3 → 3 0 → 0 1 → 1 13 → 13 1 → 1 0 → 0 0 → 0 0 → 0 7 → 7
api 0 → 0 0 → 0 0 → 0 0 → 0 2 → 2 0 → 0 0 → 0 0 → 0 0 → 0 0 → 0
total 18 → 18 89 → 89 15 → 15 20 → 21 177 → 177 23 → 23 25 → 25 5 → 5 1 → 1 16 → 16

What Problem This Solves

A pending context removal stayed keyed only by view ID. Replacing the Gateway client or session with a context using the same view ID inherited the old disabled state; old settlement could also clear a successor's feedback. This change gives each admitted removal a Solid optimistic presentation layer scoped by its existing current-target predicate.

User Impact

A new context stays removable while an older removal is still settling; failures retain the existing visible retry.

Why This Change Was Made

The Gateway request, captured target, connection scope, and update ID checks still own admission and publication. The action only presents pending feedback and consumes the already-admitted operation. It adds no RPC, refresh, generation, or rollback store. Expected failures retain the visible error and retry behavior.

Evidence

Touched-file checklist Before After
1 Native conditional/prop handler candidates 0 0
2 Component cleanup registrations 2 2 (synchronous event/liveness retirement)
3 Manual async-read loading state 0 0
4 Manual pending store / action / optimistic store 1 / 0 / 0 0 / 1 / 1
5 Manual component loaders 0 0
6 Immutable structured-signal updates 0 0
7 Handwritten component factories 0 0
8 Throw-only context wrappers 0 0
9 Independently loading sibling regions 0 0
10 Root/owner API calls 0 0

The two cleanup registrations retire event subscriptions and the current-target predicate synchronously when the host unmounts, including while an action is held. Deferring them through settled presentation would weaken that contract. The context owner exposes a synchronous published snapshot rather than a read request, so no async read or affects/refresh cycle is introduced.

Proof Result
Same-view-ID replacement regression on base Both client and session cases fail: successor Remove remains disabled
Focused component suite, pinned Bun, one worker 6 passed after main integration (19.24s), including successor failure/retry, old settlement, unmount, and subscription release
UI tsrs Passed
Targeted UI lint/format and diff check Passed; existing ordered Gateway subscriber reactivity warning unchanged
Production Knip Passed, no unused production files or dependencies
Isolated Codex review Scoped-clean through P2; final source verification passed
Same-machine strict performance Passed; startup 324,939 → 324,959 B; CSS 40,796 B / 1 request unchanged

No layout, styling, text, tag, class, route, or import boundary changes. The regression tests exercise the actual rendered button states; no new visual design is introduced. Production LOC: 205 → 233 (+28), needed to keep authoritative operation settlement outside Solid's presentation transaction while removing shared pending cleanup. Test LOC: 111 → 198 (+87). The first baseline attempt stopped during cold setup and is not used as failure evidence; the configured second attempt executed and failed both regression assertions.

Surface Base Head Delta
Startup JS gzip 324,939 B / 9 requests 324,959 B / 9 requests +20 B
Startup CSS gzip 40,796 B / 1 requests 40,796 B / 1 requests +0 B
Chat JS gzip 1,441,526 B / 27 requests 1,441,691 B / 27 requests +165 B
New Session JS gzip 1,019,962 B / 22 requests 1,020,037 B / 22 requests +75 B

Strict paired performance passed with zero violations; same machine, toolchain and normalized build identity. The official comparison omitted base startup metadata, so the baseline alone was rebuilt once to record it; the already-built candidate was reused.

The final catch callback received a type-only unknown annotation after review. The first final-lint invocation was stopped during unnecessary plugin artifact preparation (missing UI tsconfig), before a lint verdict; the corrected two-file invocation uses tsconfig.ui.json. Runtime test/build evidence is unchanged.

Full ci:full run 39687247707 on exact integrated head 03493e1fd437a8c5fb0dd4a2d064d3d97a335694 completed. Its only failing test is Chat boot render storm > prewarms session actions after a busy cold load without building unrelated menus or losing the draft (job119524885657), the Message permissions visibility timeout at line233. The exact name and signature match latest completed scheduled main 39687169253, job119524443291. All other root jobs pass or skip, including every UI unit shard and remaining E2E shard. Native inherited-failure admission covers this assertion; the old mixed-attachment packet is retired.

Synthetic before/after capture (same styling and data):

State Before After
Initial context Initial context before Initial context after
Session replacement during a held removal Replacement before Replacement after

The replacement action stays enabled after the change; the admitted predecessor request is unchanged. All four images were inspected; browser errors: none.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 21, 2026
@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T22:36:08.243031Z 03493e1 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 21, 2026
@clawsweeper

clawsweeper Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR isolates pending MCP context-removal feedback across client and session replacements.

Example: Remove view-one in agent:main:one, then switch to agent:main:two containing another view-one before the first request settles.

  • Before: The successor Remove button inherits the first request’s disabled state.
  • After: The successor remains removable, and the earlier request’s settlement does not clear its pending feedback.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation and distinct regression cases support correctness, while supplied behavioral validation remains component-harness evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied validation exercises rendered components with deferred mock Gateway responses, rather than the shipped Control UI.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Switching client or session during context removal can leave the successor’s Remove button disabled.
Reason: This is a focused repair of unintended presentation-state sharing, and the supplied maintainer-authored status establishes direction.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a current UI state leak, preserves existing mutation checks, and introduces no actionable code or security findings.

Priority: P2
Reviewed head: 0deac3dcba3f4506db911d7752f9a735de66e969

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not exercise same-view-ID replacement and retry through the shipped Control UI.
Agent review details

How this fits together

The chat composer’s MCP context strip reads connection-scoped context entries, sends removal requests through the Gateway client, and renders pending buttons and errors.

flowchart LR
  A[Chat composer] --> B[MCP context strip]
  B --> C[Gateway removal request]
  C --> D[Scoped result checks]
  D --> E[Context projection]
  E --> B
  B --> F[Optimistic button feedback]
Loading

Technical review

Best possible solution:

Keep Gateway request settlement authoritative while giving each admitted removal independently scoped optimistic feedback.

Do we have a high-confidence way to reproduce the issue?

Current main stores pending state solely by view ID while the component can change client or session; the supplied regression cases reproduce that path, although no tests were executed during this read-only review.

Is this the best way to solve the issue?

The patch uses existing Solid presentation primitives, removes shared pending cleanup, and retains captured-target and update-ID checks without adding another mutation owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 548a331adb18.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +28, Tests +87. Total +115 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 64 36 +28
Tests 1 92 5 +87
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 156 41 +115

Review metrics

Metric Value Why it matters
Production versus test growth Production +64/−36, net +28; tests +92/−5, net +87. Production growth separates authoritative settlement from optimistic presentation; test growth covers distinct replacement and teardown failures.

Labels

Label changes:

  • add P2: The defect can disable context-removal controls after switching clients or sessions, with limited UI impact.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The defect can disable context-removal controls after switching clients or sessions, with limited UI impact.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 21, 2026, 4:58 PM ET / 20:58 UTC.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03493e1fd4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +100 to +102
setPending((value) => {
value[viewId] = current;
});

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.

P2 Badge Key overlapping removals by presentation scope

When a removal in scope A remains pending, the user can switch to scope B with the same viewId, start another removal, and then return to A before either settles. Both actions write the same pending[viewId] slot, so B's newer optimistic layer masks A's accessor; in scope A it evaluates false and re-enables the button even though A's request is still in flight, allowing a duplicate removal. Key the pending state by the full connection/session/agent presentation or preserve all active predicates instead of overwriting one view-ID slot.

AGENTS.md reference: ui/AGENTS.md:L16-L18

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 76b012f into main Oct 21, 2026
103 of 107 checks passed
@steipete
steipete deleted the solid2/w-s2-mcp-context-actions branch October 21, 2026 23:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant