Skip to content

Make human-steering escalation robust: a durable request/response (issue comment) + spawn-task delivery + release/resume, instead of marker-detect + live PTY injection over Slack #99

Description

@khaliqgant

Problem

Human-steering escalation (agent hits ambiguity → asks a human → gets an answer → continues) is currently a ~6-link chain, and in a full day of testing nearly every link failed independently:

  1. Agent emits the magic string [factory-needs-input] (in a DM or its output)
  2. Factory detects that marker by watching the agent's stream
  3. Factory routes it to Slack (writeback) — the gate falsely tripped on a stale sync signal, silently stripping the ask ability: Slack writeback gate silently strips human-steering: a stale sync signal removes the agent's ability to ask, and the bypass reads the same broken source #94, fixed by fix: preserve human steering during Slack degradation #95
  4. Human replies in Slack
  5. Slack ingest delivers the reply — last_event_at reports the transport 6 weeks dead while webhooks deliver in ~8s: AgentWorkforce/cloud#2666
  6. Factory injects the reply into the still-running agent — PTY injection into a busy codex never confirms delivery_injected: Locally-spawned agents never register with relaycast (send_dm agent_not_found) — briefing never delivered; root cause behind #96/#97; reproduces on two machines #98; the "abort when it fails" patch fix: abort dispatch after critical delivery failure #97 doesn't fire either

The design only works if all six links are healthy at the same instant. That is the opposite of robust, and it's why the ask round trip still cannot be demonstrated end-to-end.

Root fragilities

Proposed: escalation as a durable request/response record

Replace the chain with two durable operations and no live injection anywhere:

  1. Agent hits ambiguity → posts its question as a comment on the source GitHub issue (it already has issue write via the .integrations mount), then exits cleanly.
  2. Factory sees the question by reading the issue comments (data), not by parsing the agent's stream, and records "awaiting human answer."
  3. Human replies as an issue comment.
  4. Factory re-spawns the agent with question+answer folded into its new spawn task (release/resume) — never injected into a live agent.

Three principles, each kills a class of today's failures

The escalation channel is the GitHub issue itself

No new store needed. The question is an issue comment, the answer is a reply comment, and the agent re-spawns reading the comments — durable, visible to the human in the natural place, and Slack becomes an optional mirror, off the critical path.

Concrete steps (ownership: almost entirely factory-side + one template change)

What already exists vs what's new

  • Exists / reuse: spawn-task delivery (prototyped, needs reviewer + merge), Release agents while awaiting human clarification #79 release/resume, #injectPendingGithubClarification (GitHub reply path), the issue-as-store (the mount).
  • Genuinely new: the template instruction (ask via issue comment) and factory watching issue comments for the Q/A instead of the agent stream. That's the core of it.

Validation note

This must be validated on a quiet machine — every test so far was confounded by other agents (the pear app's lead/gap/query/durable) polluting process/session forensics. On a box running only the one dispatch, the proof is watchable and unfakeable: agent posts comment → exits → human replies → agent re-spawns and finishes.

Related

#94, #95 (Slack gate), #96 (fail-open on un-briefed agent), #97 (abort-on-critical-delivery-failure — becomes moot under Step 0), #98 (codex injection race — the immediate blocker this design removes), #79 (release/resume — the reply half already built), AgentWorkforce/cloud#2666 (the Slack ingest lie that Step 4 takes off the critical path).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions