Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .claude/repo-routine-state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"rotation": {"dead-code": {"last_slice": null}, "missing-tests": {"last_slice": "src/supervaizer/admin/workbench_routes.py"}},
"dedup_backlog": []
}
41 changes: 41 additions & 0 deletions tests/test_workbench_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
EntityStatus,
Job,
JobContext,
JobResponse,
Parameter,
ParametersSetup,
)
Expand Down Expand Up @@ -206,6 +207,46 @@ def test_answer_hitl_returns_404_for_missing_case(
assert "missing-case" in response.json()["detail"]


class TestWorkbenchStartJob:
"""Test workbench job startup and parameter merging."""

def setup_method(self) -> None:
Jobs().reset()

def teardown_method(self) -> None:
Jobs().reset()

def test_start_job_uses_environment_parameter_fallback(
self,
test_client_with_agent: tuple[TestClient, str],
monkeypatch: pytest.MonkeyPatch,
mocker: MockerFixture,
) -> None:
client, agent_slug = test_client_with_agent
monkeypatch.setenv("API_KEY", "from-env")
execute = mocker.patch.object(
Agent,
"_execute",
return_value=JobResponse(
job_id="workbench-job",
status=EntityStatus.COMPLETED,
message="done",
),
)

response = client.post(
f"/manage/agents/{agent_slug}/workbench/start",
json={"parameters": {}, "fields": {"how_many": 3}},
)

assert response.status_code == 200
assert response.json()["status"] == "STARTING"
execute.assert_called_once()
params = execute.call_args.args[1]
assert params["fields"] == {"how_many": 3}
assert params["agent_parameters"] == [{"name": "API_KEY", "value": "from-env"}]


class TestWorkbenchExecuteStep:
"""Test scheduled-step execute-now ownership checks."""

Expand Down
Loading