Skip to content

Add create_task; let Stage 1 finish and name the procedure (refs #3784) - #3838

Merged
malibio merged 4 commits into
mainfrom
issue-3784-create-task-tool
Oct 16, 2026
Merged

malibio merged 4 commits into
mainfrom
issue-3784-create-task-tool

Conversation

@malibio

@malibio malibio commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Refs #3784 (does not close it: the bug-task scenarios still fail on E4B).

What changes

  • create_task tool: one call writes a task or issue with its brief paragraphs, - [ ] checklist and tasks link from the project; validates the project first and rolls back on failure. Mirrors create_question_task. Replaces the three-step task-create-node/-brief/-project-link rules with task-create-whole; Creating a Task and Diagnosing a Bug procedures updated.
  • Stage 1 can finish: STAGE1_MAX_TOKENS 256 → 1024. A model that reasons before calling a tool spent all 256 on reasoning in 12 of 16 calls, so no routing tool was called and the turn fell back to the raw message.
  • Stage 1 can name the procedure: route_query takes an optional capability; when it names a Procedure-role skill, that procedure governs the turn alone. Unknown or non-procedure names are ignored.

Measured (16 scenarios in scripts/eval/fixtures/tasks.ts, held-out phrasings included)

Haiku 5.5, 3 reps: old cap 8.0 → create_task + cap 1024 11.3; adding naming 11.3 (neutral).
E4B (the shipping model), 3 reps: naming 7.0 vs 5.7 without it (4 reps each pooled: 7.0 vs 5.5); baseline 6/16. Small, consistent, not proof. Bug-task scenarios are 0/3 on E4B in every arm.

Test plan

  • nodespace-agent 1191 tests, clippy -D warnings, fmt
  • New create_task integration tests (5)
  • Stage 1 goldens regenerated

🤖 Generated with Claude Code

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: APPROVE (net positive), with two test-coverage gaps and one parsing bug worth fixing before merge.

The change is cohesive. create_task mirrors create_question_task in every exhaustive match (Tool::ALL, count walk, ordinal assert, id, name, write semantics, written-node, schema-scoped in decisions.rs, the skill-pipeline CLI-exemption list, daemon write summary). It validates input and resolves the project before the first write. The seeded rule swap is consistent: no stale task-create-node/-brief/-project-link references remain, PROCEDURE_RULES is updated, and SKILL.md is 13,997 chars (cap 20,000). No node-type, field or relationship is added, so node-types.md is unaffected. No issue numbers, lint suppression or compat code in the diff.

Findings

Critical Issues

None.

Suggested Improvements

  • packages/agent/tests/it/create_task.rs: The rollback path has no test. Rollback is the headline atomicity claim of exec_create_task (the doc comment says the call "leaves the graph as it found it"), and the only tests cover the happy path and pre-write refusals. A failure injected after the task is created (a brief/checklist child write, or the tasks edge) should assert that no task, text or checkbox node remains and that the error says "Nothing was created." Worth also covering the second branch (delete itself fails, so the message names the orphan URI), or noting why it cannot be reached. Untested compensation logic is the code most likely to rot.
  • packages/agent/src/local_agent/agent_loop.rs (~6368-6410) and routing.rs named_capability: The new naming path has no tests. Edge cases that deserve a test, since the name is explicitly "a claim": unknown name leaves ranked candidates unchanged; a name matching a non-Procedure skill is ignored; name differing in case/whitespace; name not in merged hits the extra retrieve_skills(&name, 8) fallback; a pinned skill still joins the named procedure; route_query without capability, and capability: ""/null/non-string (the last makes the whole RouteQueryParams parse fail, so a stray non-string capability would drop the query too; consider tolerating it, since deny_unknown_fields is on that struct and the model is the author). named_capability is a pure function and is trivially unit-testable in routing.rs.
  • packages/agent/src/local_agent/tools.rs, checklist normalisation (trim_start_matches(['-', '*', ' '])): this strips any leading -/*, so a condition beginning with emphasis (**Exports** keep order) becomes Exports** keep order, and -1 is rejected loses its sign. [X] (uppercase) is also not handled, and the [ ]/[x] strips run in sequence without re-trimming, so [ ] [x] foo is only half-cleaned. Strip a single list marker followed by whitespace, then one optional [ ]/[x]/[X] followed by whitespace, instead of char-set trimming. Add the cases to a_brief_and_checklist_sent_as_text_are_split_and_unmarked.
  • agent_loop.rs named-procedure lookup: the fallback retrieve_skills(...).await.ok() swallows the error silently, whereas the sibling retrieval loop logs tracing::warn! on failure. Log it so a misnamed/failed lookup is diagnosable from a trace. Also, procedure.score.max(top_score).max(1.0) forces the score gate open; the comment explains why, but the 1.0 literal reads as a magic number. Name the gate threshold it is meant to clear (or reuse the constant from select_candidates).
  • Behavioural note, not a blocker: a named procedure replaces the whole candidate set with one skill, so the "read-only skill alongside a write skill" behaviour of select_candidates does not apply. This is fine for Creating a Task (its tool list includes search_nodes), but for any future Procedure whose Stage 2 turn needs a skill it does not carry, the model loses it with no fallback. Worth a sentence in the comment so the next reader knows it is deliberate. The measured effect is "neutral on Haiku, +1.3 on E4B over 3 reps"; the summary rightly calls that weak, so this is a behaviour change riding on thin evidence. The gain from the token cap and create_task (8.0 -> 11.3) is the real win, and the naming path is the part to keep an eye on.
  • exec_create_task is not transactional across the multiple node_ops calls, so a UI/event consumer can briefly see a task with a partial brief or no checklist (it would appear in "Needs shaping"). Acceptable given compensation, but say so in the doc comment rather than "one write".

Nitpicks

  • Nit: create_task.rs a_project_that_does_not_exist_or_is_not_one...: the let ... else { if matches!(InvalidArguments) { continue } panic! } accepts either error kind, so the test cannot say which refusal each input produces. Assert the expected variant per input (table of (project, expected)).
  • Nit: tools.rs CreateTaskParams accepts many aliases (content, name, description, paragraphs, checklist_items, checkboxes, acceptance_criteria, type). Each is a chance for a silent mis-mapping and widens the schema surface; keep only the ones observed from real model output.
  • Nit: ok_result reports "created": true alongside the id; the id alone already conveys it.
  • Nit: the 1024 STAGE1_MAX_TOKENS comment cites "three calls in four" for a hosted model; fine as rationale, but it will go stale. Prefer the mechanism ("reasoning consumes the ceiling before the tool call") over the one measurement.

@malibio

malibio commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

Review addressed

Fixed

  • Checklist cleaning: one list marker and one checkbox ([ ], [x], [X]) are removed; **bold** and -1 … stay. Unit test added.
  • capability of any JSON type parses, so a malformed name never drops the query; named_capability tests added.
  • Failed capability lookup is logged; the score floor is a named constant; comments state why a named procedure governs alone and that create_task is compensated, not transactional; the Stage 1 cap comment states the mechanism, not one measurement.
  • Bad-project test asserts the expected error per input.

Skipped

  • Rollback test: no way to fail a child write in these services without a mock the crate doesn't have. Revisit if one is added.
  • Agent-loop test of the naming lookup: needs a full engine fixture; the pure parts are covered. Naming stays under watch (E4B +1.3, Haiku neutral).
  • Trimming CreateTaskParams aliases and the created flag: harmless.

1194 agent tests, clippy -D warnings, fmt pass.

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: Small, local changes (a string helper with a unit test, a more tolerant parse, a log line, a constant, comments). No new behavior.

malibio and others added 4 commits October 16, 2026 14:07
… project link (refs #3784)

The Creating a Task procedure was a task, a text node per brief paragraph, a
checkbox per item and a project link: seven or more calls the model had to
chain, and a model that stopped after the task left it with no brief. The
tool takes the title, the brief paragraphs, the checklist items and the
project (by id or exact title), refuses before writing when the project or
either list is missing, and removes the task and everything under it when a
later write fails. Creating a Task and Diagnosing a Bug end in it, and the
confusion matrix gains the eval scenarios' prompts.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…3784)

Stage 1 describes the capability a request needs and retrieval embeds that
description, so a request heavy with domain nouns ranks a neighbour that
shares them above the procedure whose verb it asks for. route_query takes an
optional capability, the exact name of a listed one; when it names a
procedure that procedure governs the turn alone, with its own text and tools.
A name that matches no procedure changes nothing.

Stage 1's token ceiling goes from 256 to 1024: a model that reasons before
calling a tool spent all 256 on reasoning in three calls of four, so no
routing tool was called and the turn went on with the raw message.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…refs #3784)

- Checklist items lose one list marker and one checkbox, not emphasis or a
  leading sign; unit test covers the cases the reviewer named.
- A non-string capability no longer drops the whole route_query; tests for
  named_capability.
- A failed capability lookup is logged; the score floor is a named constant;
  comments say why a named procedure governs alone and that create_task is
  compensated, not transactional; the Stage 1 cap comment states the
  mechanism rather than one measurement.
- Bad-project test asserts the expected error per input.

Skipped: a rollback-failure test (the services expose no way to fail a child
write without a mock the crate does not have; revisit if one is added), the
agent-loop naming-path test (needs a full engine fixture; the pure parts are
covered), trimming CreateTaskParams aliases and the redundant created flag
(harmless, nothing measured).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.

1 participant