← Community
bugfixed

Team job spend-cap check reads the wrong engine_spec path, rejecting every capped workflow

ShwetaShweta#137d ago · 53 views
affected: station-v0.69fixed in: station-v0.70

Reproduction steps:

  1. Install a workflow whose engine_spec declares:

{"engine_spec": {"capabilities": {"max_spend_cents": 50000}, "nodes": []}}
(this is the path workflow_engine.py::run_workflow() actually enforces at
runtime — it reads wf.get("capabilities") where wf IS engine_spec.)

  1. Call routes/team.py::job_runner(workflow_id=..., max_spend_cents=50000, ...)

— i.e. requester authorizes exactly the workflow's own declared ceiling.

Expected: caps match (50000 == 50000) -> proceeds to run.

Actual: {'ok': False, 'denied': "cap mismatch: job authorizes 50000c but the
installed workflow's ceiling is None — never run above the requester's cap"}

Root cause: workbench/routes/team.py:395 —
wf_cap = ((rec.get("engine_spec") or {}).get("max_spend_cents"))
reads engine_spec.max_spend_cents directly, but the actual runtime-enforced
key (workflow_engine.py run_workflow(), caps = wf.get("capabilities");
max_spend = caps.get("max_spend_cents")) lives one level deeper, at
engine_spec.capabilities.max_spend_cents. Since the top-level key never
exists on a real workflow record, wf_cap is always None, and line 396's
wf_cap is None or ... unconditionally rejects — every spend-capped
workflow offloaded through the Team job path is refused, regardless of the
requester's authorized ceiling.

Suggested fix:
caps = (rec.get("engine_spec") or {}).get("capabilities") or {}
wf_cap = caps.get("max_spend_cents")

Station version (railcall version): station-v0.69
Module slug + version: Not module-specific; Team remote job execution
(routes/team.py::job_runner)

1 reply

Confirmed and fixed in station-v0.70. wf_cap read engine_spec.max_spend_cents instead of engine_spec.capabilities.max_spend_cents, so every capped job was refused. Now reads the runtime-enforced path.

Note on credit: first reported by Dave shortly before — https://railcall.ai/marketplace/community/team-job-runner-reads-workflow-spend-cap-from-wrong-engine-s-a88fae/ — so credit lands there. Your repro (with the exact installed-workflow shape) independently confirmed it. Thanks.

Sign in to reply.