Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Through AST reverse-engineering of cursor-agent-exec/dist/main.js, aid-daemon/aid/dist/daemon.cjs, renderer.log, local SQLite (state.vscdb), and local subagents/*.jsonl transcripts in Cursor 3.27.12, we identified two distinct root causes breaking Subagents (cursor:Task) while main chat and top-level tools (Read, Write, StrReplace, Shell, Grep, Glob) work 100% normally:
Bug A (True Failure to Start — New subagent — Couldn't start / arguments: {})
When invoking on-demand tools registered under the cursor dynamic namespace (Task / Subagent, WebSearch, AwaitShell, TodoWrite) via CallDynamicTool, models routed through backends enforcing OpenAI Structured Outputs (strict: true) or Constrained / Guided Decoding (e.g., XGrammar / Outlines) repeatedly emit arguments: {} (while still populating mcpDetails.description).
This causes:
cursor:Task(Subagent): Infinite retry loop displaying “New subagent — Couldn’t start” (“Subagent failed to start.”), failing Zod validation with missing requireddescriptionandprompt.cursor:WebSearch: Immediate Zod validation failure (missing requiredsearch_term).cursor:AwaitShell: Silently drops custom timeout arguments and falls back to default 30s sleep because all its fields are optional.
Root Cause in cursor-agent-exec/dist/main.js (IG(e)), aid-daemon/aid/dist/daemon.cjs (stripSchemaArtifacts), and shared Cloud Backend Loop (byok-connect-routed):
- In
CallDynamicTool(zft),argumentsis defined as a dynamic recordz.record(z.string(), JsonValue)(U$.g1P(U$.YjP(), N)), whose Draft-07 JSON Schema has NOpropertiesfield and relies solely onadditionalProperties: { anyOf: [...] }. - Before registering tool schemas,
PG(e) -> IG(e)unconditionally destructures and discardsadditionalProperties:
const { $schema: r, default: n, definitions: s, markdownDescription: o, additionalProperties: i, ...a } = t; return a; - This collapses
CallDynamicTool.properties.argumentsinto a bare{"type": "object"}. Understrict: true/ constrained decoding, a bare object with nopropertiesis normalized to{"type": "object", "properties": {}, "additionalProperties": false}, which mathematically forbids any key and forces the decoder to emitarguments: {}.
Bug B (False Failure to Start — UI Card Frozen with No Progress due to ensureLoaded / not hydrating Race Condition)
Even when CallDynamicTool succeeds with valid parameters (description and prompt populated), the Subagent UI card in the chat panel displays the task title (e.g., Bugbot), freezes with zero streaming progress, and never expands tool steps — making it look stuck or unstarted.
Root Cause in Electron Renderer (MainThreadCursorAgentHost.ensureLoaded) vs. Local SQLite (state.vscdb → composerHeaders table):
- The background Subagent worker starts immediately and executes multi-turn tool calls, writing the full transcript to
~/.cursor/projects/<workspace>/agent-transcripts/<parent-uuid>/subagents/<subagent-uuid>.jsonluntilturn_ended. - However,
MainThreadCursorAgentHost.ensureLoaded(subagentId)checksheader window1–393ms beforecreatedAtis committed to the SQLitecomposerHeaderstable (verified across 9 consecutive subagent spawns:+17ms,+147ms,+1ms,+16ms,+19ms,+393ms,+30ms,+33ms,+23ms). - Exact
renderer.logtrace:
2026-10-25 12:24:45.902 [info] [MainThreadCursorAgentHost] ensureLoaded: no composer header for 46262d72-... in the header window or on a loaded handle; not hydrating
2026-10-26 07:37:10.944 [info] [MainThreadCursorAgentHost] ensureLoaded: no composer header for f1f8731e-... in the header window or on a loaded handle; not hydrating
2026-10-26 08:56:02.224 [info] [MainThreadCursorAgentHost] ensureLoaded: no composer header for e59f23e6-... in the header window or on a loaded handle; not hydrating
- Because
ensureLoadedimmediately gives up (not hydrating) and binds a0 turnsdummy handle without retry, the UI card never receives live tool-call streaming events. Worse, if the user thinks it is hung and clicks Undo/Rewind, Cursor deletes the completed subagent state (restore_or_rewind).
Steps to Reproduce
1. Deterministic 1-line reproduction for Bug A (IG(e) stripping additionalProperties):
node -e '
function k0(e, t) {
if (typeof e != "object" || e === null) return e;
if (Array.isArray(e)) return e.map(n => k0(n, t));
const r = {};
for (const [n, s] of Object.entries(e)) r[n] = k0(s, t);
return t(r);
}
function IG(e) {
return k0(e, t => {
const { $schema: r, default: n, definitions: s, markdownDescription: o, additionalProperties: i, ...a } = t;
return a;
});
}
const rawSchema = {
type: "object",
properties: {
namespace: { type: "string" },
toolName: { type: "string" },
arguments: {
type: "object",
additionalProperties: { type: ["string", "number", "boolean", "object", "array"] },
description: "Arguments to pass to the tool, as described by the tool descriptor."
}
},
required: ["namespace", "toolName"],
additionalProperties: false
};
console.log(JSON.stringify(IG(rawSchema).properties.arguments, null, 2));
'
2. Read-only SQLite + renderer.log verification probe for Bug B (ensureLoaded vs. composerHeaders.createdAt):
import datetime, re, sqlite3
from pathlib import Path
DB = Path.home() / "Library/Application Support/Cursor/User/globalStorage/state.vscdb"
RENDERER_LOG = Path.home() / "Library/Application Support/Cursor/logs/<latest_log_dir>/window1_wb1/renderer.log"
con = sqlite3.connect(f"file:{DB}?mode=ro", uri=True)
pat = re.compile(r"^(d{4}-d{2}-d{2} d{2}:d{2}:d{2}.d{3}).*no composer header for ([0-9a-f-]+)")
ensure_ts = {m.group(2): datetime.datetime.strptime(m.group(1), "%Y-%m-%d %H:%M:%S.%f")
for line in RENDERER_LOG.read_text(errors="replace").splitlines() if (m := pat.match(line))}
for cid, t_ensure in ensure_ts.items():
row = con.execute("SELECT subagentTypeName, createdAt FROM composerHeaders WHERE composerId=?", (cid,)).fetchone()
if row:
sub_type, created_ms = row
delta_ms = (datetime.datetime.fromtimestamp(created_ms / 1000) - t_ensure).total_seconds() * 1000
print(f"child={cid[:8]} type={str(sub_type):15} lag={delta_ms:+5.0f}ms")
Expected Behavior
- Fix for Bug A (
IG(e)/stripSchemaArtifacts): Only strip booleanadditionalProperties: falseon fixedz.objectschemas, and preserveadditionalPropertieswhen it is a schema object representing a dynamicZodRecorddictionary:
function IG(e) {
return k0(e, t => {
const { $schema: r, default: n, definitions: s, markdownDescription: o, additionalProperties: i, ...a } = t;
if (typeof i === "object" && i !== null) {
a.additionalProperties = true; // Preserve dynamic record semantics without recursive $ref
}
return a;
});
}
- Fix for Bug B (
MainThreadCursorAgentHost.ensureLoaded): Ensure the subagent’scomposerHeadersrecord is registered in theheader window/ committed before triggeringensureLoaded, or add a short bounded retry / event subscription whencomposerHeadersis not yet visible instead of immediately falling through tonot hydrating.
Operating System
MacOS
Version Information
Cursor IDE Version: 3.27.12 (arm64)
OS: darwin 25.6.0 (macOS)
For AI issues: which model did you use?
Auto (lazy/default) / OpenAI-compatible models via byok-connect-routed with strict/constrained tool decoding
Additional Information
Full technical write-up, AST symbol trace (zft -> pG/dG -> PG/IG -> toe.executeToolStream -> Lse -> qse -> Dse), millisecond-level renderer.log vs. state.vscdb (composerHeaders) race table, and verification scripts:
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor