Commit dd25ab6
authored
feat: Added ui to support input params for task creation (#222)
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
<img width="1802" height="672" alt="image"
src="https://github.com/user-attachments/assets/076ce5a0-089c-458c-8752-bfae9a91e70e"
/>
Clicking drops down into a json input
<img width="1770" height="600" alt="image"
src="https://github.com/user-attachments/assets/44fc89d9-41b0-41a2-8d34-e5f2ae6fcdf4"
/>
<img width="924" height="485" alt="image"
src="https://github.com/user-attachments/assets/d0d60e63-257b-41eb-b66a-037152189f63"
/>
input is passed as additional params to task creation backend call
<img width="1678" height="438" alt="image"
src="https://github.com/user-attachments/assets/def4b132-2570-4f60-b9ba-134089da3544"
/>
Task Params only available when task is initialized, the ui disappears
with subsequent chat messages.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
- Adds a collapsible \"Task Parameters\" JSON editor above the prompt
input that only renders when no task is active (`!taskID &&
!isDisabled`), allowing users to inject extra key-value pairs into the
`createTask` API call.
- The extra params are spread before `description`/`content` so core
fields always win over user-supplied JSON.
- The feature is missing a `process.env.NODE_ENV === 'development'`
guard on both the UI panel and the parse logic, making it available in
all environments despite the stated dev-only intent.
<details><summary><h3>Confidence Score: 4/5</h3></summary>
Safe to merge with the dev-only guard added; without it, the feature
ships to production contrary to design intent.
One P1 finding: the Task Parameters panel and its extraTaskParams
injection are missing a NODE_ENV === 'development' check, exposing the
feature in production. No P0 issues present.
agentex-ui/components/primary-content/prompt-input.tsx — needs dev-only
environment guard on both the UI block and the extraTaskParams parse
path.
</details>
<h3>Important Files Changed</h3>
| Filename | Overview |
|----------|----------|
| agentex-ui/components/primary-content/prompt-input.tsx | Adds a
collapsible Task Parameters JSON editor to the prompt input for
injecting extra params on task creation, but the feature lacks a
`process.env.NODE_ENV === 'development'` guard, making it visible and
functional in all environments contrary to the stated design intent. |
</details>
<details><summary><h3>Sequence Diagram</h3></summary>
```mermaid
sequenceDiagram
participant User
participant PromptInput
participant handleSendPrompt
participant createTaskMutation
User->>PromptInput: Expand "Task Parameters" panel
User->>PromptInput: Enter JSON in DataInput (taskParams)
User->>PromptInput: Enter prompt text
User->>PromptInput: Click Send / press Enter
PromptInput->>handleSendPrompt: invoke
handleSendPrompt->>handleSendPrompt: setPrompt('') — clears main prompt
alt taskParams is non-empty
handleSendPrompt->>handleSendPrompt: JSON.parse(taskParams)
alt Invalid JSON
handleSendPrompt-->>User: toast.error('Invalid Task Parameters JSON')
note over handleSendPrompt: returns early — prompt already cleared
else Valid JSON
handleSendPrompt->>createTaskMutation: mutateAsync with extraTaskParams spread
createTaskMutation-->>handleSendPrompt: task
end
else taskParams empty
handleSendPrompt->>createTaskMutation: mutateAsync with description and content only
createTaskMutation-->>handleSendPrompt: task
end
```
</details>
<!-- greptile_failed_comments -->
<details open><summary><h3>Comments Outside Diff (1)</h3></summary>
1. `agentex-ui/components/primary-content/prompt-input.tsx`, line
122-133
([link](https://github.com/scaleapi/scale-agentex/blob/ea01ea0d70932752c423dc6a21f23833cdfb3619/agentex-ui/components/primary-content/prompt-input.tsx#L122-L133))
<a href="#"><img alt="P1"
src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=7"
align="top"></a> `setPrompt('')` is called on line 122 **before** the
`extraTaskParams` JSON 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.
<details><summary>Prompt To Fix With AI</summary>
`````markdown
This is a comment left during a code review.
Path: agentex-ui/components/primary-content/prompt-input.tsx
Line: 122-133
Comment:
`setPrompt('')` is called on line 122 **before** the `extraTaskParams`
JSON 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.
How can I resolve this? If you propose a fix, please make it concise.
`````
</details>
<a
href="https://app.greptile.com/api/ide/cursor?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20agentex-ui%2Fcomponents%2Fprimary-content%2Fprompt-input.tsx%0ALine%3A%20122-133%0A%0AComment%3A%0A%60setPrompt%28''%29%60%20is%20called%20on%20line%20122%20**before**%20the%20%60extraTaskParams%60%20JSON%20parse.%20If%20the%20user's%20task-params%20JSON%20is%20invalid%2C%20the%20function%20returns%20early%20after%20showing%20the%20toast%20%E2%80%94%20but%20the%20main%20prompt%20text%20has%20already%20been%20wiped%2C%20causing%20silent%20data%20loss.%0A%0A%60%60%60suggestion%0A%20%20%20%20if%20%28!currentTaskId%29%20%7B%0A%20%20%20%20%20%20let%20extraTaskParams%3A%20Record%3Cstring%2C%20unknown%3E%20%3D%20%7B%7D%3B%0A%20%20%20%20%20%20if%20%28process.env.NODE_ENV%20%3D%3D%3D%20'development'%20%26%26%20taskParams.trim%28%29%29%20%7B%0A%20%20%20%20%20%20%20%20try%20%7B%0A%20%20%20%20%20%20%20%20%20%20extraTaskParams%20%3D%20JSON.parse%28taskParams%29%3B%0A%20%20%20%20%20%20%20%20%7D%20catch%20%7B%0A%20%20%20%20%20%20%20%20%20%20toast.error%28'Invalid%20Task%20Parameters%20JSON'%29%3B%0A%20%20%20%20%20%20%20%20%20%20return%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%60%60%60%0A%0AHow%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20please%20make%20it%20concise.&pr=222&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursorDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=2"><img
alt="Fix in Cursor"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCursor.svg?v=2"
height="20"></picture></a> <a
href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20agentex-ui%2Fcomponents%2Fprimary-content%2Fprompt-input.tsx%0ALine%3A%20122-133%0A%0AComment%3A%0A%60setPrompt%28''%29%60%20is%20called%20on%20line%20122%20**before**%20the%20%60extraTaskParams%60%20JSON%20parse.%20If%20the%20user's%20task-params%20JSON%20is%20invalid%2C%20the%20function%20returns%20early%20after%20showing%20the%20toast%20%E2%80%94%20but%20the%20main%20prompt%20text%20has%20already%20been%20wiped%2C%20causing%20silent%20data%20loss.%0A%0A%60%60%60suggestion%0A%20%20%20%20if%20%28!currentTaskId%29%20%7B%0A%20%20%20%20%20%20let%20extraTaskParams%3A%20Record%3Cstring%2C%20unknown%3E%20%3D%20%7B%7D%3B%0A%20%20%20%20%20%20if%20%28process.env.NODE_ENV%20%3D%3D%3D%20'development'%20%26%26%20taskParams.trim%28%29%29%20%7B%0A%20%20%20%20%20%20%20%20try%20%7B%0A%20%20%20%20%20%20%20%20%20%20extraTaskParams%20%3D%20JSON.parse%28taskParams%29%3B%0A%20%20%20%20%20%20%20%20%7D%20catch%20%7B%0A%20%20%20%20%20%20%20%20%20%20toast.error%28'Invalid%20Task%20Parameters%20JSON'%29%3B%0A%20%20%20%20%20%20%20%20%20%20return%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%60%60%60%0A%0AHow%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20please%20make%20it%20concise.&repo=scaleapi%2Fscale-agentex&pr=222&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=2"><img
alt="Fix in Claude Code"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=2"
height="20"></picture></a> <a
href="https://chatgpt.com/codex/deeplink?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22scaleapi%2Fscale-agentex%22%20on%20the%20existing%20branch%20%22users%2Fmichaelchou%2Ftask_param_dev_ui%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22users%2Fmichaelchou%2Ftask_param_dev_ui%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20agentex-ui%2Fcomponents%2Fprimary-content%2Fprompt-input.tsx%0ALine%3A%20122-133%0A%0AComment%3A%0A%60setPrompt%28''%29%60%20is%20called%20on%20line%20122%20**before**%20the%20%60extraTaskParams%60%20JSON%20parse.%20If%20the%20user's%20task-params%20JSON%20is%20invalid%2C%20the%20function%20returns%20early%20after%20showing%20the%20toast%20%E2%80%94%20but%20the%20main%20prompt%20text%20has%20already%20been%20wiped%2C%20causing%20silent%20data%20loss.%0A%0A%60%60%60suggestion%0A%20%20%20%20if%20%28!currentTaskId%29%20%7B%0A%20%20%20%20%20%20let%20extraTaskParams%3A%20Record%3Cstring%2C%20unknown%3E%20%3D%20%7B%7D%3B%0A%20%20%20%20%20%20if%20%28process.env.NODE_ENV%20%3D%3D%3D%20'development'%20%26%26%20taskParams.trim%28%29%29%20%7B%0A%20%20%20%20%20%20%20%20try%20%7B%0A%20%20%20%20%20%20%20%20%20%20extraTaskParams%20%3D%20JSON.parse%28taskParams%29%3B%0A%20%20%20%20%20%20%20%20%7D%20catch%20%7B%0A%20%20%20%20%20%20%20%20%20%20toast.error%28'Invalid%20Task%20Parameters%20JSON'%29%3B%0A%20%20%20%20%20%20%20%20%20%20return%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%60%60%60%0A%0AHow%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20please%20make%20it%20concise."><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodexDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=2"><img
alt="Fix in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=2"
height="20"></picture></a>
</details>
<!-- /greptile_failed_comments -->
<a
href="https://app.greptile.com/api/ide/cursor?prompt=Fix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Aagentex-ui%2Fcomponents%2Fprimary-content%2Fprompt-input.tsx%3A181-200%0A**Missing%20dev-only%20guard%20on%20Task%20Parameters%20UI**%0A%0AThe%20PR%20description%20says%20%22Also%20only%20available%20in%20dev%20environment%2C%22%20but%20neither%20the%20UI%20panel%20%28line%20181%29%20nor%20the%20%60extraTaskParams%60%20parse%20logic%20%28line%20126%29%20has%20a%20%60process.env.NODE_ENV%20%3D%3D%3D%20'development'%60%20check.%20As-is%2C%20the%20Task%20Parameters%20accordion%20and%20its%20ability%20to%20inject%20arbitrary%20JSON%20into%20%60createTask%60%20are%20fully%20live%20in%20production%2C%20directly%20contradicting%20the%20stated%20design%20constraint.%0A%0A&pr=222&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCursorDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCursor.svg?v=2"><img
alt="Fix All in Cursor"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCursor.svg?v=2"
height="20"></picture></a> <a
href="https://app.greptile.com/ide/claude-code?prompt=Fix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Aagentex-ui%2Fcomponents%2Fprimary-content%2Fprompt-input.tsx%3A181-200%0A**Missing%20dev-only%20guard%20on%20Task%20Parameters%20UI**%0A%0AThe%20PR%20description%20says%20%22Also%20only%20available%20in%20dev%20environment%2C%22%20but%20neither%20the%20UI%20panel%20%28line%20181%29%20nor%20the%20%60extraTaskParams%60%20parse%20logic%20%28line%20126%29%20has%20a%20%60process.env.NODE_ENV%20%3D%3D%3D%20'development'%60%20check.%20As-is%2C%20the%20Task%20Parameters%20accordion%20and%20its%20ability%20to%20inject%20arbitrary%20JSON%20into%20%60createTask%60%20are%20fully%20live%20in%20production%2C%20directly%20contradicting%20the%20stated%20design%20constraint.%0A%0A&repo=scaleapi%2Fscale-agentex&pr=222&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaudeDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=2"><img
alt="Fix All in Claude Code"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=2"
height="20"></picture></a> <a
href="https://chatgpt.com/codex/deeplink?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22scaleapi%2Fscale-agentex%22%20on%20the%20existing%20branch%20%22users%2Fmichaelchou%2Ftask_param_dev_ui%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22users%2Fmichaelchou%2Ftask_param_dev_ui%22.%0A%0AFix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Aagentex-ui%2Fcomponents%2Fprimary-content%2Fprompt-input.tsx%3A181-200%0A**Missing%20dev-only%20guard%20on%20Task%20Parameters%20UI**%0A%0AThe%20PR%20description%20says%20%22Also%20only%20available%20in%20dev%20environment%2C%22%20but%20neither%20the%20UI%20panel%20%28line%20181%29%20nor%20the%20%60extraTaskParams%60%20parse%20logic%20%28line%20126%29%20has%20a%20%60process.env.NODE_ENV%20%3D%3D%3D%20'development'%60%20check.%20As-is%2C%20the%20Task%20Parameters%20accordion%20and%20its%20ability%20to%20inject%20arbitrary%20JSON%20into%20%60createTask%60%20are%20fully%20live%20in%20production%2C%20directly%20contradicting%20the%20stated%20design%20constraint.%0A%0A"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodexDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=2"><img
alt="Fix All in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=2"
height="20"></picture></a>
<details><summary>Prompt To Fix All With AI</summary>
`````markdown
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
agentex-ui/components/primary-content/prompt-input.tsx:181-200
**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.
`````
</details>
<sub>Reviews (4): Last reviewed commit: ["added ui to support input
params for
tas..."](b6739c5)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=30927928)</sub>
> Greptile also left **1 inline comment** on this PR.
<!-- /greptile_comment -->1 parent f6d091f commit dd25ab6
1 file changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
122 | 135 | | |
123 | 136 | | |
124 | 137 | | |
| 138 | + | |
125 | 139 | | |
126 | 140 | | |
127 | 141 | | |
| |||
159 | 173 | | |
160 | 174 | | |
161 | 175 | | |
| 176 | + | |
162 | 177 | | |
163 | 178 | | |
164 | 179 | | |
165 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
166 | 202 | | |
167 | 203 | | |
168 | 204 | | |
| |||
0 commit comments