Skip to content

The local agent does not follow the task procedures (eval:tasks fails 4 of 5 scenarios) #3784

Closed

Description

@malibio

Overview

On the eval:tasks baseline (E4B, 3 reps) four of the five scenarios fail every rep, and the fifth passes only because its write was refused. A prompt dump of the Stage 2 turn shows the Creating a Task and Answering a Question procedures are not among the skills the model is shown, so the failures are a retrieval or routing question first and a model-behaviour question second.

Problem Statement

For all five prompts the routed skills led with generic Graph Editing, Node Creation or Schema Creation, with Creating a Task or Answering a Question only a lower-ranked candidate (or absent: the bug report routed to Implementing a Task). The agent then does ad-hoc graph edits instead of the procedure:

  • A declined request is created anyway. One create_node, no search for a decision.
  • A question that stops work is never made a task. It calls create_relationship with no question task to link, or changes the stopped task.
  • A waiting question is not found. It runs search_semantic and asks the user for context, so the question is never put to them.
  • A visible bug is not shaped. It reads the task and stops, or runs to the turn limit with a stray property written to the project.

Evidence: the procedure was never loaded

Captured with NODESPACE_PROMPT_DUMP on main, E4B, one rep each of bug-created-ready and question-blocks-task:

bug-created-ready question-blocks-task
User request "Something is off in Query engine rewrite: Cut the release branch is marked done but one box on its checklist is still unticked. Get that tracked as work." a question that stops the migration-guide task, waiting on a person
Stage 1 route_query the model emitted "mark checklist item as work for Query engine rewrite release branch that is marked done but has an unticked box on its checklist" "put Anoop's question down to wait for him regarding v1 export format or only v2 coverage of the migration guide"
Candidates in the Stage 2 prompt Graph Editing, Schema Creation, Play Workflow State, Node Creation, Completing a Task Bulk Import, Schema Creation, Organization, Building and Changing a View
Creating a Task / Answering a Question in the prompt 0 occurrences 0 occurrences
  • The verbs that name the procedure are gone before retrieval. "Get that tracked as work" became "mark checklist item as work", which matches Graph Editing's own purpose line.
  • Stage 2 is large for what it is doing. About 74k chars (36k system including nine active playbooks and a full "CREATING A SCHEMA" block, 38k for 12 tool declarations) for a request of about 150 chars, with Schema Creation a candidate in both scenarios and no schema asked for.
  • Some scenarios pass for the wrong reason. bug-not-reproducible passes when its create_node of a nonexistent type "Issue" is refused, so nothing was written.
  • The agent's behaviour follows what it was shown. It reverts the done task through update_task_status or invents a waits_for relationship, which is what the loaded skills told it to do.

Counts on main (E4B, --runs 3, database purged between reps): per-rep 2/5, 1/5, 2/5; bug-created-ready 0/3, question-blocks-task 0/3, answer-asks-user 0/3. Reviewing a Task appears in neither prompt, so the review-procedure changes do not account for them. Single rep dumped, two scenarios, one model: a lead, not a conclusion. The procedure text itself is not the suspected cause, and rewording it to win these prompts would be tuning to the eval.

Proposed Solution

Find, with evidence at each hop, where the procedure drops out, then fix it at the level that causes it, measured against the whole confusion matrix and not these prompts alone. Work down the path in order and stop at the first hop that loses it:

  1. The Stage 1 query. Does the paraphrase lose the intent, and is that the model's choice or something in the Stage 1 prompt (its instruction to keep the subject noun and the action, the mentioned-entity block, the examples) that pulls it toward the resolved entities?
  2. The retrieval step. For the model's query and for the user's own sentence, where do Creating a Task and Answering a Question rank, with what scores, and what do the score gate, the trust filter and K do to them? Compare how the skill's description and purpose line read against both queries.
  3. Candidate injection. What decides which candidates are injected and in what order, and does anything demote a procedure skill (role procedure) against the generic skills?
  4. The surrounding context. With the right procedure injected by hand into these prompts, does E4B follow it? That separates a retrieval failure from a context-size failure, and says whether the nine playbooks and the schema block matter. Run the same scenarios on a larger model to see whether a bigger model follows the procedures.

Answer plainly at the end whether the plumbing is flawed or the query and description wording is, since the fix differs: an ordering or gating defect is code, while a query or description defect is wording, measured against the confusion matrix.

Documentation

  • ADR-038 - the flow under test: the model emits a query, a system step retrieves top-K skills, then Stage 2 judges them. The model forming the query is by design, so a lossy query is a defect in how it is asked, not in the flow's shape
  • ADR-018 - the two-stage classification this runs inside
  • agent-eval.md - the dump recipe (NODESPACE_PROMPT_DUMP) and isolation with NODESPACE_HOME
  • No ADR is expected to change; if the finding is that the flow itself must change, say so in the PR and write the superseding ADR first.

Acceptance Criteria

  • For each of the five eval:tasks scenarios the hop at which the right procedure is lost is stated with evidence (the Stage 1 query, its rank and score, and what was injected)
  • It is stated whether the retrieval code (gating, ordering, injection) is at fault, or the query and description wording, or neither
  • The Stage 2 prompt is measured by section for these scenarios, and the effect of injecting the right procedure by hand is recorded
  • Whether a larger model follows the procedures on the same scenarios is recorded
  • bun run eval:tasks passes every scenario over 3 reps, or each remaining failure is recorded with its reason
  • No regression on the skill-retrieval confusion matrix or the eval:agent smoke run
  • No skill description is reworded to match an eval prompt; a wording change is justified by the cost-side controls
  • Code passes bun run quality:fix

Technical Specifications

Reference Files

  • packages/agent/src/local_agent/routing.rs - Stage 1 routing and the retrieval step
  • packages/agent/src/local_agent/agent_loop.rs - Stage 1 system prompt and candidate injection
  • packages/agent/src/local_agent/prompt_templates.rs - the Stage 2 prompt template
  • packages/agent/src/seeds/skills/creating-a-task.md, answering-a-question.md - the procedures that were not retrieved
  • packages/agent/tests/it/skill_confusion_matrix.rs - the offline retrieval measurement
  • scripts/eval/fixtures/tasks.ts - the five scenarios

Implementation Details

  • Reproduce with the isolated-daemon recipe in agent-eval.md, NODESPACE_PROMPT_DUMP set, --only bug-created-ready,question-blocks-task. The dump holds {"kind":"prompt","sent":...} and {"kind":"response","raw_response":...} lines by seq; Stage 1 is the small prompt that ends in a route_query call.
  • Purge the database and rebuild the daemon before measuring, since seeded guidance does not update in an existing database.
  • Run nothing else on the machine's GPU during a run.

Related Issues

Non-Goals

  • Rewording Creating a Task or Answering a Question to win these prompts
  • Changing the model or the context window

