feat(tasks): add createQuickForm for QuickForm HITL tasks#488
feat(tasks): add createQuickForm for QuickForm HITL tasks#488chetanyauipath wants to merge 1 commit into
Conversation
Review summaryFive issues found, all blocking per CLAUDE.md conventions. New findings posted this run:
|
Review summaryOne new finding this run (all five prior threads are resolved with fixes verified): New issue posted:
All previously raised issues are confirmed fixed:
|
| * ``` | ||
| */ | ||
| @track('Tasks.CreateQuickForm') | ||
| async createQuickForm(options: TaskCreateQuickFormOptions, folderId: number): Promise<TaskCreateResponse> { |
There was a problem hiding this comment.
lets add this to above create method itself, take in type as a parameter
f0e3bff to
1ad3c60
Compare
Review summary (run 3)Three new findings posted this run. New inline comments:
Still open from prior run: PRRT_kwDOOpObr86HAbwI — try/catch in the createQuickForm integration test block (tasks.integration.test.ts line 140). |
1ad3c60 to
9df426e
Compare
| | { type: TaskType.Form; data: any; action: string } | ||
| | { type: TaskType.App; data: any; action: string } | ||
| | { type: TaskType.QuickForm; data: any; action: string } | ||
|
|
There was a problem hiding this comment.
New code added by this PR uses any in the QuickForm variant of TaskCompleteOptions. Per agent_docs/conventions.md: "No any type — use unknown if truly unknown, then validate."
The existing Form and App variants also use any (pre-existing issue), but new additions shouldn't carry it forward.
| | { type: TaskType.QuickForm; data: unknown; action: string } |
Review summary (run 4)Two new findings posted this run. New inline comments:
Still open from prior runs:
|
9df426e to
7030c02
Compare
| ], | ||
| }; | ||
|
|
||
| const folderId = config.folderId ? Number(config.folderId) : undefined; |
There was a problem hiding this comment.
The ?: undefined fallback silently swallows a missing folderId, and then folderId! below suppresses the TypeScript warning without actually preventing the bug. At runtime this would pass undefined to tasks.create() and produce an obscure API error instead of a clear test failure.
Per agent_docs/rules.md: "Always throw new Error() when test preconditions are not met — whether it's missing config (e.g., no folderId) or missing test data."
| const folderId = config.folderId ? Number(config.folderId) : undefined; | |
| if (!config.folderId) { | |
| throw new Error('QuickForm integration test requires folderId — set FOLDER_ID in the test environment'); | |
| } | |
| const folderId = Number(config.folderId); |
Then drop the ! from folderId! on the tasks.create(...) call below.
Review summary (run 5)One new finding posted this run. New inline comment:
Still open from prior runs:
|
…inator Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
7030c02 to
1bd4032
Compare
Review summary (run 6)One thread unresolved this run. Unresolved thread: thread on |
| let payload: Record<string, unknown>; | ||
| if (options.type === TaskType.QuickForm) { | ||
| const { labels, ...rest } = options; | ||
| payload = labels === undefined ? rest : { |
There was a problem hiding this comment.
why are labels added only for quick forms?
| * await tasks.create({ | ||
| * type: TaskType.QuickForm, | ||
| * title: "Approve invoice INV-1234", | ||
| * taskSchemaKey: "8e4f2a91-3c7e-4d2b-9b5c-1a6f8d3e2c91", |
There was a problem hiding this comment.
Please make taskSchemaKey as optional here, from sdk only the schema should be passed. It is confusing from a developer perspective to add both schema and schemaKey here
| * Both `taskSchemaKey` and `schema` are sent on every call: Orchestrator upserts | ||
| * the schema by `taskSchemaKey`, then creates the task in the same call. | ||
| */ | ||
| export interface TaskCreateQuickFormOptions { |
There was a problem hiding this comment.
instead of creating separate options for each please create a base one which accepts the common fields, refer to models in tasks for the same
|
To be updated with Types support in a followup, when ready, allowing people to pass in 'UI compliant' schemas. Today, it allows all JSONs |
Adds QuickForm HITL task support to
TasksService.createby making it a discriminated union ontype. Existing callers keep working,tasks.create({ title, data, priority }, folderId)still posts aTaskType.Externaltask with no source change.To create a QuickForm task, pass
type: TaskType.QuickFormplustaskSchemaKeyand inlineschema. Optional fields:data,priority,labels,isActionableMessageEnabled,actionableMessageMetaData,creatorJobKey. Both paths POSTto
/orchestrator_/tasks/GenericTasks/CreateTaskand return aTaskwith the same method shape.