record_coverage exposed despite coverage_enabled=false and missing task context

Open
#892 2 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
46/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
go, postgresql

Research direction

Start with agent/worker.go, agent/tools.go, agent/coverage_ledger.go, and server/assembly.go; trace how DropCoverageTools() interacts with domain tool injection and which ToolSet handles the call. Reproduce with coverage disabled and inspect the resolved model-facing tools and task context. Done means coverage-only tools stay unavailable when disabled and the worker can complete the diagnostic without the context error.

Written by the indexing model from the issue text.

Description

bug P2

The record_coverage tool is exposed to the Worker agent even when the task’s coverage_enabled setting is false.

When invoked, the tool repeatedly returns:

record_coverage requires a task context

The issue was reproduced using a simple targetless local diagnostic, without external network requests or third-party targets.

Environment

  • ARTEX branch: main
  • Latest tested commit: c985c830
  • OS: macOS, Apple Silicon
  • Hardware: Apple M3 Max, 64 GB RAM
  • Docker Engine: 29.7.2
  • Docker Compose: 5.4.0
  • LLM provider: LM Studio, OpenAI-compatible API
  • Model: qwen3.8-27b-uncensored-mlx
  • Sandbox mode: required
  • Coverage: disabled for the affected diagnostic task

The issue was initially observed before the latest update. The missing task-context error was also observed after updating to c985c830.

Steps to reproduce

  1. Create a targetless local diagnostic task.
  2. Disable Coverage in the task settings.
  3. Delegate a single local diagnostic intent to a Worker.
  4. Ask the Worker to:
    • Calculate 25 multiplied by 16.
    • Write the result to diagnostic.txt using a relative workspace path.
    • Read the file back.
    • Verify that the result is 400.
    • Record the result and complete the intent.
  5. Inspect the model-facing tool list and subsequent tool calls.

The calculation, file creation, file read and verification all succeeded.

The problem occurred during the result write-back stage.

Evidence 1: Coverage is disabled

The affected local diagnostic was:

  • Task ID: 7
  • Goal ID: 20
  • Intent ID: 21

A PostgreSQL inspection confirmed that coverage_enabled was false for this task.

Evidence 2: Actual model-facing tool schema

Despite Coverage being disabled, the LM Studio developer log shows record_coverage in the tools array received through POST /v1/chat/completions.

The relevant schema is reproduced below, with descriptive text omitted for brevity:

{
"type": "function",
"function": {
"name": "record_coverage",
"parameters": {
"type": "object",
"properties": {
"discovery_artifact": {
"type": "object"
},
"evidence": {
"type": "string"
},
"outcome": {
"type": "string",
"enum": [
"reported",
"no_issue_found",
"ruled_out",
"not_applicable",
"needs_follow_up"
]
},
"reason": {
"type": "string"
},
"risk_area": {
"type": "string"
},
"surface": {
"type": "string"
}
},
"required": [
"surface",
"risk_area",
"outcome"
]
}
}
}

The record_fact tool was also available.

Evidence 3: Actual failing function call

The following call was captured in the LM Studio developer log on December 2, 2026, at 20:51:55.

The JSON-encoded arguments have been decoded for readability, with their original values preserved.

{
"id": "975759350",
"type": "function",
"function": {
"name": "record_coverage",
"arguments": {
"evidence": "Bash: pwd && echo $((2516)) -> /workspace/i21, 400; echo $((2516)) > diagnostic.txt && cat -> 400; Read diagnostic.txt -> line1=400; wc -c = 4 bytes, [ "$(cat diagnostic.txt)" = "400" ] -> VERIFY_OK",
"outcome": "no_issue_found",
"risk_area": "local_execution_diagnostic",
"reason": "Goal #20 diagnostic: 25*16 computed as 400, written via relative path, read back and verified exactly 400 (4 bytes incl. trailing newline); no tool failures, strictly local execution",
"surface": "diagnostic.txt in worker working directory /workspace/i21 (relative path)"
}
}
}

Returned tool error:

record_coverage requires a task context

Source code observations

During troubleshooting, I reviewed the following files:

  • agent/worker.go
  • agent/tools.go
  • agent/coverage_ledger.go
  • server/assembly.go

The Worker appears to configure its task-specific ToolSet and remove coverage-only tools through DropCoverageTools().

However, the tool resolver in server/assembly.go also appears to inject enabled domain tools that are absent from the incoming tool list.

The domain registry is constructed using a separate ToolSet.

This raises the possibility that a coverage-only tool removed from the task-specific tool list is subsequently reintroduced by the domain resolver without the original task context.

The guard order in agent/coverage_ledger.go is relevant:

if t.coverageDisabled {
return actool.Errorf(
"record_coverage is disabled: the coverage feature is off for this task",
), nil
}
if t.as == nil || t.taskID <= 0 {
return actool.Errorf(
"record_coverage requires a task context",
), nil
}

The observed error indicates that the first guard did not trigger for the ToolSet instance handling the call.

This is consistent with the domain registry hypothesis, but does not establish it conclusively.

Separate model-side observation

The model’s reasoning explicitly stated that it should use record_fact, but the raw LM Studio response contained a record_coverage function call.

I understand that this may be a separate model or function-call parsing issue.

Regardless of the model’s selection behavior, record_coverage should not be exposed to the model when Coverage is disabled.

Expected behavior

  • Coverage-only tools should remain excluded throughout the complete tool-resolution pipeline when coverage_enabled=false.
  • Domain tool injection should respect task-specific feature flags.
  • Tools requiring task context should receive the appropriate task-specific ToolSet.
  • The Worker should be able to record the local diagnostic result without encountering an unrelated coverage tool error.

Suggested investigation

Please review whether:

  1. Domain tool injection can reintroduce tools previously removed by DropCoverageTools().
  2. Task-specific coverage settings are preserved during tool resolution.
  3. The resolved tool instance retains the correct task context.
  4. Runtime instrumentation can identify the ToolSet origin, task ID, coverage flag and asset-store availability at invocation time.

Verification limitations

I have confirmed the model-facing tool exposure and returned error.

I have not instrumented the server to identify the exact ToolSet instance handling the call, and I have not isolated the behavior before domain tool injection.

The proposed root cause remains a hypothesis pending runtime verification.

The Docker workspace and proxy CA provisioning concerns, as well as retry-loop and token-consumption concerns, are being reported separately.

Thank you.

Dominant language
Go
Stars
18.7k
Forks
7k
Avg merge
10h 57m
Merged PRs (30d)
494

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BaaRai/ARTEX

All issues in BaaRai/ARTEX

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.