Activity

  1. added
    enhancement
    on Oct 13, 2026
  2. malibio commented on Oct 13, 2026

    @malibio
    CollaboratorAuthor

    Related: six more procedures are being added to the built-in method (the review-loop, shared verification block, bug diagnosis / prototype / research, deprecation, and release-side issues). Each adds routing candidates and the shared block lengthens four existing procedures, so this issue's measurement is the check on whether that is safe. Each of those issues requires the skill-retrieval confusion matrix to show no regression.

  3. self-assigned this
    on Oct 13, 2026
  4. malibio commented on Oct 13, 2026

    @malibio
    CollaboratorAuthor

    Investigation findings (E4B, production stack in-process on a temp DB with the seeded skills; one run per prompt, so directional, not decision-grade). Stage 1 queries and Stage 2 prompts were read from NODESPACE_PROMPT_DUMP.

    What the model was offered, per scenario:

    • declined-request: Creating a Task was a candidate but rendered last (4 of 4, char 23k of 65k) behind Node Creation, Graph Editing, Schema Creation. Model: one create_node, no search.
    • bug-created-ready: Stage 1 rewrote the request ("mark checklist item as work ..."). The procedure lane held Completing a Task. Creating a Task was never offered.
    • bug-not-reproducible: the lane held Addressing Review Findings (a queue-only skill, which the matrix says is "not found by request"). Creating a Task never offered.
    • question-blocks-task: Bulk Import, Schema Creation, Organization, a view skill. No task procedure at all.
    • answer-asks-user: Stage 1 chose route_lookup, which keeps only read-only skills, so Answering a Question never reached the model.

    So in four of five scenarios the procedure is not in front of the model. Two retrieval/routing causes: the lane's single procedure is chosen from Stage 1's rewritten query and is often a different procedure, and the lookup path drops the lane.

    Two experiments on declined-request, where the procedure IS offered:

    • Render the procedure first: still a bare create_node.
    • Offer only the procedure (no competing tool skills): still create_node, now with a drafted brief but with STEP 1 (look for it built) and STEP 2 (look for a decision) skipped.

    So the order and the competing skills are not the cause there. E4B performs the write steps of a multi-step procedure and skips its look-first steps. A larger model was not testable here (the 12B does not fit the 16 GB machine at this context).

    Nothing was changed in the product. A fix needs a design decision (staging a procedure's reads before its writes, or letting the lane offer more than one procedure and keep it on the lookup path) and is not a wording change.

  5. malibio commented on Oct 13, 2026

    @malibio
    CollaboratorAuthor

    PR #3807 landed: a create held for a recorded decision, with a turn-end question to the user (declined-request scenario). Verified in-process on E4B; eval:tasks and the confusion matrix were not re-run.

    Remaining scope for this issue, from the findings above:

    • Procedure lane: the lane's one procedure is chosen from Stage 1's rewritten query and is often the wrong one (Completing a Task, Addressing Review Findings), or none is relevant (question-blocks-task). Creating a Task is never offered in three scenarios. Needs measuring against the matrix with realistic, non-eval requests; Addressing Review Findings is documented as queue-only yet wins the lane on "log a bug".
    • Lookup path: route_lookup keeps only read-only skills, so Answering a Question never reaches the model for "take the question waiting on me and get it answered".
    • Placeholder ids: in question-blocks-task the model called create_relationship with "Anoop's ID here". A write whose ids do not resolve could put the question to the user (the same backstop pattern) instead of ending on a tool error.
    • Larger-model check is still open (the 12B does not fit this machine at that context).
  6. malibio commented on Oct 14, 2026

    @malibio
    CollaboratorAuthor

    Prompt-dump evidence and run numbers are now in the issue body (investigation plan folded in from #3810, which is closed as a duplicate).

    Run record on main (E4B, isolated daemon, database purged between reps, Metal OOM count 0 in every run):

    • --runs 1: 2/5
    • --runs 3: per-rep 2/5, 1/5, 2/5; pass^3 1/5. bug-created-ready 0/3, bug-not-reproducible 2/3, declined-request 3/3, question-blocks-task 0/3, answer-asks-user 0/3.
    • Control against the parent of the review-procedure change: the --runs 3 run aborted with "ENVIRONMENT NOT USABLE" (a rep scored 0/5, no results file), so it is not a usable comparison. Its visible reps failed the same way as main, and declined-request created the task there but passed on main; unexplained and likely noise at one rep.
    • The declined-request pass on main is an empty reply after a create_node, so treat it as unreliable until the hops above are answered.
  7. malibio commented on Oct 14, 2026

    @malibio
    CollaboratorAuthor

    Hop-by-hop record (E4B, locked embedding model; ranks are the retrieval scores of the lane, user sentence / Stage 1 paraphrase). PR #3821 carries the one code fix.

    scenario where the procedure is lost evidence
    answer-asks-user Lookup narrowing (code). Answering a Question is the lane's pick (1.069 vs Research & Search 0.870) but read_only_candidates drops any write-tool skill when a read-only one clears the gate fixed in #3821: 0/3 → 3/3
    bug-created-ready Lane width (retrieval). The lane holds one procedure; the best five procedures score 0.957 / 0.937 / 0.931 / 0.926 / 0.905 and Creating a Task is third (0.931; tied second on the paraphrase) lane of up to 3 within 0.03 offered it: still 0/3, no aggregate gain, longer prompts, turns at the 180s limit. Not kept
    bug-not-reproducible Lane pick is Addressing Review Findings (0.942 vs Creating a Task 0.844). Passes 2/3 to 3/3 because the write is refused or reported not_for on Addressing Review Findings moved it 0.03 on the paraphrase only. Not kept
    question-blocks-task Retrieval wording. Creating a Task is 12th of 13 procedures (0.814), Answering a Question is not in the top 13; the request's verbs are about waiting on a person, which only the body of Creating a Task covers adding the question clause to its use_for lowered its score on its own prompt (0.924 → 0.915). Not kept. Model also writes placeholder ids (create_relationship)
    declined-request Offered (lane pick, 0.924), then skipped STEP 1/2 fixed by the hold in #3807, 3/3

    Answers to the issue's questions:

    • Plumbing or wording? Both, in different places. The lookup path is a code defect (fixed). The lane's single slot is a plumbing limit, but widening it does not help E4B: it performs a procedure's write steps and skips its look-first steps (earlier experiment: procedure first, procedure alone, both still a bare create_node). question-blocks-task is a wording/coverage gap that no description change tried here closed.
    • Stage 2 prompt size: unchanged by the fix; a lane of 3 made it longer and slower, which is why it was dropped.
    • Larger model: still untested: the 12B does not fit this 16 GB machine at 32K context.
    • Confusion matrix: 14 of 186 miss before and after, all recorded as not yet won. eval:agent smoke not re-run.

    Remaining, as a design decision and not a wording change: stage a procedure's reads before its writes (so a model that skips look-first steps cannot reach the write), and decide how a request that is about waiting on a person reaches Creating a Task. Left open for that.

  8. 1 remaining item

  9. malibio commented on Oct 15, 2026

    @malibio
    CollaboratorAuthor

    Close-out record for #3784. PR #3824 carries the last code change; #3807 and #3821 carried the earlier ones.

    Method. E4B (gemma-4-e4b-q4km, n_ctx 32768), isolated daemon (NODESPACE_HOME), database purged between reps, NODESPACE_PROMPT_DUMP and daemon debug log read per turn, GPU sampled while each run was going. eval:tasks now asks each intent in two or three phrasings (16 scenarios), so a result has to hold off the five sentences the procedures were first measured on.

    Where each procedure is lost

    hop finding fixed?
    Stage 1 query The paraphrase keeps the noun and drops the verb ("get that tracked as work" → "mark checklist item as work"), as the issue said. The model forms the query by design (ADR-038). no change; not the cause of the failures that remain
    Retrieval Procedures embed within 0.03 of each other for a bug report (0.957 / 0.937 / 0.931 / 0.926); Creating a Task is third, and for "put his question down so it waits for him" it is 12th of 13. Rewording its description moved scores under 0.03 and lowered it on its own prompt. A lane of up to 3 within 0.03 gave the same aggregate and longer prompts. wording and width tried, not kept
    Candidate injection, lookup path route_lookup drops every skill that writes, so Answering a Question never reached the model for "get it answered". yes, #3821 (answer-asks-user 0/3 → 3/3)
    Surrounding context The history summarizer fired on every procedure step. A fixed 8,000-token ceiling was compared against history plus a system prompt that is ~20K tokens once a procedure is injected. Each step paid a summarization call that evicted the KV cache (a second ~20K-token prefill, 75 to 100 s in the daemon log) and replaced the request with the model's paraphrase of it. yes, #3824
    Model With the right procedure forced into the lane and nothing else injected (30K-char prompt, 35 s turns), E4B completes 0 of 6 bug-to-task and question-task scenarios: it reads, writes one node (often the wrong type or with parent_id nested in field_values), then replies. A one-shot re-prompt after the first write did not change it (the model repeated its reply). not fixable at this layer on this model

    Numbers

    eval:tasks, 16 scenarios, one rep per configuration:

    scenarios ending at the 180 s cap passed
    baseline (main at #3821) 8 5
    #3824 0 5

    The five passes are the negative-assertion scenarios (declined, answer-asks-user, not-reproducible). None of the ten positive-write scenarios (ready task, diagnosis, question task, original and held-out) passes in any configuration. The earlier six-scenario runs (3 reps each, three configurations) agree.

    eval:agent: baseline 13/17, #3824 13/16 (one scenario unscored for routing); the 8-series chat group over 3 reps each: baseline 8a 3/3 and 8b/8c/8d 0/3; #3824 8a 3/3, 8b 0/3, 8c and 8d pass in every scored rep. The confusion matrix is unchanged at 14 of 186 (no retrieval change since the last run).

    Contention: the GPU was sampled for every run; no other user's inference process was seen. One check during setup found 99% from another user's test binary, and the run was held until it was clear.

    Acceptance criteria

    • each scenario's lost hop is stated with evidence (table above)
    • plumbing vs wording: plumbing in two places (lookup narrowing, summarizer), both fixed; wording and lane width tried and not kept
    • Stage 2 prompt measured by section; right procedure injected by hand recorded
    • larger model: not run. The 12B does not fit this 16 GB machine at this context; the 26B-A4B does not either.
    • eval:tasks passes every scenario over 3 reps: no. The remaining failures are the model's, recorded above.
    • no regression on eval:agent
    • no description reworded to match a prompt (the rewordings were measured and reverted)
    • quality:fix

    What is left, and whose decision it is

    The failures that remain are E4B's behaviour on multi-step write procedures, not a defect in retrieval, routing or context. The options, none of which is a wording change:

    1. Accept the limit and close: the procedures work on a model that follows them, and E4B reaches them only for the read, ask and decline cases.
    2. Give the procedure's write phase a single tool (create the task with its brief, checklist and project in one call; create a question task in one call). It turns 5 to 7 calls into one, which is where E4B stops. It changes the agent's tool vocabulary, so per the issue's own text it needs an ADR first.
    3. A larger model for these procedures, once one fits.

    I'd recommend closing #3784 on this record and taking option 2 or 3 as its own decision.

  10. malibio commented on Nov 16, 2026

    @malibio
    CollaboratorAuthor

    Closing on the close-out record above. Code landed in #3807, #3821, #3824 and #3838. Two criteria were not met and are not tracked here: the larger-model comparison was not run (the 12B and 26B models do not fit the 16 GB machine), and eval:tasks does not pass every scenario on E4B. #3838 (create_task) merged after the last measurement and was not re-measured against these scenarios.

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

Metadata

Metadata

Assignees

Labels

backendenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions