Skip to content

Webhook channel loses responses on timeout — no async/polling support #26

@jeremy-creator

Description

@jeremy-creator

Expected Behavior

When a webhook request takes longer than syncTimeoutMs (default 25s), the response should still be retrievable. The webhook channel should support an async>

Actual Behavior

The webhook channel is purely synchronous. When the agent takes longer than 25 seconds (typical for non-trivial requests), waitForResponse resolves null,>

Additionally, phantom_task_create writes tasks to the DB with status: 'queued' but nothing processes the queue, so there's no async alternative.

Relevant code path in webhook.ts:

const timeoutMs = this.config.syncTimeoutMs ?? 25_000;
const responseText = await this.waitForResponse(conversationId, inbound, timeoutMs);

if (responseText === null) {
    return Response.json({ status: "error", message: "Response timeout" }, { status: 504 });
}

A suggested fix: have the webhook return 202 Accepted with a task_id, persist responses in SQLite (webhook_responses table), and add a `GET /webhook?po>

Environment

  • OS: Ubuntu 25.10
  • Docker version: 28.2.2
  • Phantom version: 0.18.2
  • Deployment method: Docker
  • Model: claude-sonnet-4-6

Logs

# Typical flow: agent works for ~60s, but webhook times out at 25s
[webhook] Channel ready
# ... user sends message via webhook ...
# 25 seconds later, 504 returned to caller
# Agent finishes work ~35s later, result discarded

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions