agent-native
agent-native copied to clipboard
Agent can wedge a run indefinitely via raw db-query / meta-tool spiral: no wall-clock timeout, no progress heartbeat, and a completed tool's verdict never rendered
Summary
During a live E2E campaign on a production deployment of an agent-native app (v0.209.0), an agent run wedged for 4m45s with zero visible progress and had to be stopped manually. Forensics on the run's event stream (185 events) show three compounding framework behaviors, each worth a look on its own:
- No wall-clock timeout anywhere on the raw agent DB tools (
db-queryet al.) — an agent that keeps issuing DB reads can stall a run indefinitely. - No progress heartbeat from meta-tools — while the agent cycles
tool-search/db-schema/docs-search/framework-search/resources, the UI shows only a frozen chip; the user cannot tell work from a hang. - A completed action's result was never rendered —
check-ingredient-compatibilitycompleted successfully (events seq 146–154, correct payload) but its verdict never appeared in the thread UI before the wedge.
Reproduction (from our prod event stream)
Run asked to screen a formulation's ingredient compatibility in a thread that did not itself define the formulation:
- The agent had no action to resolve a formulation spec by id/name (our app's
list-formulationsreturns id/name/seed only — see "app-side mitigation" below), so it went looking:get-audit-event×40 (legitimate reads)- then 55
db-queryevents, including a cross-threadSELECT … FROM chat_threads— note the agent's raw DB tools can read across threads/users; the per-user scoping views did not stop a thread-scoped SELECT on another thread's data
check-ingredient-compatibilitywas invoked exactly once and completed — its result was never displayed- The agent resumed the db-query spiral; 4m45s in we stopped the run from the UI (terminal state
aborted/aborted:user, clean, nowrite_tool_outcome_unknown) - The same pattern exists in an earlier run from the same deployment (110
db-queryevents), so it is not a one-off
What we'd suggest
- A configurable per-tool wall-clock timeout on the raw DB tool execution path (we found no
statement_timeoutin the postgres client and no capture timeout in the CLI capture wrapper), with the timeout surfaced as a normal tool result the model can react to (consistent with the 4xx-as-verdict posture from #7778). - A progress heartbeat for long-running tool chains so the UI distinguishes work from a wedge.
- Investigation of the completed-but-never-rendered tool result path (the compat call finished at seq 154; nothing appeared in the thread before abort).
App-side mitigation (already on our roadmap)
- Add a spec-resolution action (get full formulation spec by id/name) so the model never needs the raw DB tools for ordinary app data.
- This is the same app that filed #7777/#7778; happy to provide the full event stream (185-event JSON) on request.
Thanks for the detailed report. The stalled run still needs investigation using the original event stream or a faithful reproduction; the existing test does not confirm what happened in your case.