Move the daemon's ConfigView renderer and readiness probes off webui.Server #1447

Closed
opened 2026-10-27 13:40:26 +00:00 by sam · 1 comment
Owner

webui.Server still declares Cfg *config.Holder (internal/webui/server.go:44) with eight production read sites. The UI process never receives a holder -- compose() leaves it nil and TestComposeUIServerHoldsNoDaemonState fails if that changes -- so this is residue on the daemon side, not a live coupling.

It survives because internal/app/archied keeps a webui.Server (bootstrap.go:392, and bootstrap.go:1240 still does b.web.Cfg = b.d.Cfg) for two daemon jobs that have nothing to do with serving HTTP: building the published ConfigView snapshot (LocalConfigView, bootstrap.go:1353) and holding the readiness probes (readiness.go:31 reads b.web.Cfg.Get()).

Root-cause fix is a split at the producer, the same move already made for store contracts: the ConfigView DTO stays where the UI renders it, the builder moves to the daemon's configuration owner, and readiness stops hanging off a Server the daemon never serves. webui.Server then loses Cfg entirely, along with the eight nil-guarded degradation branches (api_config.go, api_tasks.go, api_logs.go, api_chat.go, api_setup.go, api_capabilities.go, server.go trustForwardedHeaders).

Note before starting: those branches are what the UI process runs today, since Cfg is nil there. Check each against the published ConfigView and the UI's own Options before deleting, because some of them (log file path, chat ShowToolCalls, TrustForwardedHeaders, the setup checklist, forge links on task rows) are dashboard behaviour that may currently be silently degraded in the extracted process. That overlaps the smoke suite still open on archie-core-8cda.5.6.

Recorded 2026-09-11 while landing the deletion-gate architecture test; see docs/prds/ui-service-boundary.md, 'Deletion gate: SATISFIED'.

Close reason

Landed as c2904da. webui.Server lost Cfg, ConfigProvenance, LastReload, ConfigOverrides and SetProvenance; LocalConfigView became the pure webui.BuildConfigView over a ConfigViewInput the daemon assembles (boot.configViewInput), and readiness/health moved onto boot fields (cfgHolder, channelManager, chat, healthRegistry). Boot owns one Holder; buildDaemon's b.web.Cfg = b.d.Cfg replacement dance is gone, and operator retry caps now follow reloads.

Per the bead's own note, each nil-guarded branch was checked before deletion rather than deleted wholesale. Two were degraded features, not dead code, and are now restored: ConfigView gained a chat section (show_tool_calls, operator, channel_configured) so the chat page expands tool calls and /api/setup renders its checklist in the extracted process. Asserted end to end in cmd/archie-ui/main_test.go. The PRD's 'two dashboard values still degrade' paragraph is updated.

Editable moved to handleConfig, decided by Server.UpdateConfig, so the pending write contract wires one field.

Side effects, both filed rather than dropped: overlay.Store gained Keys (Snapshot nests dotted keys, so the overridden list was publishing 'budgets' where the dashboard resets 'budgets.max_steps' -- fixed here with tests); multi-identity forge links went to archie-core-pv6t.

task check green.


Imported from beads archie-core-ml30 · GitHub #812 · type task · priority P2 · created 2026-09-11 · closed 2026-09-11

webui.Server still declares Cfg *config.Holder (internal/webui/server.go:44) with eight production read sites. The UI process never receives a holder -- compose() leaves it nil and TestComposeUIServerHoldsNoDaemonState fails if that changes -- so this is residue on the daemon side, not a live coupling. It survives because internal/app/archied keeps a webui.Server (bootstrap.go:392, and bootstrap.go:1240 still does b.web.Cfg = b.d.Cfg) for two daemon jobs that have nothing to do with serving HTTP: building the published ConfigView snapshot (LocalConfigView, bootstrap.go:1353) and holding the readiness probes (readiness.go:31 reads b.web.Cfg.Get()). Root-cause fix is a split at the producer, the same move already made for store contracts: the ConfigView DTO stays where the UI renders it, the builder moves to the daemon's configuration owner, and readiness stops hanging off a Server the daemon never serves. webui.Server then loses Cfg entirely, along with the eight nil-guarded degradation branches (api_config.go, api_tasks.go, api_logs.go, api_chat.go, api_setup.go, api_capabilities.go, server.go trustForwardedHeaders). Note before starting: those branches are what the UI process runs today, since Cfg is nil there. Check each against the published ConfigView and the UI's own Options before deleting, because some of them (log file path, chat ShowToolCalls, TrustForwardedHeaders, the setup checklist, forge links on task rows) are dashboard behaviour that may currently be silently degraded in the extracted process. That overlaps the smoke suite still open on archie-core-8cda.5.6. Recorded 2026-09-11 while landing the deletion-gate architecture test; see docs/prds/ui-service-boundary.md, 'Deletion gate: SATISFIED'. ### Close reason Landed as c2904da. webui.Server lost Cfg, ConfigProvenance, LastReload, ConfigOverrides and SetProvenance; LocalConfigView became the pure webui.BuildConfigView over a ConfigViewInput the daemon assembles (boot.configViewInput), and readiness/health moved onto boot fields (cfgHolder, channelManager, chat, healthRegistry). Boot owns one Holder; buildDaemon's b.web.Cfg = b.d.Cfg replacement dance is gone, and operator retry caps now follow reloads. Per the bead's own note, each nil-guarded branch was checked before deletion rather than deleted wholesale. Two were degraded features, not dead code, and are now restored: ConfigView gained a chat section (show_tool_calls, operator, channel_configured) so the chat page expands tool calls and /api/setup renders its checklist in the extracted process. Asserted end to end in cmd/archie-ui/main_test.go. The PRD's 'two dashboard values still degrade' paragraph is updated. Editable moved to handleConfig, decided by Server.UpdateConfig, so the pending write contract wires one field. Side effects, both filed rather than dropped: overlay.Store gained Keys (Snapshot nests dotted keys, so the overridden list was publishing 'budgets' where the dashboard resets 'budgets.max_steps' -- fixed here with tests); multi-identity forge links went to archie-core-pv6t. task check green. --- _Imported from beads `archie-core-ml30` · GitHub #812 · type task · priority P2 · created 2026-09-11 · closed 2026-09-11_
sam added the mediumtask labels 2026-10-27 13:40:26 +00:00
sam self-assigned this 2026-10-27 13:40:26 +00:00
sam closed this issue 2026-10-27 13:40:26 +00:00
Author
Owner

sam wrote (originally 2026-09-11):

Investigation 2026-09-11 (verified against main @57d9be5).

Bead's premise holds, and the real scope is larger than "move two jobs off
webui.Server": the daemon never calls b.web.Handler(). Nothing in
internal/app/archied serves the dashboard (only archieui/run.go:79 does), so
b.web is a struct the daemon fills as a data carrier, not a server.

What the daemon actually reads off b.web:

  • Cfg -> LocalConfigView (bootstrap.go:1353) and the config
    readiness probe (readiness.go:31)
  • Health -> healthSurface serves it on [health].listen (health.go:90)
  • Chat -> readiness sessionCount, and the Telegram
    chatTaskActorAdapter (bootstrap.go:560)
  • Channels -> readiness channelStates
  • ConfigProvenance / LastReload / ConfigOverrides -> read only from inside
    LocalConfigView

What the daemon writes and nothing reads (dead production wiring):

  • b.web.Skills (bootstrap.go:392, skillCatalogAdapter, and it holds a
    frozen config.NewHolder(cfg), not the live holder)
  • b.web.Memory (bootstrap.go:898, memoryUIAdapter)
  • b.web.Curators (bootstrap.go:1234, curatorsUIAdapter)
  • b.web.WorkRequests (bootstrap.go:537)
    Their three adapter files (skill_ui.go, memory_ui.go, curator_ui.go) exist
    only to feed a Server that serves nothing.

Recommended shape (producer split, no new package):

  1. webui.LocalConfigView becomes a free function in webui:
    BuildConfigView(cfg config.Config, opts ConfigViewOptions) ConfigView,
    where opts carries provenance, overrides, reload status. The DTO and its
    unexported helpers (reposView, providersView, lockedConfigKeys,
    buildConfigSchema) stay put; only the *Server receiver goes. Server keeps
    ConfigSource, which is all the UI needs.
  2. publishConfigSnapshot calls webui.BuildConfigView(b.d.Cfg.Get(), ...)
    directly; provenance moves to a boot field (b.currentProvenance already
    exists as configuration.Provenance; convert at the publish site).
  3. Readiness reads b.d.Cfg, b.channelManager and a new b.chat field instead
    of b.web.*; the health registry becomes a boot field.
  4. Delete b.web from the daemon entirely, along with the four dead field
    assignments and the three adapter files.
  5. Delete Server.Cfg and its eight read sites.

Behaviour delta for the UI process: none. Every branch deleted is already the
nil side there. Verified individually:

  • api_tasks.go:92 resolveForge already has the published-projection path
    below it; the Cfg branch is daemon-only.
  • api_config.go:60 handleChannels Cfg fallback is unreachable (Channels and
    Cfg are both nil in the UI process).
  • api_capabilities.go:28 "channels": s.Channels != nil || s.Cfg != nil
    reduces to s.Channels != nil, same value.
  • server.go:219 trustForwardedHeaders: the UI process already sets its own
    Options.TrustForwardedHeaders field.
  • api_chat.go:388 ShowToolCalls and api_setup.go:30 checklist stay degraded;
    fixing those means publishing the fields in ConfigView, which is the
    separate projection work the PRD already names (archie-core-8cda.5.6).
  • api_logs.go:131 log file path: /api/logs has no contract yet either way.

Test fallout: archieui/compose_test.go:58 asserts srv.Cfg == nil and stops
compiling when the field goes. That clause should be deleted (structurally
impossible beats asserted), and the PRD's "Acceptance criterion 1 is amended"
paragraph updated to say the residue is gone.

Adjacent, out of scope, worth its own bead: UpdateConfig, ResetConfig and
UpdateRepoField are set only in webui's own tests. In production all three are
nil, so Editable is permanently false and the three write handlers always
answer 503. That is a whole descoped write surface still carrying handler and
test code.

_sam wrote (originally 2026-09-11):_ Investigation 2026-09-11 (verified against main @57d9be5). Bead's premise holds, and the real scope is larger than "move two jobs off webui.Server": the daemon never calls b.web.Handler(). Nothing in internal/app/archied serves the dashboard (only archieui/run.go:79 does), so b.web is a struct the daemon fills as a data carrier, not a server. What the daemon actually reads off b.web: - Cfg -> LocalConfigView (bootstrap.go:1353) and the config readiness probe (readiness.go:31) - Health -> healthSurface serves it on [health].listen (health.go:90) - Chat -> readiness sessionCount, and the Telegram chatTaskActorAdapter (bootstrap.go:560) - Channels -> readiness channelStates - ConfigProvenance / LastReload / ConfigOverrides -> read only from inside LocalConfigView What the daemon writes and nothing reads (dead production wiring): - b.web.Skills (bootstrap.go:392, skillCatalogAdapter, and it holds a frozen config.NewHolder(cfg), not the live holder) - b.web.Memory (bootstrap.go:898, memoryUIAdapter) - b.web.Curators (bootstrap.go:1234, curatorsUIAdapter) - b.web.WorkRequests (bootstrap.go:537) Their three adapter files (skill_ui.go, memory_ui.go, curator_ui.go) exist only to feed a Server that serves nothing. Recommended shape (producer split, no new package): 1. webui.LocalConfigView becomes a free function in webui: BuildConfigView(cfg config.Config, opts ConfigViewOptions) ConfigView, where opts carries provenance, overrides, reload status. The DTO and its unexported helpers (reposView, providersView, lockedConfigKeys, buildConfigSchema) stay put; only the *Server receiver goes. Server keeps ConfigSource, which is all the UI needs. 2. publishConfigSnapshot calls webui.BuildConfigView(b.d.Cfg.Get(), ...) directly; provenance moves to a boot field (b.currentProvenance already exists as configuration.Provenance; convert at the publish site). 3. Readiness reads b.d.Cfg, b.channelManager and a new b.chat field instead of b.web.*; the health registry becomes a boot field. 4. Delete b.web from the daemon entirely, along with the four dead field assignments and the three adapter files. 5. Delete Server.Cfg and its eight read sites. Behaviour delta for the UI process: none. Every branch deleted is already the nil side there. Verified individually: - api_tasks.go:92 resolveForge already has the published-projection path below it; the Cfg branch is daemon-only. - api_config.go:60 handleChannels Cfg fallback is unreachable (Channels and Cfg are both nil in the UI process). - api_capabilities.go:28 "channels": s.Channels != nil || s.Cfg != nil reduces to s.Channels != nil, same value. - server.go:219 trustForwardedHeaders: the UI process already sets its own Options.TrustForwardedHeaders field. - api_chat.go:388 ShowToolCalls and api_setup.go:30 checklist stay degraded; fixing those means publishing the fields in ConfigView, which is the separate projection work the PRD already names (archie-core-8cda.5.6). - api_logs.go:131 log file path: /api/logs has no contract yet either way. Test fallout: archieui/compose_test.go:58 asserts srv.Cfg == nil and stops compiling when the field goes. That clause should be deleted (structurally impossible beats asserted), and the PRD's "Acceptance criterion 1 is amended" paragraph updated to say the residue is gone. Adjacent, out of scope, worth its own bead: UpdateConfig, ResetConfig and UpdateRepoField are set only in webui's own tests. In production all three are nil, so Editable is permanently false and the three write handlers always answer 503. That is a whole descoped write surface still carrying handler and test code.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#1447