Skip to content

Decide (on paper) whether human-interactive chat belongs in the pull queue — TARGET_ARCHITECTURE Open Question 7 #1989

Description

@obasilakis

Summary

docs/planning/TARGET_ARCHITECTURE.md Open Question 7 — "Does human-interactive chat belong in the queue at all?" — is still marked "Under consideration, not decided." The doc instructs: "Decide before the #946 pilot, which routes chat_with_agent — an interactive kind — through the queue first."

#946 shipped. The decision is overdue, and it is now being made implicitly by code.

Why this needs closing now

PR #1982 (#1766 soak prep) makes a pull pilot's dispatch queue-only for autonomous triggers while excluding interactive ones — human chat and Session-tab turns keep today's synchronous push path and today's Redis session lock. That is an implementation of Open Question 7's own candidate answer (the "scope cut" rather than added machinery), and it is load-bearing: without it, one FIFO ordered by queued_at parks a human turn behind N batch tasks until the held connection times out, and N competing workers can claim two turns of one session concurrently — the concurrent --resume on a single JSONL that the session lock exists to prevent.

So the answer is now encoded in working code that ships to production, while the doc still says undecided. That gap is the problem:

  • Nobody reviewing TARGET_ARCHITECTURE.md can tell that the boundary is already real.
  • The trigger carve-out in services/pull_pilot.py::pull_owns_dispatch looks like a local implementation detail; it is actually an architectural commitment.
  • Phase 4 of feat: pull / work-stealing coordination (push→pull dispatch) #1081 ("sync edge adapter") is specified against the other answer — chat as a thin edge adapter over the queue. Both cannot be right.

The two candidates (verbatim from the doc)

  1. Edge adapter — the WebSocket or a ?wait=true call holds open, enqueues, forwards the reply on the completion event. Synchronous UX, async internals, held connection times out. Consistent with Principle Feature/vector log retention #3; but carries the starvation + per-session-serialization problems above, unaddressed.
  2. Scope cut — the durable queue carries autonomous traffic only (schedules, webhooks, agent-to-agent, loops, channel messages); human chat/session turns keep the direct synchronous path and the session lock. Concurrency becomes one physical budget of N per agent: interactive turns take a slot on arrival, workers pull batch work only when slots are spare, optionally reserving one slot so long batch turns can't lock chat out. The doc leans this way; fix(pull): make the pilot flag a true either/or + soak measurement set (#1766) #1982 implements it.

Acceptance Criteria

  • A decision is recorded in TARGET_ARCHITECTURE.md — Open Question 7 resolved, not merely annotated
  • If the scope cut wins: §Coordination Model updated to state the queue carries autonomous traffic only, and feat: pull / work-stealing coordination (push→pull dispatch) #1081 Phase 4 re-scoped or dropped accordingly
  • If the edge adapter wins: fix(pull): make the pilot flag a true either/or + soak measurement set (#1766) #1982's carve-out is a deliberate temporary measure and says so, with the starvation + session-serialization designs specified
  • Either way the capacity model is stated explicitly — one physical budget of N, and whether a slot is reserved for interactive
  • The decision is reflected in pull_owns_dispatch's docstring rather than that docstring being the only place it exists

Technical Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-mediumComplexity: medium (board points 5-8)priority-p2Importantstatus-in-devMerged to dev, awaiting release cut to mainstatus-readyGreenlit and ready for development (vetted; counterpart to status-incubating)theme-reliabilityTheme: Reliabilitytype-featureNew functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions