You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cursor): require every documented subagent envelope field and validate author.email with the pinned format
Addresses the second Codex review round on #375:
- subagentStart: parent_conversation_id, tool_call_id, subagent_model, and
is_parallel_worker are required (only git_branch is documented optional) in
both the route envelope validator and the generated wrapper validator.
- subagentStop: task, description, summary, duration_ms, message_count,
tool_call_count, modified_files, and agent_transcript_path (string|null) are
required to match the documented input, which marks no field optional.
- Simulation encoders carry neutral values for the mandatory fields canonical
input lacks so hook simulation still passes the tightened validators.
- author.email goes through the pinned schema's format: email checker so
values like dev@example..com fail closed as cursor.manifest.author.email.invalid.
diagnostics.push(errorDiagnostic(`${codePrefix}.manifest.author.email.invalid`,'Cursor author.email must be a valid email address.'));
392
+
diagnostics.push(errorDiagnostic(`${codePrefix}.manifest.author.email.invalid`,"Cursor author.email must be an email address the pinned schema's email format admits."));
' for (const field of ["subagent_id", "subagent_type", "task", "parent_conversation_id", "tool_call_id", "subagent_model"]) requireString(input, field);',
848
+
' if (typeof input.is_parallel_worker !== "boolean") fail("native is_parallel_worker must be a boolean");',
849
+
' if (input.git_branch !== undefined) requireString(input, "git_branch");',
839
850
' return;',
840
851
' }',
841
852
' if (canonicalEvent === "agentStop") {',
842
-
' requireString(input, "subagent_type");',
853
+
' for (const field of ["subagent_type", "task", "description", "summary"]) requireString(input, field);',
843
854
' if (!["completed", "error", "aborted"].includes(input.status)) fail("native subagentStop status is invalid");',
844
-
' if (typeof input.loop_count !== "number") fail("native subagentStop loop_count must be a number");',
855
+
' for (const field of ["duration_ms", "message_count", "tool_call_count", "loop_count"]) {',
856
+
' if (typeof input[field] !== "number") fail(`native subagentStop ${field} must be a number`);',
857
+
' }',
858
+
' if (!Array.isArray(input.modified_files) || !input.modified_files.every((file) => typeof file === "string")) fail("native modified_files must be an array of strings");',
859
+
' if (input.agent_transcript_path !== null && typeof input.agent_transcript_path !== "string") fail("native agent_transcript_path must be a string or null");',
845
860
' return;',
846
861
' }',
847
862
' if (typeof input.loop_count !== "number") fail("native stop loop_count must be a number");',
0 commit comments