feat: Added ui to support input params for task creation#222
feat: Added ui to support input params for task creation#222michael-chou359 merged 5 commits intomainfrom
Conversation
|
|
||
| return ( | ||
| <div className="flex w-full max-w-3xl flex-col gap-2"> | ||
| {process.env.NODE_ENV === 'development' && !taskID && ( |
There was a problem hiding this comment.
Let's allow this in all envs but hide when the chat is disabled
| {!taskID && !isDisabled && ( | ||
| <div className="flex flex-col gap-1"> | ||
| <button | ||
| type="button" | ||
| className="text-muted-foreground hover:text-foreground ml-4 flex items-center gap-1 text-sm transition-colors" | ||
| onClick={() => setIsTaskParamsOpen(v => !v)} | ||
| > | ||
| <span>{isTaskParamsOpen ? '▾' : '▸'}</span> | ||
| Task Parameters | ||
| </button> | ||
| {isTaskParamsOpen && ( | ||
| <DataInput | ||
| prompt={taskParams} | ||
| setPrompt={setTaskParams} | ||
| isDisabled={isDisabled} | ||
| handleSendPrompt={handleSendPrompt} | ||
| codeMirrorViewRef={taskParamsViewRef} | ||
| /> | ||
| )} | ||
| </div> |
There was a problem hiding this comment.
Missing dev-only guard on Task Parameters UI
The PR description says "Also only available in dev environment," but neither the UI panel (line 181) nor the extraTaskParams parse logic (line 126) has a process.env.NODE_ENV === 'development' check. As-is, the Task Parameters accordion and its ability to inject arbitrary JSON into createTask are fully live in production, directly contradicting the stated design constraint.
Prompt To Fix With AI
This is a comment left during a code review.
Path: agentex-ui/components/primary-content/prompt-input.tsx
Line: 181-200
Comment:
**Missing dev-only guard on Task Parameters UI**
The PR description says "Also only available in dev environment," but neither the UI panel (line 181) nor the `extraTaskParams` parse logic (line 126) has a `process.env.NODE_ENV === 'development'` check. As-is, the Task Parameters accordion and its ability to inject arbitrary JSON into `createTask` are fully live in production, directly contradicting the stated design constraint.
How can I resolve this? If you propose a fix, please make it concise.| if (taskParams.trim()) { | ||
| try { | ||
| extraTaskParams = JSON.parse(taskParams); | ||
| } catch { | ||
| toast.error('Invalid Task Parameters JSON'); | ||
| return; | ||
| } | ||
| } |
There was a problem hiding this comment.
Stale task params silently injected when accordion is closed
extraTaskParams is applied whenever taskParams.trim() is non-empty, regardless of whether isTaskParamsOpen is true. If a user opens the accordion, enters params, then closes it (collapsing the UI), the next handleSendPrompt call will still inject those params without any visible indicator — directly contradicting the visual affordance of the toggle. Gate the parse behind isTaskParamsOpen so that closing the accordion genuinely disables the params.
| if (taskParams.trim()) { | |
| try { | |
| extraTaskParams = JSON.parse(taskParams); | |
| } catch { | |
| toast.error('Invalid Task Parameters JSON'); | |
| return; | |
| } | |
| } | |
| if (isTaskParamsOpen && taskParams.trim()) { | |
| try { | |
| extraTaskParams = JSON.parse(taskParams); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: agentex-ui/components/primary-content/prompt-input.tsx
Line: 126-133
Comment:
**Stale task params silently injected when accordion is closed**
`extraTaskParams` is applied whenever `taskParams.trim()` is non-empty, regardless of whether `isTaskParamsOpen` is `true`. If a user opens the accordion, enters params, then closes it (collapsing the UI), the next `handleSendPrompt` call will still inject those params without any visible indicator — directly contradicting the visual affordance of the toggle. Gate the parse behind `isTaskParamsOpen` so that closing the accordion genuinely disables the params.
```suggestion
if (isTaskParamsOpen && taskParams.trim()) {
try {
extraTaskParams = JSON.parse(taskParams);
```
How can I resolve this? If you propose a fix, please make it concise.
See issue here:
https://linear.app/scale-epd/issue/AGX1-230/default-agentex-gui-support-agents-that-require-parameters-at-task
Added task parameters drop down in the UI

Clicking drops down into a json input

input is passed as additional params to task creation backend call

Task Params only available when task is initialized, the ui disappears with subsequent chat messages.
Greptile Summary
createTaskparams payload.taskParamsvalue is applied on send whenevertaskParams.trim()is non-empty, even when the accordion has been closed by the user, silently injecting stale JSON into task creation.setPrompt('')is cleared before theextraTaskParamsJSON parse guard, so an invalid JSON entry erases the user's main prompt text before the error is surfaced.Confidence Score: 3/5
PR has two P1 defects affecting the primary send path; needs fixes before merging.
Two P1 findings cap the score at 4; both affect core send behavior with concrete wrong outcomes (stale params injected silently, prompt text wiped before validation), pulling the score to 3.
agentex-ui/components/primary-content/prompt-input.tsx — handleSendPrompt logic around extraTaskParams parse and setPrompt ordering.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[User presses Send] --> B{isDisabled or prompt empty?} B -->|Yes| C[toast error, return] B -->|No| D[setPrompt cleared] D --> E{currentTaskId exists?} E -->|Yes| F[sendMessage] E -->|No - new task| G{taskParams non-empty? regardless of isTaskParamsOpen} G -->|Valid JSON| H[extraTaskParams = parsed JSON] G -->|Invalid JSON| I[toast error but prompt already cleared] G -->|Empty| J[extraTaskParams is empty] H --> K[createTask with extraTaskParams + description + content] J --> K K --> L[updateParams with new taskID] L --> F F --> M[Task Params UI hidden but taskParams state persists]Comments Outside Diff (1)
agentex-ui/components/primary-content/prompt-input.tsx, line 122-133 (link)setPrompt('')is called on line 122 before theextraTaskParamsJSON parse. If the user's task-params JSON is invalid, the function returns early after showing the toast — but the main prompt text has already been wiped, causing silent data loss.Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (5): Last reviewed commit: "Merge branch 'main' into users/michaelch..." | Re-trigger Greptile