Skip to content

feat: Added ui to support input params for task creation#222

Merged
michael-chou359 merged 5 commits intomainfrom
users/michaelchou/task_param_dev_ui
May 7, 2026
Merged

feat: Added ui to support input params for task creation#222
michael-chou359 merged 5 commits intomainfrom
users/michaelchou/task_param_dev_ui

Conversation

@michael-chou359
Copy link
Copy Markdown
Contributor

@michael-chou359 michael-chou359 commented May 5, 2026

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
image

Clicking drops down into a json input
image

image

input is passed as additional params to task creation backend call
image

Task Params only available when task is initialized, the ui disappears with subsequent chat messages.

Greptile Summary

  • Adds a collapsible "Task Parameters" accordion above the prompt input (visible only before a task is created) that accepts free-form JSON merged into the createTask params payload.
  • The taskParams value is applied on send whenever taskParams.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 the extraTaskParams JSON 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

Filename Overview
agentex-ui/components/primary-content/prompt-input.tsx Adds task-params accordion (JSON editor) above the prompt input for new tasks; extraTaskParams is applied regardless of accordion open state, and setPrompt('') is cleared before the JSON guard causing data loss on invalid JSON.

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]
Loading

Comments Outside Diff (1)

  1. agentex-ui/components/primary-content/prompt-input.tsx, line 122-133 (link)

    P1 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.

    Prompt To Fix With AI
    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.

    Fix in Cursor Fix in Claude Code Fix in Codex

Fix All in Cursor Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
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:126-133
**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);
```

Reviews (5): Last reviewed commit: "Merge branch 'main' into users/michaelch..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@michael-chou359 michael-chou359 requested a review from a team as a code owner May 5, 2026 23:40
Comment thread agentex-ui/components/primary-content/prompt-input.tsx

return (
<div className="flex w-full max-w-3xl flex-col gap-2">
{process.env.NODE_ENV === 'development' && !taskID && (
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's allow this in all envs but hide when the chat is disabled

@michael-chou359 michael-chou359 changed the title Added ui to support input params for task creation in dev environment feat: Added ui to support input params for task creation in dev environment May 6, 2026
@michael-chou359 michael-chou359 changed the title feat: Added ui to support input params for task creation in dev environment feat: Added ui to support input params for task creation May 6, 2026
Comment on lines +181 to +200
{!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>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Fix in Cursor Fix in Claude Code Fix in Codex

@michael-chou359 michael-chou359 enabled auto-merge (squash) May 7, 2026 18:54
@michael-chou359 michael-chou359 merged commit dd25ab6 into main May 7, 2026
14 checks passed
@michael-chou359 michael-chou359 deleted the users/michaelchou/task_param_dev_ui branch May 7, 2026 18:55
Comment on lines +126 to +133
if (taskParams.trim()) {
try {
extraTaskParams = JSON.parse(taskParams);
} catch {
toast.error('Invalid Task Parameters JSON');
return;
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Suggested change
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.

Fix in Cursor Fix in Claude Code Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants