Repository navigation
fix(model-context): a share without limits/exposedTo accepts the registration's settings without a warning - #10
Merged
Conversation
…stration's settings without a warning Co-authored-by: spearwolf <12805+spearwolf@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix warning about conflicting limits in shae-worker expose-to-model-context
fix(model-context): a share without Oct 1, 2026
limits/exposedTo accepts the registration's settings without a warning
spearwolf
marked this pull request as ready for review
October 1, 2026 16:22
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Mixed matching and conflicting settings produce an inaccurate ignored warning payload.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes noisy model-context warnings when a share omits registration settings.
Changes:
- Preserves omitted
limitsandexposedTosettings. - Adds conflict-focused sharing behavior and regression tests.
- Updates API documentation, proposal, and changelog.
| File | Description |
|---|---|
sharedExposure.ts |
Handles optional requested settings and conflicts. |
exposeShadowEnvsToModelContext.ts |
Preserves omitted settings. |
exposeShadowEnvsToModelContext.spec.ts |
Tests sharing and warnings. |
ShaeWorkerElement.modelContext.spec.ts |
Tests silent element joins. |
best-practices.md |
Documents sharing behavior. |
api-reference.md |
Clarifies omitted settings. |
CHANGELOG.md |
Records the bug fix. |
web-mcp-shadow-envs.md |
Amends the design record. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
A
<shae-worker expose-to-model-context>joining a registration opened withlimitsorexposedTologgedthe tools under "shae-" are already registered with other limits or exposedToonce per element, although the element never asks for settings of its own — and has no way to. The behavior was correct; the warning was pure noise.Cause.
exposeShadowEnvsToModelContext()normalised a missinglimitsto{}before joining, andjoinSharedExposure()compared settings by value. "Not given" was indistinguishable from "explicitly{}", so every element join read as a conflict with whatever the opener had set.Changes
exposeShadowEnvsToModelContext.ts— pass through only the settings the caller actually gave; "not given" stays distinguishable from "explicitly set".sharedExposure.ts— new internalRequestedExposureSettings(limits/exposedTooptional);open()resolves the defaults (limits ?? {}), so opener semantics are unchanged; the by-valuesameSettingsbecameconflicts(inEffect, requested):The warning's
ignoredpayload now names only what the joiner passed and what differs.Effect. Element joins are silent whatever the opener set; a call that explicitly passes a differing
limitsorexposedTo— including an explicit{}against an opener's limits — is still reported. No API change.Tests. Three new specs: opener with
limits/exposedTo+ joiner without → no warning, opener's limits in effect (and gone once the opener leaves); per-setting conflict reporting, same values vs. differing ones; an element joining a registration opened withlimits+exposedTo→ no warning (the reported scenario). All three fail on the unfixed source.Docs.
CHANGELOG.md(Unreleased),docs/api-reference.md,docs/best-practices.md, and a dated amendment indocs/proposals/web-mcp-shadow-envs.md: a share that leaves a setting out accepts what is in effect; only a value of its own that differs is reported.<shae-worker expose-to-model-context>warns about conflicting limits it never set #9