Skip to content

Shape a standalone task at creation; a question is a task that blocks (closes #3722) - #3759

Merged
malibio merged 1 commit into
mainfrom
issue-3722-standalone-task-waiting
Oct 12, 2026
Merged

malibio merged 1 commit into
mainfrom
issue-3722-standalone-task-waiting

Conversation

@malibio

@malibio malibio commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Shapes a standalone task when it is created and asks a question that stops work as a task that blocks it (ADR-099). task is unchanged: no new status, relationship or Play.

  • Current-person anchor in the query model: a relationship filter takes anchor: "current_person" in place of node_id, resolved to the local person each time the query runs in the query service's SQL compilation. Refused beside a node_id, on a non-relationship filter and in a Play selector; stored as written; works inside a related filter and negated. Wire type FilterAnchor, generated TypeScript committed, CLI help and cli.md updated.
  • Queues: "Needs shaping" (open tasks with no checkbox child) and "Waiting on you" (open tasks assigned to the reader that block another task).
  • Skills: "Creating a Task" (adapted from mattpocock/skills triage, MIT, attribution kept; attached to Needs shaping) and "Answering a Question" (attached to Waiting on you). "Implementing a Task" sends a checklist-less or question task to them.
  • Retrieval: the skill confusion matrix was run live on the locked model. The first run showed both new use_for texts taking existing requests; they were tightened and rerun. Ranks of existing requests move by at most two places and none loses its skill. All 40 live stability guards pass.

Node type sequence: no type, field, relationship or status changes, so no node-types.md sheet change. Query model change documented in components/query-node.md (already on docs main).

Docs

nodespace-docs: ADR-092 §7 (task as the unit of work: parent task, task with no project, assignee) and §8 (queues, skills); components/seeded-nodes.md. Pushed with the merge.

Test plan

  • bun run test:changed (frontend, scripts, skill, browser, types, node-types, Rust workspace)
  • Anchor tests: resolves to the local person and follows the owner, beside and inside a related filter, negated, refused with node_id, selector rejection, stored as written
  • Queue tests: question task stops its blocked task, finishing it releases it unchanged, a cancelled question no longer blocks, Waiting on you is per reader
  • Tool-driven run of both procedures; prompt goldens regenerated and reviewed
  • Live confusion matrix and live retrieval-stability guards
  • Agent evals on the touched scenarios (not run; fixture predates the entity tier)

Known behaviour to review

  • A question task has no checklist, so it also appears in Needs shaping with Creating a Task attached beside Answering a Question.
  • Needs shaping also lists a task that only groups sub-tasks; shaping it means deciding it is a grouping (written in ADR-092 §7).
  • Creating a Task has no not_for: a guard must be measured live and none was needed by the matrix.
  • The local agent's search_nodes filter schema does not list anchor (it already omits relative_date and negate).

Closes #3722

🤖 Generated with Claude Code

@malibio

malibio commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Pragmatic Code Review: PR #3759 (issue #3722)

Summary

A clean, well-scoped implementation of the revised #3722: the current_person anchor is a proper query-model addition (wire type, SQL compilation, selector refusal, generated TS, CLI/skill reference), task is untouched, two seeded queues and two skills are added, and ADR-092 / seeded-nodes.md / query-node.md describe what the code does. Net positive, no blockers. The findings below are one real design gap (question tasks land in "Needs shaping"), one retrieval-quality concern, one under-specified rule, and small robustness points.

Requirements check (every acceptance criterion):

  • Creation skill given by skill match, brief + checklist + project, ready on creation: met (skill + creating_a_task_and_answering_a_question_can_be_followed_through_the_tools).
  • Every shipped skill attached to a queue: met (attached_to + workflow_seeds assertion that nothing else is attached).
  • Already-built / declined check, bug reproduction, spec-or-not question: met in skill text (STEPs 1 to 5).
  • "Needs shaping" + implementing skill shapes first: met (query, test, STEP 1 addition).
  • Question task leaves stopped task's status/assignee, drops it from Ready: met (a_question_task_stops_the_task_it_blocks_and_waits_on_you).
  • Anchor: assignee, inside related, refused with node_id, refused in a selector, stored as written, documented, tested: met (query_service_test, validation.rs, query.rs tests, query-node.md).
  • "Waiting on you" same seed everywhere: met (anchor in the seed; no ids).
  • Complete -> ready again; cancelled pinned by test: met (a_cancelled_question_no_longer_blocks).
  • task unchanged: met (no schema / status / Play changes in the diff).
  • Agent asks, does not answer: met (Answering STEP 2, Creating's "ask them directly and wait").
  • Declined request leaves a decision: met (WHEN A REQUEST IS DECLINED).
  • Unit-of-work written down: met (ADR-092 §7 addendum).
  • Seed tests + prompt snapshot + goldens: present. Agent evals on the touched scenarios are not visible in the diff (see Suggestions).

AGENTS.md conformance: no literal node_type comparison (the SQL goes through is_a_sql(..., CoreNodeType::Person)), no lifecycle_status read, no compat/migration code, no lint suppression, no console use.

Security: current_person_seed() interpolates only DATABASE_SETTINGS_NODE_ID (a crate constant) and the output of is_a_sql over a fixed enum. The caller-supplied node_id path still goes through built.bind. Nothing user-controlled reaches the format!. No concern.

Performance: path_reaches_condition evaluates the seed once per statement (the walk runs backward from the seed), so the COALESCE subquery is not per-row. Fine.


Findings

🔴 Critical

None.

🟡 Important

  1. A question task created per the skill lands in "Needs shaping" and is never tested there.
    📁 packages/agent/src/seeds/rules/agent/task-question-create.md, packages/agent/src/seeds/rules/skill-md/task-question-create.md, packages/core/src/services/query_service/core_queries.rs:245 (needs_shaping_filters), packages/agent/tests/it/workflow_seeds.rs (end-to-end test)
    The question-creation rule makes a bare task with the question as content and no checkbox child. By this PR's own definition ("open, no checkbox child") it is listed in Needs shaping, whose attached procedure is Creating a Task. The user's "Needs shaping" queue fills with questions that are not meant to be shaped, and an agent working that queue will try to give a question a checklist. The tests hide this: core_queries_test builds questions with ready_task (which has a checkbox), and the workflow_seeds test creates the question with no checkbox but never re-queries "Needs shaping" afterwards. Either exclude tasks that block another task from needs_shaping_filters (a negated related/blocks filter, the idiom the file already uses), or have the rule write one checkbox so the question is an ordinary task. Whichever is chosen, add the assertion to the end-to-end test. Principle: a fixture shaped differently from what the production path creates pins nothing about that path.

  2. "Answering a Question" has become a retrieval magnet.
    📁 packages/agent/src/skill_pipeline.rs (use_for of Answering a Question), packages/agent/tests/golden/skill_retrieval/current.tsv
    In the regenerated golden it is the leader or closest competitor on roughly 21 rows of unrelated requests ("start keeping tabs on who owes me money" 0.918, "add a task to call the roofer on Friday", "link this invoice to the Acme account", "mark the invoice as paid", ...). Two owners lose rank 1 (venue tracker 1 -> 2, "mark the invoice as paid" 1 -> 2), and the margin for Recording a Decision's "Start keeping the calls we make..." request goes from -0.013 to -0.033. Its text ("Answer the questions waiting on you ... Use when the user asks what is waiting on them") is generic embedding bait. Tighten it to the concrete shape of a request ("what is waiting on me", "which questions need my answer") or give it a not_for, then re-record. It is a queue procedure that already reaches an agent through the queue (ADR-094 §3), so the match path needs it far less than Creating a Task does.

  3. The question rule does not say how to find the assignee or the project, though the skill requires both.
    📁 packages/agent/src/seeds/skills/creating-a-task.md ("WHEN YOU CANNOT GO ON"), rules/agent/task-question-create.md, rules/skill-md/task-question-create.md
    The skill says "assigned to the person who owes the answer (the task's creator when nobody is named), in the same project", but both rule forms only create the node, link from_id the person's id, and add the blocks edge. There is no instruction to look a person up (or how to learn who created the stopped task), and no project link: STEP 8's task-create-project-link is not part of this branch. A model will guess the person id or skip the project link, and ADR-099 §1's same-project requirement goes unenforced. Add the lookup (search_nodes with node_type: "person" / nodespace search --type person; read the stopped task's project path and reuse it) to both forms, and say what to do when the creator cannot be determined.

  4. The anchor seed duplicates get_local_person and the two can drift.
    📁 packages/core/src/services/query_service/mod.rs:352 (current_person_seed), packages/core/src/services/node_service/mod.rs:1894
    The SQL re-implements the has_role -> earliest created -> first person fallback. They agree by reading, but nothing asserts they pick the same row when there is no has_role edge, or with two persons; test_current_person_anchor_follows_the_owner covers only the has_role path. Add one test for the no-edge fallback with two persons that asserts the anchor's result equals get_local_person(). One fact with two implementations must be pinned together (DRY; assert the agreement, not a fixed id).

🟢 Suggestions

  1. Client-side filter evaluation misreads an anchored mentions filter.
    📁 packages/desktop-app/src/lib/components/query/query-node-model.ts:304-312
    filterHolds compares node.mentions to filter.node_id, which is undefined for an anchored filter. Un-negated it declines correctly, but with negate: true it computes holds === false, negates to true, and shows a node whose answer is unknown. Return null (unverifiable) when filter.anchor is set, with a one-line test. No seed uses the form today, but query-node.md promises unverifiable filters decline.

  2. Creating a Task's applies_to is broad.
    📁 packages/agent/src/skill_pipeline.rs:875
    It lists Task, Issue, Checkbox, Text and Decision. Skills that applies_to a type come back in node context for any node of that type, so Creating a Task rides along on every task/issue/checkbox/text read, including during Implementing a Task. The skill match plus the queue attachment already cover "found when about to record work"; consider [Task, Issue], or confirm in the prompt snapshot that the extra context is deliberate.

  3. Agent evals on the touched scenarios are not in the diff. The acceptance criterion names them. Please note the result (or that none apply) in the PR.

  4. Small test gaps in the anchor. No test for a database with no person node (the seed is NULL and IN (NULL) matches nothing, which is correct but unpinned).

Nitpicks

  • Nit: core_queries.rs waiting_on_you_filters uses exists status on the blocked task as a no-op "is a task" check; it reads like a status filter that was forgotten. A word in the comment would help.
  • Nit: seeded-nodes.md and ADR-092 describe Needs shaping as "typed into the app by hand, with no agent involved" while the queue also lists grouping parents and (until finding 1 is fixed) question tasks. Adjust the sentence to match whichever fix is chosen.
  • Nit: implementing-a-task.md refers to Creating a Task "from its STEP 4" by number; a renumbering silently breaks it. Name the step (ASK WHEN THE REQUEST IS UNCLEAR) instead.
  • Nit: the current_person_seed doc comment restates get_local_person's fallback in prose; point one at the other.

Docs accuracy

ADR-099, components/query-node.md#the-current-person, ADR-092 (§7 unit-of-work addendum, §8 queues and skills) and components/seeded-nodes.md (eight queries, ten procedures) match the code, with the wording nit above. The node-type sequence is not triggered (no type, field or relationship change). Generated TS (filter-anchor.ts, query-filter.ts, index.ts) matches the Rust type.

Skill/rule text quality

Both reader forms agree for all seven new rules (agent tool name vs CLI command, node_version vs version). Procedures ask one question at a time, never answer on the user's behalf, and keep the stopped task's status. The gaps are findings 1 and 3.

Recommendation: COMMENT. Net positive and mergeable once findings 1 and 3 are addressed (finding 2 should be fixed or consciously accepted); the rest are optional.

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

Automated pragmatic-code-review: COMMENT (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.

@malibio

malibio commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Review addressed

Addressed

  • 🟡 1. Question tasks in Needs shaping: the queue now leaves out a task that blocks another (a question is answered from Waiting on you, not shaped). Tested at the query level and through the tools, where the question's skill is now exactly Answering a Question. The docs wording is corrected. Trade-off: a dependency blocker with no checklist is also not listed there.
  • 🟡 3. The question rule now finds the person (the stopped task's creator when nobody is named) and links the project, in both reader forms.
  • 🟡 4. A test pins the anchor to get_local_person() with no has_role edge and two people.
  • 🟡 2. Answering a Question's use_for narrowed; its footprint in the matrix fell from 30 to 25 rows, current.tsv re-recorded, all 40 live guards pass.
  • 🟢 5. An anchored relationship filter is answered by the backend, not the client.
  • Nits: comment on the nested status check, step named instead of numbered, docs wording.

Skipped

  • 🟢 6. Narrowing Creating a Task's applies_to: it is the set of types a routed turn is held to, and the procedure writes checkboxes, text and decisions. Revisit if retrieval shows it riding along on task reads.
  • 🟢 7. Agent evals: the fixture predates the entity tier; the live confusion matrix and stability guards were run instead.
  • 🟢 8. No-person-node test: the seed is NULL by construction and a person is always seeded.

bun run test:changed passes.

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: The changes are one added filter condition with a test, rule text completing steps the skill already required, a use_for narrowing measured live, and a one-line client guard. No new functionality or design change.

@malibio
malibio force-pushed the issue-3722-standalone-task-waiting branch from f731a36 to 2927726 Compare October 12, 2026 09:46
@malibio

malibio commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Merge queue: #3759 was taken out of the queue — the merge gate failed on it, on top of main. Reproduce by merging or rebasing origin/main and running bun run test:changed, fix, push, and re-run bun run merge 3759.

✓ check-node-type-literals (ADR-086 chain-aware type rules) 0s
▶ check-lifecycle-reads (ADR-087 one participation check) (timeout 5m)
  ✓ check-lifecycle-reads (ADR-087 one participation check) 0s
  incremental cache: removed 103 directories (13.1 GiB); 116 directories kept (7.8 GiB)
  build artifacts (deps/): 22.2 GiB, over the 20 GiB budget; emptied, so this run rebuilds them
▶ skill installer script (tsc) (timeout 5m)
  ✓ skill installer script (tsc) 0s
▶ types:check (generated TypeScript drift) (timeout 15m)
▶ test (frontend, Happy-DOM) (timeout 15m)

$ bun run scripts/gen-types.ts --check
sccache: error: Server startup failed: File exists (os error 17)
Run with SCCACHE_LOG=debug SCCACHE_NO_DAEMON=1 to get more information
sccache: error: Server startup failed: File exists (os error 17)
sccache: error: Server startup failed: File exists (os error 17)
sccache: error: Server startup failed: File exists (os error 17)
error: could not compile `stable_deref_trait` (lib)
Caused by:
  process didn't exit successfully: `/Users/malibio/nodespace/nodespace-core/.tools/bin/sccache /Users/malibio/.rustup/toolchains/1.97.0-aarch64-apple-darwin/bin/rustc --crate-name stable_deref_trait --edition=2015 /Users/malibio/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/stable_deref_trait-1.2.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("alloc", "default", "std"))' -C metadata=0356af563c60134b -C extra-filename=-029d2e4c0cdd2d05 --out-dir /Users/malibio/nodespace/nodespace-core/.claude/worktrees/_gate/target/debug/deps -C strip=debuginfo -L dependency=/Users/malibio/nodespace/nodespace-core/.claude/worktrees/_gate/target/debug/deps --cap-lints allow` (exit status: 2)
Run with SCCACHE_LOG=debug SCCACHE_NO_DAEMON=1 to get more information
Run with SCCACHE_LOG=debug SCCACHE_NO_DAEMON=1 to get more information
Run with SCCACHE_LOG=debug SCCACHE_NO_DAEMON=1 to get more information
error: could not compile `unicode-ident` (lib)
Caused by:
  process didn't exit successfully: `/Users/malibio/nodespace/nodespace-core/.tools/bin/sccache /Users/malibio/.rustup/toolchains/1.97.0-aarch64-apple-darwin/bin/rustc --crate-name unicode_ident --edition=2021 /Users/malibio/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/unicode-ident-1.0.24/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=d5f7d386311a81f0 -C extra-filename=-b11ec7f596f12d33 --out-dir /Users/malibio/nodespace/nodespace-core/.claude/worktrees/_gate/target/debug/deps -C strip=debuginfo -L dependency=/Users/malibio/nodespace/nodespace-core/.claude/worktrees/_gate/target/debug/deps --cap-lints allow` (exit status: 2)
error: could not compile `writeable` (lib)
Caused by:
  process didn't exit successfully: `/Users/malibio/nodespace/nodespace-core/.tools/bin/sccache /Users/malibio/.rustup/toolchains/1.97.0-aarch64-apple-darwin/bin/rustc --crate-name writeable --edition=2021 /Users/malibio/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/writeable-0.6.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no '--warn=clippy::wildcard_dependencies' '--warn=clippy::useless_transmute' --warn=unused_qualifications --warn=unused_macro_rules --warn=unused_lifetimes '--warn=clippy::unnecessary-wraps' --warn=unexpected_cfgs '--deny=clippy::trivially_copy_pass_by_ref' --deny=trivial_numeric_casts '--warn=clippy::transmutes_expressible_as_ptr_casts' '--warn=clippy::transmute_undefined_repr' '--warn=clippy::transmute_ptr_to_ref' '--warn=clippy::transmute_ptr_to_ptr' '--warn=clippy::transmute_int_to_non_zero' '--warn=clippy::transmute_int_to_bool' '--warn=clippy::transmute_bytes_to_str' '--warn=clippy::todo' '--warn=clippy::same_functions_in_if_condition' '--warn=clippy::or-fun-call' '--warn=clippy::negative_feature_names' '--warn=clippy::missing_transmute_annotations' '--warn=clippy::missing_fields_in_debug' --deny=missing_debug_implementations '--warn=clippy::mismatching_type_param_order' '--warn=clippy::large_stack_arrays' '--warn=clippy::infinite_loop' '--warn=clippy::fn_to_numeric_cast_any' '--deny=clippy::exhaustive_structs' '--deny=clippy::exhaustive_enums' '--warn=clippy::doc_markdown' '--warn=clippy::debug_assert_with_mut_call' '--warn=clippy::dbg_macro' '--warn=clippy::crosspointer_transmute' '--warn=clippy::collection_is_never_read' '--warn=clippy::branches-sharing-code' '--warn=clippy::alloc-instead-of-core' --check-cfg 'cfg(icu4c_enable_renaming)' --check-cfg 'cfg(needs_alloc_error_handler)' --check-cfg 'cfg(icu4x_run_size_tests)' --check-cfg 'cfg(icu4x_unstable_fast_trie_only)' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("alloc", "default", "either"))' -C metadata=bbe727303eac0360 -C extra-filename=-ae3cb25a27933418 --out-dir /Users/malibio/nodespace/nodespace-core/.claude/worktrees/_gate/target/debug/deps -C strip=debuginfo -L dependency=/Users/malibio/nodespace/nodespace-core/.claude/worktrees/_gate/target/debug/deps --cap-lints allow` (exit status: 2)
error: could not compile `litemap` (lib)
Caused by:
  process didn't exit successfully: `/Users/malibio/nodespace/nodespace-core/.tools/bin/sccache /Users/malibio/.rustup/toolchains/1.97.0-aarch64-apple-darwin/bin/rustc --crate-name litemap --edition=2021 /Users/malibio/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/litemap-0.8.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no '--warn=clippy::wildcard_dependencies' '--warn=clippy::useless_transmute' --warn=unused_qualifications --warn=unused_macro_rules --warn=unused_lifetimes '--warn=clippy::unnecessary-wraps' --warn=unexpected_cfgs '--deny=clippy::trivially_copy_pass_by_ref' --deny=trivial_numeric_casts '--warn=clippy::transmutes_expressible_as_ptr_casts' '--warn=clippy::transmute_undefined_repr' '--warn=clippy::transmute_ptr_to_ref' '--warn=clippy::transmute_ptr_to_ptr' '--warn=clippy::transmute_int_to_non_zero' '--warn=clippy::transmute_int_to_bool' '--warn=clippy::transmute_bytes_to_str' '--warn=clippy::todo' '--warn=clippy::same_functions_in_if_condition' '--warn=clippy::or-fun-call' '--warn=clippy::negative_feature_names' '--warn=clippy::missing_transmute_annotations' '--warn=clippy::missing_fields_in_debug' --deny=missing_debug_implementations '--warn=clippy::mismatching_type_param_order' '--warn=clippy::large_stack_arrays' '--warn=clippy::infinite_loop' '--warn=clippy::fn_to_numeric_cast_any' '--deny=clippy::exhaustive_structs' '--deny=clippy::exhaustive_enums' '--warn=clippy::doc_markdown' '--warn=clippy::debug_assert_with_mut_call' '--warn=clippy::dbg_macro' '--warn=clippy::crosspointer_transmute' '--warn=clippy::collection_is_never_read' '--warn=clippy::branches-sharing-code' '--warn=clippy::alloc-instead-of-core' --check-cfg 'cfg(icu4c_enable_renaming)' --check-cfg 'cfg(needs_alloc_error_handler)' --check-cfg 'cfg(icu4x_run_size_tests)' --check-cfg 'cfg(icu4x_unstable_fast_trie_only)' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("alloc", "databake", "default", "serde", "testing", "yoke"))' -C metadata=1b335867411cae02 -C extra-filename=-4c0e8bd84cfb866b --out-dir /Users/malibio/nodespace/nodespace-core/.claude/worktrees/_gate/target/debug/deps -C strip=debuginfo -L dependency=/Users/malibio/nodespace/nodespace-core/.claude/worktrees/_gate/target/debug/deps --cap-lints allow` (exit status: 2)
✗ cargo run -q … failed (exit 101)
error: script "types:check" exited with code 1
[stage exited with code 1]

  full output: /var/folders/yj/_2dcl_l16cl6dr1bp7h1j6hw0000gn/T/nodespace-gate-logs/_gate-merge-2026-10-12T09-47-08-225Z/types-check-generated-typescript-drift.log

✗ types:check (generated TypeScript drift) failed — merge blocked.
  Fix the failure, push, and re-run: bun run merge <PR#>

… blocks (closes #3722)

Adds the current-person anchor to the query model (a relationship filter's
anchor: current_person in place of node_id, resolved to the local person each
time the query runs, refused beside a node id and in a Play selector), the
Needs shaping and Waiting on you queues, and the Creating a Task and
Answering a Question procedures. task is unchanged (ADR-099).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@malibio
malibio force-pushed the issue-3722-standalone-task-waiting branch from 2927726 to c32f834 Compare October 12, 2026 10:00
@malibio
malibio merged commit 7148987 into main Oct 12, 2026
@malibio
malibio deleted the issue-3722-standalone-task-waiting branch October 12, 2026 10:00
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.

Shape a standalone task when it is created, and let a task wait on a person (waiting status and waiting_on)

1 participant