Skip to content

Bug: request_human_input crashes uncaught when an approval is already pending on the thread — expected conflict surfaced as a plain server Error (5 events, 08-07→08-12) #3111

Closed as not planned

Description

@larryro

Source: GlitchTip sweep of demo.tale.dev, 2026-08-31. Related-but-distinct precedents: #2056 (closed — raw backend Errors reach the chat approval/human-input cards with no actionable message), #2767 (open — human-input pause banner), #2079 (closed — todo_list field validation).

Evidence

  • TALE-PROJECT-10N — Uncaught Error: Cannot create approval: another approval is already pending on this thread. Wait for the existing approval to be resolved before creating a new one. — 5 events, 2026-08-07T21:40:54Z → 2026-08-12T13:27:13Z. Stack: agent_tools/human_input/internal_mutations.ts:137 (createHumanInputRequest mutation) → approvals/helpers.ts:288 (createApproval). Both modules are private-overlay (the public tree's convex/approvals/ carries only policy/validators).
  • Context: the 08-12T13:27Z event sits inside the same session window as the empty-response chat-turn failures (TALE-PROJECT-113, 13:02→13:30Z) — consistent with an agent retrying a turn and re-issuing its human-input request against a still-pending approval.

Read

The one-pending-approval-per-thread invariant is fine; the failure mode isn't. When an agent turn (or a double-fired tool call / retried mutation) requests human input while an approval is already pending, createApproval throws a plain uncaught Error: it records an error-level GlitchTip event for an expected conflict, and — exactly the pattern #2056 documented — an unstructured plain Error gives the client and the agent nothing actionable, so the turn dies instead of converging on the existing request.

Fix direction

  1. Make it a structured expected conflict: throw ConvexError (e.g. code APPROVAL_ALREADY_PENDING, carrying the pending approval id) instead of a plain Error.
  2. Better: make createHumanInputRequest idempotent for this case — if a pending approval exists on the thread, return/attach to it rather than erroring, so a retried agent turn converges.
  3. Either way, stop recording the conflict as an uncaught server error (align with Bug: expected "Unauthenticated" refusals land as uncaught server errors — ~550+ GlitchTip events across 12+ groups, still firing daily #3088's reporting-policy direction for expected refusals).

Acceptance

  • Requesting human input on a thread that already has a pending approval yields a structured refusal or the existing request — never an uncaught plain Error.
  • TALE-PROJECT-10N stays flat; an agent that double-requests human input recovers instead of failing the turn.

Tracked on the tale board as TAL-25.

Activity

  1. added
    priority: low
    bug
    service: platform
    automated
    on Aug 31, 2026
  2. yannickmonney commented on Sep 27, 2026

    @yannickmonney
    Contributor

    Closing as obsolete. The throw exists nowhere at v0.5.58. Chat's ask_question is off the wire, the automation ask_human door is idempotent (INSERT … ON CONFLICT … WHERE status='pending' DO UPDATE in backend/domains/automations/ask-shim.ts, migration 0082), and the connector approval gate is idempotent per operation (backend/domains/approvals/gate.ts).

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

    automatedbugpriority: lowservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions