Skip to content

compute_job silently missing from the tool list for openai-compatible providers (same schema defect as #283/#298, different failure mode) #472

Closed

Description

Summary

compute_job silently disappears from a model's available-tool list for openai-compatible providers (confirmed with a local Ollama model), even though openscience debug agent research confirms it has "allow" permission for the research agent. No error, no rejected request — the tool is just absent, with everything else in the tool list rendering normally.

Root cause

compute_job's parameter schema is a z.discriminatedUnion("action", [...]) (backend/cli/src/tool/compute-job.ts:110), which Zod compiles to a root oneOf in JSON Schema — a shape most OpenAI-compatible function-calling parsers, including Ollama's, don't accept at a tool's top level.

This is the same underlying schema defect as #283 and #298 (DeepSeek rejecting compute_job's schema outright), and OpenScience already has a fix for it: normalizeDeepSeekToolSchema (backend/cli/src/provider/tool-schema.ts) rewrites a root oneOf/anyOf into {type: "object", anyOf: [...]}, schema-equivalent but broadly parseable. But the call site gates it explicitly to one provider:

// backend/cli/src/provider/transform.ts
if (model.api.npm === "@ai-sdk/deepseek") {
  schema = normalizeDeepSeekToolSchema(schema)
}

openai-compatible (what a local Ollama model uses) never routes through this branch, so the raw, un-normalized schema goes straight to the provider. Same defect, different failure mode: DeepSeek's strict validator rejects the whole request (hence #283/#298 being visible/loud); Ollama's OpenAI-compatible endpoint instead just drops the one tool it can't parse, silently — which is a much harder failure to notice, since the agent has no error to react to and no reason to suspect a specific tool is missing.

The existing test suite had actually encoded this gap as expected behavior:

test("runs only at the native DeepSeek provider boundary", () => {
  expect((ProviderTransform.schema(model("@ai-sdk/deepseek"), union as any) as any).type).toBe("object")
  expect((ProviderTransform.schema(model("@ai-sdk/openai-compatible"), union as any) as any).type).toBeUndefined()
})

Real-world origin

Found this because a local Ollama-served qwen model, in a live research-agent session, reasoned explicitly about needing compute_job for a long-running job (it had been told about the tool via a project skill) and then, checking its own tool schema, found it genuinely wasn't there — despite the permission check confirming "allow".

Fix

Opened #471: broadens the transform.ts gate to @ai-sdk/deepseek || @ai-sdk/openai-compatible, fixes the test that had locked in the old boundary as correct, and adds a regression test using compute_job's real schema shape. Verified against the full backend/cli test suite: 2852 pass / 92 fail with the fix vs. 2851 pass / 92 fail on a clean main baseline — same (unrelated, pre-existing) failures, one new passing test, zero regressions.

Activity

  1. satya-arjunan commented on Aug 31, 2026

    @satya-arjunan
    ContributorAuthor

    Follow-up: fixing the schema bug (PR #471) wasn't actually enough to make compute_job usable in practice. After deploying that fix, a live probe against a real local Ollama model still showed no compute_job in its tool list — that turned out to be a second, separate gate.

    backend/cli/src/session/tool-selection.ts's relevance filter for the research agent only offers compute_job (and modal) as a candidate tool when the current turn's own prompt text contains one of a fixed set of trigger words/phrases:

    if (tool === "compute_job" || tool === "modal")
      return (
        /\b(?:cluster|compute job|gpu|modal|remote compute|slurm|pbs|h100)\b/i.test(text) ||
        /modal-compute|protein-binder/i.test(capability)
      )

    Confirmed empirically: a prompt about a genome-alignment pipeline (SRA downloads, index builds, quantification — genuinely long-running, exactly the kind of task compute_job exists for) never surfaced the tool, because none of those literal words/phrases (cluster, compute job with a space, gpu, modal, remote compute, slurm, pbs, h100) happened to appear in the task's own wording. Re-probing with one of those words present made it appear immediately, and a full start→status round-trip worked correctly once it did.

    In practice this makes compute_job undiscoverable for most real long-running-job use cases unless the user (or the model) happens to phrase things using this specific vocabulary — which isn't something a task's natural language reliably does. We worked around this locally by moving compute_job into the always-included core set (same tier as bash/task), which is a real behavior change (it always pays the tool's schema cost now, not just on relevant turns) rather than a pure bug fix, so we haven't opened a separate PR for it — flagging it here in case the design is worth reconsidering, e.g. broadening the trigger vocabulary, or exempting compute_job from this filter the same way bash/task already are exempt.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions