Phase 1: Extract the Gateway Service #112

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

First real process extraction in the resolved extraction order (open
question #1). Stand up archie-gateway as its own binary serving
ChatContract over gRPC, using its existing isolated session SQLite
(internal/gateway/session_store_sqlite.go) and its existing store
adapters (the Gateway does not import internal/store today --
main.go:139, gateway/tasks.go:44 -- it consumes narrow contracts
StatusReader/TaskCreator/TaskLister/TaskController/AgentReader that
internal/app/archied adapts).

Migrate consumers onto ChatContract over gRPC:

  • UI (internal/webui) stops holding gateway.Router/SessionStore/Turns/
    ModelManager/PersonaRegistry in-process and calls ChatContract instead.
  • Messaging/Telegram's task-action path
    (chatTaskActorAdapter.ApplyChatTaskAction,
    internal/app/archied/main.go:655) stops detouring through webui's
    handleTaskAction HTTP handler (internal/webui/api_tasks.go:136,
    mounted at server.go:294) and calls ChatContract directly.

Why the Gateway goes first (not the generic "leaf first" advice): it is
already store-decoupled and already owns isolated session data, making
it both the stickiest capability (everything routes through it) and the
one with a ready seam -- extracting it first also unblocks UI (the most
entangled consumer), which is the PRD's ultimate goal. This is also the
operations dry-run for the gRPC/discovery playbook.

Depends on Phase 0 (the ChatContract seam, local + gRPC adapters, and
conformance suite must exist and be usable before the network path
becomes production).

Full reasoning: docs/inspiration/service-decomposition-open-questions-research-2026-09-05.md#1
(Phase 1 section).

Acceptance criteria

  • New cmd/archie-gateway binary serving ChatContract over real gRPC
    (using the generated server/client from Phase 0's proto definition).
  • Same-commit deletion of the in-process ChatContract serving path per
    question #3's resolved mechanism (no dual-live window); consumers
    flipped to mode = "remote" for ChatContract in that same commit.
  • Gateway's existing session SQLite and store adapters move with it into
    the new binary; no other domain's data moves.
  • internal/webui's chat path calls ChatContract over gRPC; it no longer
    holds gateway.Router/SessionStore/Turns/ModelManager/PersonaRegistry
    struct fields directly (closes verified coupling #2 from the PRD).
  • Messaging/Telegram's task-action path (pause/resume/abandon) calls
    ChatContract directly; the webui HTTP detour
    (chatTaskActorAdapter.ApplyChatTaskAction -> handleTaskAction) is
    removed (closes verified coupling #1 from the PRD).
  • A deployment profile or docs update reflecting the new archie-gateway
    binary (deployments/ per this repo's existing profile conventions).
  • task check passes; the daemon and archie-gateway both build; an
    end-to-end smoke path (chat turn through the new gRPC hop) is
    exercised.

Close reason

Atomic flip landed: ChatContract now served only by archie-gateway over gRPC; daemon has no in-process fallback. Telegram/email keep in-process routers (streaming callback can't cross the wire-safe contract). Verified end-to-end (both binaries booted, webui chat round-tripped through the gRPC hop). Commit 38cd0d5 on feat/gateway-service.


Imported from beads archie-core-8cda.3 · GitHub #730 · type task · priority P2 · created 2026-09-05 · closed 2026-09-05

First real process extraction in the resolved extraction order (open question #1). Stand up archie-gateway as its own binary serving ChatContract over gRPC, using its existing isolated session SQLite (internal/gateway/session_store_sqlite.go) and its existing store adapters (the Gateway does not import internal/store today -- main.go:139, gateway/tasks.go:44 -- it consumes narrow contracts StatusReader/TaskCreator/TaskLister/TaskController/AgentReader that internal/app/archied adapts). Migrate consumers onto ChatContract over gRPC: - UI (internal/webui) stops holding gateway.Router/SessionStore/Turns/ ModelManager/PersonaRegistry in-process and calls ChatContract instead. - Messaging/Telegram's task-action path (chatTaskActorAdapter.ApplyChatTaskAction, internal/app/archied/main.go:655) stops detouring through webui's handleTaskAction HTTP handler (internal/webui/api_tasks.go:136, mounted at server.go:294) and calls ChatContract directly. Why the Gateway goes first (not the generic "leaf first" advice): it is already store-decoupled and already owns isolated session data, making it both the stickiest capability (everything routes through it) and the one with a ready seam -- extracting it first also unblocks UI (the most entangled consumer), which is the PRD's ultimate goal. This is also the operations dry-run for the gRPC/discovery playbook. Depends on Phase 0 (the ChatContract seam, local + gRPC adapters, and conformance suite must exist and be usable before the network path becomes production). Full reasoning: docs/inspiration/service-decomposition-open-questions-research-2026-09-05.md#1 (Phase 1 section). ### Acceptance criteria - New cmd/archie-gateway binary serving ChatContract over real gRPC (using the generated server/client from Phase 0's proto definition). - Same-commit deletion of the in-process ChatContract serving path per question #3's resolved mechanism (no dual-live window); consumers flipped to mode = "remote" for ChatContract in that same commit. - Gateway's existing session SQLite and store adapters move with it into the new binary; no other domain's data moves. - internal/webui's chat path calls ChatContract over gRPC; it no longer holds gateway.Router/SessionStore/Turns/ModelManager/PersonaRegistry struct fields directly (closes verified coupling #2 from the PRD). - Messaging/Telegram's task-action path (pause/resume/abandon) calls ChatContract directly; the webui HTTP detour (chatTaskActorAdapter.ApplyChatTaskAction -> handleTaskAction) is removed (closes verified coupling #1 from the PRD). - A deployment profile or docs update reflecting the new archie-gateway binary (deployments/ per this repo's existing profile conventions). - task check passes; the daemon and archie-gateway both build; an end-to-end smoke path (chat turn through the new gRPC hop) is exercised. ### Close reason Atomic flip landed: ChatContract now served only by archie-gateway over gRPC; daemon has no in-process fallback. Telegram/email keep in-process routers (streaming callback can't cross the wire-safe contract). Verified end-to-end (both binaries booted, webui chat round-tripped through the gRPC hop). Commit 38cd0d5 on feat/gateway-service. --- _Imported from beads `archie-core-8cda.3` · GitHub #730 · type task · priority P2 · created 2026-09-05 · closed 2026-09-05_
sam added the mediumtask labels 2026-10-27 13:35:00 +00:00
sam self-assigned this 2026-10-27 13:35:00 +00:00
sam closed this issue 2026-10-27 13:35:00 +00:00
sam added a new dependency 2026-10-27 13:41:44 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#112