Remove webui in-process Gateway and daemon wiring #1153

Closed
opened 2026-10-27 13:39:14 +00:00 by sam · 0 comments
Owner

Make webui chat and task handlers depend only on Gateway ChatContract and State
Store contracts. Remove gateway.Router, SessionStore, turns, ModelManager,
PersonaRegistry, concrete store fields, and the shared daemon config.Holder
assumption from production composition. Keep browser task actions, streaming,
cancellation and persona flows behaviorally equivalent through remote calls.

RESCOPED 2026-09-09 during review. The original text promised logs and update
flows "behaviorally equivalent through remote calls", which is impossible: no
Gateway or State Store RPC carries logs, persona, or update state, and
ui-service-boundary.md's route inventory marks those as degraded or
explicitly-removed until a contract lands. They are descoped here as
"reports unavailable; the SPA hides the entry", not preserved.

Concrete requirements this change must satisfy (each is a single omission that
would silently change behaviour at cutover rather than degrade visibly):

  1. Route /api/tasks/{id}/action through ChatContract.ApplyTaskAction, not
    Server.TaskActionService(). The remote Gateway process holds Cfg, Issues,
    Events and TaskStopper; relying on TaskActionService in the UI process means
    a nil Cfg bypasses max_retries (a policy hole), a nil Issues never closes the
    forge issue so the poller re-enqueues, a nil Events never publishes operator
    actions, and a nil TaskStopper returns 503 with no way to interrupt running
    work. Routing through ApplyTaskAction recovers all four. Supply the identity
    the contract takes from the request path (the daemon's chat turns already
    carry it; do not invent a new source).

  2. The capture-intake handoff is atomic. compose.go deliberately leaves
    Captures/CaptureLimiter/BindingDispatcher nil to avoid dual intake authority
    (pinned by compose_test.go TestComposeLeavesCaptureIntakeUnset). The same
    change that removes the daemon's in-process listener must wire them in the
    UI process, or POST /webhooks/capture/{source} goes from one owner to none.

  3. Rehome the update relay. Deleting webui.Server.Run takes
    reportPendingUpdate/watchPendingUpdate with it, and the standalone archie-ui
    bypasses them already. The update-targets-mechanism needs a home in the
    daemon (which owns the update flow) or an explicit descope; do not silently
    drop the self-update prompt.

  4. Routes with no State Store or Gateway contract become unavailable and must
    be enumerated explicitly, not left to nil-dereference: /api/logs and
    /api/logs/stream, /api/tasks/{id}/logs, /api/version and the update flow,
    /api/channels and reload, /api/curators, /api/memory, /api/skills,
    /api/workflows, /api/work-requests (gatewayrpc.Client implements only
    ChatContract). Each must return its documented degraded response and the
    SPA must hide the entry, or a contract bead must be filed first.

PREREQUISITES (contract amendments that must land before this cutover, or be
explicitly descoped in the PRD):

  • dashboard event-stream contract (archie-core-za9f) — live SSE needs a State
    Store subscribe RPC or a ratified poll decision.
  • dashboard admin/config contract (archie-core-ymut) — or a ratified descope
    of the config/reload page.

The in-process webui.Run listener is deleted in the same change, per PRD gate 7;
no fallback or second HTTP authority remains.

Notes

ymut resolved 2026-09-09, implementation lands here. Configuration page is read-only in the UI process:

READ: daemon publishes webui.ConfigView (already secret-free: ProviderView carries APIKeyEnv name + Configured bool, never a value) plus provenance, reload status and overridden keys, as a snapshot. Two State Store RPCs: PutConfigSnapshot (administrative token only, per staterpc.TaskGrants) and GetConfigSnapshot (UI reads it). Daemon republishes on boot and after each successful reload. Chosen over a config admin service on archied because that would make the daemon a gRPC server for the first time: grpc.NewServer appears only in RunGateway/RunStateStore, which are the standalone binaries' entry points, not the daemon's.

WRITE: PATCH /api/config, POST /api/config/reset, PATCH /api/config/repos/{owner}/{name} answer 503 and the SPA hides the controls. Editing is config.toml plus reload. Deliberate feature reduction; the policy in installUpdateConfigHandler (denied-key check, dotted overlay onto a clone, validate materialised config, overlay rows, provenance rebuild) stays daemon-local, and contracting it verbatim would build a Configuration Service inside a migration bead.

Full reasoning: docs/architecture/migration-decisions.md, 'Dashboard configuration page'. ui-service-boundary.md route table and configuration-ownership section amended to match.
Cutover landed 2026-09-10 (e037b95 + b6596ce + d03c213). (1) task actions route through ChatContract.ApplyOperatorTaskAction (0003141). (2) receiver + Captures/BindingDispatcher wired in archieui's compose in the same change that deletes the daemon's webui listener; daemon webui reduced to the config-snapshot renderer; persistEvents is insert-only. (3) update relay rehomed to daemon-local report path; no webui references. (4) degraded routes enumerated in archieui/degraded_routes_test.go; SPA hides sections via GET /api/capabilities. Capture-intake Publish now carries the request context (receiver publishes synchronously before the 202). Deployment docs: deployments/README.md + systemd-user-service.md document archie-ui; config.example.toml [web]/[capture] updated. task check green (104 pkgs).

Close reason

Closed


Imported from beads archie-core-8cda.5.4 · GitHub #766 · type task · priority P3 · created 2026-09-06 · closed 2026-09-09

