Skip to content

Route Project Work notices into Agent sessions with coalescing #4

Description

@LanicBlue

Context

T3 is the Project Consumer for its configured authenticated Client. Project Service delivers structured Work facts to a target agentId + projectId; T3 owns the mapping to runtime Sessions.

Dependencies:

Project Service must not know T3 Session, Thread, provider, model, workspace, or prompt-delivery details.

Consumer adapter

Integrate the supported ProjectConsumerRuntime with a thin T3 adapter:

interface RuntimeConsumerAdapter {
  listAgents(): Promise<AgentDescriptor[]>
  wakeAgent(input: StructuredWorkNotice): Promise<void>
}

listAgents() returns configured agentId + agentName. The authenticated Project Client identity comes from the credential, not a self-declared Consumer ID.

Only one active Consumer connection is allowed for the configured Project Client.

Session routing

Maintain one current Session for each:

logicalAgentId + Project Service projectId

Routing rules:

  • no current Session: create one using the Agent's Provider Instance and mapped T3 project/workspace;
  • active/idle Session: send one aggregate Work notification;
  • busy Session: record that Work is available and defer/coalesce the notification;
  • after the current Turn finishes: query authoritative open/assigned Work and send at most one aggregate notification;
  • archived Session: it is no longer current; create a new Session;
  • replayed noticeId/runId: do not create duplicate wake messages.

Project names and Agent names are display metadata only and may update without changing the mapping.

Aggregate notification

Do not inject each Project notice verbatim. Prefer a compact notification such as:

There are 3 assigned Work items waiting. Use the Project tools to inspect them.

The count must be refreshed from Project Service's authoritative assigned/open Work query before delivery. T3's local pending set is only debounce/dedup state, never a second Work lifecycle.

The Agent then uses internal MCP Project tools; it never receives the Project service credential or direct authenticated HTTP instructions.

Delivery semantics

  • Consumer ACK means T3 accepted/routed the notice.
  • ACK does not mean the Agent is running or Work completed.
  • If routing fails, return the protocol's delivery failure code.
  • Credential errors update integration status but do not delete the current Session.
  • T3 restart/reconnect must not multiply notifications for the same still-pending notice.

Acceptance criteria

  • T3 advertises configured Agents with stable ID plus display name.
  • One active Project Consumer connection exists for the configured Client.
  • Structured notices map by agentId + projectId to one current Session.
  • Missing Sessions are created with the configured Agent/provider/workspace binding.
  • Busy Sessions receive coalesced notification after the Turn, not repeated interrupts.
  • Notification count comes from authoritative Project Work state.
  • Duplicate/replayed notices do not create duplicate wake messages.
  • Archived Sessions cause creation of a new current Session.
  • Agent/Project renames affect display only.
  • Credential errors preserve Sessions.
  • Tests cover idle, busy, missing, archived, replay, reconnect, and restart cases.

Non-goals

  • Do not mirror Project Work lifecycle into T3.
  • Do not infer Agent runtime activity in Project Service.
  • Do not make Project Service select a T3 Session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions