record_coverage exposed despite coverage_enabled=false and missing task context

Aperta
#892 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
46/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, postgresql

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Go
Stelle
18.7k
Fork
7k
Merge medio
10h 57m
PR unite (30g)
494

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di BaaRai/ARTEX

Tutte le issue di BaaRai/ARTEX

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.