Make webui chat and task handlers depend only on Gateway ChatContract and State Store contracts. Remove gateway.Router, SessionStore, turns, ModelManager, PersonaRegistry, concrete store fields, and the shared daemon config.Holder assumption from production composition. Keep browser task actions, streaming, cancellation and persona flows behaviorally equivalent through remote calls. RESCOPED 2026-09-09 during review. The original text promised logs and update flows "behaviorally equivalent through remote calls", which is impossible: no Gateway or State Store RPC carries logs, persona, or update state, and ui-service-boundary.md's route inventory marks those as degraded or explicitly-removed until a contract lands. They are descoped here as "reports unavailable; the SPA hides the entry", not preserved. Concrete requirements this change must satisfy (each is a single omission that would silently change behaviour at cutover rather than degrade visibly): 1. Route /api/tasks/{id}/action through ChatContract.ApplyTaskAction, not Server.TaskActionService(). The remote Gateway process holds Cfg, Issues, Events and TaskStopper; relying on TaskActionService in the UI process means a nil Cfg bypasses max_retries (a policy hole), a nil Issues never closes the forge issue so the poller re-enqueues, a nil Events never publishes operator actions, and a nil TaskStopper returns 503 with no way to interrupt running work. Routing through ApplyTaskAction recovers all four. Supply the identity the contract takes from the request path (the daemon's chat turns already carry it; do not invent a new source). 2. The capture-intake handoff is atomic. compose.go deliberately leaves Captures/CaptureLimiter/BindingDispatcher nil to avoid dual intake authority (pinned by compose_test.go TestComposeLeavesCaptureIntakeUnset). The same change that removes the daemon's in-process listener must wire them in the UI process, or POST /webhooks/capture/{source} goes from one owner to none. 3. Rehome the update relay. Deleting webui.Server.Run takes reportPendingUpdate/watchPendingUpdate with it, and the standalone archie-ui bypasses them already. The update-targets-mechanism needs a home in the daemon (which owns the update flow) or an explicit descope; do not silently drop the self-update prompt. 4. Routes with no State Store or Gateway contract become unavailable and must be enumerated explicitly, not left to nil-dereference: /api/logs and /api/logs/stream, /api/tasks/{id}/logs, /api/version and the update flow, /api/channels and reload, /api/curators, /api/memory, /api/skills, /api/workflows, /api/work-requests (gatewayrpc.Client implements only ChatContract). Each must return its documented degraded response and the SPA must hide the entry, or a contract bead must be filed first. PREREQUISITES (contract amendments that must land before this cutover, or be explicitly descoped in the PRD): - dashboard event-stream contract (archie-core-za9f) — live SSE needs a State Store subscribe RPC or a ratified poll decision. - dashboard admin/config contract (archie-core-ymut) — or a ratified descope of the config/reload page. The in-process webui.Run listener is deleted in the same change, per PRD gate 7; no fallback or second HTTP authority remains. ### Notes ymut resolved 2026-09-09, implementation lands here. Configuration page is read-only in the UI process: READ: daemon publishes webui.ConfigView (already secret-free: ProviderView carries APIKeyEnv name + Configured bool, never a value) plus provenance, reload status and overridden keys, as a snapshot. Two State Store RPCs: PutConfigSnapshot (administrative token only, per staterpc.TaskGrants) and GetConfigSnapshot (UI reads it). Daemon republishes on boot and after each successful reload. Chosen over a config admin service on archied because that would make the daemon a gRPC server for the first time: grpc.NewServer appears only in RunGateway/RunStateStore, which are the standalone binaries' entry points, not the daemon's. WRITE: PATCH /api/config, POST /api/config/reset, PATCH /api/config/repos/{owner}/{name} answer 503 and the SPA hides the controls. Editing is config.toml plus reload. Deliberate feature reduction; the policy in installUpdateConfigHandler (denied-key check, dotted overlay onto a clone, validate materialised config, overlay rows, provenance rebuild) stays daemon-local, and contracting it verbatim would build a Configuration Service inside a migration bead. Full reasoning: docs/architecture/migration-decisions.md, 'Dashboard configuration page'. ui-service-boundary.md route table and configuration-ownership section amended to match. Cutover landed 2026-09-10 (e037b95 + b6596ce + d03c213). (1) task actions route through ChatContract.ApplyOperatorTaskAction (0003141). (2) receiver + Captures/BindingDispatcher wired in archieui's compose in the same change that deletes the daemon's webui listener; daemon webui reduced to the config-snapshot renderer; persistEvents is insert-only. (3) update relay rehomed to daemon-local report path; no webui references. (4) degraded routes enumerated in archieui/degraded_routes_test.go; SPA hides sections via GET /api/capabilities. Capture-intake Publish now carries the request context (receiver publishes synchronously before the 202). Deployment docs: deployments/README.md + systemd-user-service.md document archie-ui; config.example.toml [web]/[capture] updated. task check green (104 pkgs). ### Close reason Closed --- _Imported from beads `archie-core-8cda.5.4` · GitHub #766 · type task · priority P3 · created 2026-09-06 · closed 2026-09-09_
sam added the lowtask labels 2026-10-27 13:39:14 +00:00
sam self-assigned this 2026-10-27 13:39:14 +00:00
sam closed this issue 2026-10-27 13:39:14 +00:00
sam added a new dependency 2026-10-27 13:42:17 +00:00
sam added a new dependency 2026-10-27 13:42:17 +00:00
sam added a new dependency 2026-10-27 13:42:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#1153