GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(mcpx): daemon.ui gating and daemon.uiDir override for /dashboard (#1882) by dezren39 · Pull Request #2521 · developing-today/code Conversation
|
daemon.ui |
daemon.address |
/dashboard |
|---|---|---|
| unset (default) | 127.0.0.1 |
served |
| unset (default) | 0.0.0.0 |
404 |
true |
0.0.0.0 |
served |
false |
anything | 404 |
settings.Set.Given distinguishes "explicitly true" from "inherited default", so widening the bind never also widens what it publishes by accident. The reasoning is in the setting's Long help text, where mcpx settings daemon.ui shows it.
daemon.uiDir details/dashboard serves <dir>/index.html; /dashboard/… serves the files beside it so relative links in an external page resolve (previously /dashboard was the only route).~/~/… expands to the home directory.go build ./..., go vet, and go test ./internal/daemon/ -run Dashboard -count=1 pass locally in pkgs/mcpx:
true);uiDir index/asset//v1/dashboard/ serving, path traversal staying inside the directory, missing directory → 404.The embedded page still covers metrics/pools/search/interactions, not the TUI's six views (browse/log/stats/servers/sessions/storage) plus elicitation answering. That is frontend work on dashboard.html and remains open under #1882; this PR is the server-side enablement and the directory escape hatch it needs.
Part of #1882.
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The embedded dashboard was always on and could not be replaced. daemon.ui gates it (default true on the loopback bind the daemon uses, explicit true required past loopback, since the API is unauthenticated and widening the bind should not publish a UI nobody chose). daemon.uiDir serves index.html and its sibling files from a directory instead of the embedded page. Both are read per request so a settings reload applies without a restart. Files only: a directory path or a missing file is a 404, not a listing. Part of #1882.
There was an error while loading. Please reload this page.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 808c74804c
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if dir := s.dashboardDir(); dir != "" { | ||
| s.serveDashboardFile(w, r, dir, "index.html") | ||
| return |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Redirect external dashboard pages to a trailing-slash URL
When daemon.uiDir contains an index with relative assets such as app.css or ./app.js, opening /dashboard resolves those URLs to /app.css and /app.js, not the newly registered /dashboard/ asset routes. The same issue affects /v1/dashboard, and CmdDashboard explicitly opens the slashless URL. Consequently, a normal external frontend loads its HTML but fails to load its scripts and styles. Redirect the external-page request to its trailing-slash form before serving the index.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6450ea7: handleDashboard now redirects the slashless external-page URL to its trailing-slash form (301, query preserved) whenever the daemon.uiDir index exists, so relative assets resolve under /dashboard/ where the asset routes are registered; a missing override directory keeps its plain 404 instead of redirecting into one. The uiDir test now expects the redirect (both /dashboard and /v1/dashboard) and the slash-form index. Dashboard tests pass on the laptop.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| Path: "daemon.ui", Kind: KindBool, Default: "true", | ||
| Scope: ScopeDaemon, FlagAliases: []string{"ui"}, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Mark both dashboard settings as hot
When either new setting is changed through the runtime settings API, handleSettingsSet in routes_settings.go applies only declarations with Hot enabled or call scope. Both dashboard declarations omit Hot: true, so the request instead returns applied: false and restartRequired: true without updating s.set; a runtime-only change is effectively discarded. Thus disabling the dashboard or changing its directory does not take effect on subsequent requests despite the handlers reading these settings per request. Mark both daemon.ui and daemon.uiDir as hot so the existing settings update path actually applies them.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6450ea7: both daemon.ui and daemon.uiDir declarations are now Hot: true — the handlers already read them per request, so a runtime settings-API change applies immediately instead of being reported restartRequired and discarded. docs/configuration.md regenerated via the settings docs test's -update mode, and a new test (TestDashboardSettingsAreHot) pins both declarations as Hot.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- A daemon.uiDir page loaded from /dashboard resolved its relative assets against /, where no asset routes exist, so an external frontend arrived without its scripts or styles. handleDashboard now redirects the slashless URL to its trailing-slash form (preserving the query) when the override index exists; a missing directory keeps its plain 404. - daemon.ui and daemon.uiDir are read per request by the handlers but were not marked Hot, so a runtime settings-API change was reported restartRequired and discarded. Both declarations are Hot now, and docs/configuration.md is regenerated to match. - Tests: the uiDir test now expects the redirect and the slash-form index, and a new test pins both settings as Hot. The settings compendium-manifest failure and the full daemon suite failure both reproduce on the clean 808c748 tree (pre-existing, not this change).
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 6450ea7271
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // widened past loopback is where the page needs an explicit yes. Read per | ||
| // request so a reload picks up a change without a restart. | ||
| func (s *Server) dashboardEnabled() bool { | ||
| if s.set == nil { | ||
| return true | ||
| } | ||
| if !s.set.Bool("daemon.ui") { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Apply file-reloaded dashboard settings to the resolved set
When daemon.ui or daemon.uiDir is edited in the configuration file, neither the config watcher nor POST /v1/reload makes the change effective. Both call reloadConfig in routes_settings.go, which replaces s.cfg but never updates s.set; these handlers therefore continue reading the startup values despite the stated reload behavior. In particular, setting daemon.ui to false in the file and successfully reloading leaves the dashboard accessible. Refresh the file-backed dashboard settings during reload while preserving higher-precedence overrides.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| dir := s.dashboardDir() | ||
| if dir == "" { | ||
| http.NotFound(w, r) | ||
| return |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Preserve the dashboard URL when clearing the directory override
After visiting an external dashboard, the browser is at /dashboard/ because the page handler redirects there. If daemon.uiDir is then hot-updated to empty, reloading that page returns 404 here rather than displaying the embedded dashboard. The permanent redirect can also send subsequent visits to /dashboard back to that broken URL. Handle the bare trailing-slash dashboard roots with the page handler when the override is empty, while continuing to reject asset subpaths.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Extend the embedded zero-build dashboard.html with the TUI's six views (browse/log/stats/servers/sessions/storage) read-only over the existing /v1 endpoints (namespaces/tools, log, stats dimensions, servers), storage from the stats volume dimension, plus a pending-elicitations panel that renders the requestedSchema form and answers via POST /v1/elicit/{id}/{action} with live refresh over /v1/events. No UI-specific endpoints, no new build stage. Test pins the view tabs and endpoint wiring in the served page.
There was an error while loading. Please reload this page.
|
🤖 Agent note · view coverage landed (queue task 3115, Lane D) Commit
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 0af8d077f5
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| const type = field.def.type === 'number' || field.def.type === 'integer' ? 'number' : 'text'; | ||
| const dflt = field.def.default !== undefined ? ' value="' + escapeHTML(String(field.def.default)) + '"' : ''; | ||
| return '<label>' + label + '<input type="' + type + '" id="' + id + '" data-field="' + escapeHTML(field.name) + '" data-type="' + type + '"' + dflt + '></label>' + desc; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Escape elicitation field IDs before inserting them into HTML
When an MCP server supplies an elicitation schema, its property names flow unchanged through elicitViaBroker into field.name. The generated id includes that name verbatim and is interpolated into HTML that loadElicitations assigns to innerHTML. A property named x"><img src=x onerror=alert(1)> therefore executes JavaScript in the dashboard's origin, where it can access the daemon's control API. Escape the complete ID in every HTML attribute interpolation, or construct these elements using DOM APIs.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| renderRows(rows, 'No log records yet.'); | ||
| } else if (name === 'stats') { | ||
| const dim = document.getElementById('stats-dimension').value; | ||
| const data = await fetchJSON('/v1/stats?dimension=' + encodeURIComponent(dim)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Use the stats endpoint's supported query parameter
The stats handler in internal/daemon/ops.go reads q.Get("by") and defaults to calls; it does not read dimension. Consequently, selecting any other Stats dimension still displays call statistics. The same parameter mismatch in the Sessions and Storage requests makes Sessions display calls and Storage report no files even when logs exist. Change all three requests to use by.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| setInterval(() => { loadElicitations(); loadView(currentView); }, 15000); | ||
| try { | ||
| const events = new EventSource('/v1/events'); | ||
| events.onmessage = () => { loadElicitations(); }; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Subscribe to the named elicitation events
The /v1/events handler in server.go emits explicit event: <kind> fields, including elicit.opened, elicit.answered, and elicit.completed. EventSource.onmessage only receives events without a custom event name, so this callback never runs for those notifications. New questions and answers from other clients therefore remain stale until the 15-second poll instead of updating live. Register listeners for the relevant named events.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (field.def.type === 'boolean') { | ||
| return '<label>' + label + '<select id="' + id + '" data-field="' + escapeHTML(field.name) + '" data-type="boolean"><option value="true">true</option><option value="false">false</option></select></label>' + desc; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Honor schema defaults when initializing selection fields
For a boolean field with default: false, this selector nevertheless initializes to its first option, true, and answerElicit submits that value if the operator leaves it untouched. This affects the repository's own destructive-call confirmations: Confirmation in internal/elicit/policy.go deliberately supplies a boolean default derived from a.Default, which is false unless explicitly set to true. Enum selectors likewise ignore their declared defaults. Initialize each selector from field.def.default rather than silently substituting the first option.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| msg: r.msg || r.template || '', | ||
| attrs: r.attrs ? JSON.stringify(r.attrs) : '' | ||
| })); | ||
| renderRows(rows, 'No log records yet.'); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Discard responses from superseded operator-view requests
When an operator switches tabs before an earlier request completes, both requests still render into the shared view-body. For example, if a Log request is slow, switching to Servers can display the server table first and then have it overwritten by the late Log response while the Servers tab remains selected. The incorrect table persists until another refresh; namespace and dimension changes can race similarly. Track the latest view request and ignore superseded responses and errors before modifying the shared body.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…refresh (#3223) (#3237) * fix(mcpx): preserve in-progress elicitation answers across dashboard refresh (#3223) loadElicitations rebuilt the elicitation list via wholesale innerHTML on every 15s interval tick and SSE event, erasing answers an operator was mid-way through typing, even when the pending set had not changed. Fix: signature the pending set (ids + field schemas) as last rendered and skip the re-render entirely when it is unchanged; when the set does change, capture in-progress field values and focus keyed by (request id, field name) before the rebuild and restore them after. Error renders reset the signature so the next successful poll always re-renders. Verified with a jsdom harness against the rendered page: typed value, DOM node identity, focus, and selection survive an unchanged-set refresh, and the value is preserved across a changed-set refresh; the same harness fails 6 checks on the pre-fix page. New Go test pins the preservation mechanisms. Addresses the unaddressed Codex P2 on PR #2521. * fix(mcpx): stable elicitation refresh signature + behavioral coverage (#3223) Codex review round on PR #3237, two findings dispositioned: P2 (4433791275): elicitSignature serialized the whole /v1/elicit response, whose ttlRemainingMs is recomputed from the clock on every list (and lastTouched moves on reads) -- the signature changed on every refresh of an unchanged set, so the skip never fired and typed answers were still destroyed. The signature is now the stable rendered identity of the set: request ids + requestedSchema, in render order. P1 (4433791277): the substring-pinning Go test could not fail when preservation broke. It is replaced by a behavioral test that runs the dashboard real script under node with a minimal DOM stub and drives loadElicitations through refresh transitions: volatile-only refresh skips the re-render (typed value + focus untouched), changed set re-renders with values/focus restored, and signature permutations (ttl/lastTouched drift stable; field added, id changed, member added all change it). Verified failing-first: 6 checks fail against the pre-fix signature, all pass after.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.