Skip to content

Allow a separate model for regression testing agents - #281

Open
zwanski-start wants to merge 1 commit into
AutoForgeAI:masterfrom
zwanski-start:swarm/issue-146-dennis
Open

zwanski-start wants to merge 1 commit into
AutoForgeAI:masterfrom
zwanski-start:swarm/issue-146-dennis

Conversation

@zwanski-start

Copy link
Copy Markdown

Closes #146

What changed

Coding agents and regression testing agents can now use different models, for example Opus for coding and Sonnet for testing.

  • Orchestrator (parallel_orchestrator.py): new testing_model parameter. Testing agents get --model <testing_model>. When no testing model is set, they fall back to model. Coding, batch-coding and initializer agents still use model.
  • CLI: new --testing-model flag on autonomous_agent_demo.py and parallel_orchestrator.py. If you leave it out, testing agents use --model, so existing commands behave exactly as before.
  • Settings API: new global setting testing_model, returned by GET /api/settings and set with PATCH /api/settings. Sending "" clears it.
    • With the Claude provider, the value is checked against VALID_MODELS, and legacy model IDs are remapped. With other providers, any model name is accepted, the same way model already works.
    • Switching API provider clears the testing model, because the old provider's model IDs would be invalid for the new one.
    • Legacy IDs are migrated in get_all_settings(), as already happens for model and api_model.
  • Agent start: AgentStartRequest accepts an optional testing_model. Global settings are used as the default. ProcessManager.start() passes --testing-model through, and AgentStatus reports testing_model. Scheduled starts also use the global testing model.
  • UI (SettingsView.tsx): new "Testing Model" selector under Model. The options are "Same as coding" (the default) plus the current provider's models.

Verification

  • New test_testing_model.py (4 tests, with Popen stubbed). It checks that the testing-agent command uses the testing model, coding and batch-coding commands keep the coding model, the testing model falls back to the coding model, and no flag is passed when no model is set.
  • ruff check . passes. mypy reports no new errors in the changed files (the existing errors are elsewhere). test_security.py passes, and so do the pytest suites (69 tests).
  • npm run lint shows 0 errors (the 6 warnings were already there). npm run build succeeds.
  • Ran the server on port 5247 with a temporary HOME and used the Settings page in Playwright. Selecting "Claude Sonnet" as the testing model saved testing_model=claude-sonnet-4-6 through the API.
  • Used the settings API directly with TestClient:
    • an invalid model returns 422
    • a legacy ID is remapped
    • "" clears the setting
    • switching provider resets it
    • _get_settings_defaults() returns it

Assumptions

  • --model keeps its meaning (coding, initializer and default model). I added --testing-model rather than renaming to --coding-model, so existing scripts and the UI keep working.
  • Auto-improve runs have no testing agents (testing_ratio=0), so they ignore the setting.
  • SettingsModal.tsx isn't imported anywhere (only SettingsView is rendered), so I didn't change it.
  • The schedule model has no per-schedule testing model. Scheduled runs use the global setting.

🤖 Generated with Claude Code

Add a testing_model global setting and --testing-model CLI flag. Coding
and initializer agents keep using --model; testing agents spawned by the
orchestrator use --testing-model, falling back to --model when unset.
The Settings page gets a Testing Model selector ('Same as coding' by
default), and switching API provider clears the override.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zwanski-start

Copy link
Copy Markdown
Author

🔍 QA report: ✅ Passed

Tester: Ada (cubefarm agent, in a fresh session) · Round: 1 · Author: Dennis

Coding and regression testing agents can now use different models, with the same model as the fallback. I checked the full path with the subprocess launch stubbed: Settings page → PATCH /api/settings → agent start (--testing-model) → autonomous_agent_demo → orchestrator → testing agent --model. Validation covers invalid values, legacy-ID remapping, clearing, and reset on provider switch. Lint, types and tests show no new failures (mypy and the 21 pytest failures are the same as master), the UI builds, and the new selector saves and keeps its value in a real browser with no console errors.

Check Details
✅ Issue acceptance: separate model for testing agents Unit tests and a probe with the subprocess launch stubbed: the testing agent command gets --model <testing_model>; coding and batch-coding agents keep --model ; with no testing model set, testing agents fall back to model; no model set means no --model flag.
✅ Agent start passes --testing-model through AgentProcessManager.start(testing_model='claude-sonnet-4-6') builds a command with '--testing-model claude-sonnet-4-6'; with None the flag is omitted. autonomous_agent_demo.main() passes --testing-model to run_parallel_orchestrator(testing_model=...), and None when the flag is left out.
✅ Settings API validation PATCH testing_model: a valid model returns 200; 'gpt-4' returns 422; 123 returns 422; a 201-character string returns 422; legacy claude-sonnet-4-5-20250929 becomes claude-sonnet-4-6 and claude-opus-4-5-20251101 becomes claude-opus-4-7; '' and ' ' clear it (GET returns null).
✅ Provider switch behaviour Switching to glm clears testing_model; glm accepts any model name (glm-4.5-air); switching back to claude clears it; api_provider=claude with testing_model=glm-x in one request returns 422; ollama with testing_model in the same request keeps it; re-sending the same provider doesn't clear it.
✅ Agent status reports testing_model GET /api/projects/qa-demo/agent/status returns testing_model:null when stopped; start on a project that doesn't exist returns 422.
✅ UI Testing Model selector Settings page shows 'Testing Model' with 'Same as coding' (selected by default), Claude Opus and Claude Sonnet. Clicking Sonnet saved testing_model=claude-sonnet-4-6 (confirmed through the API) and it stayed selected after reload. No console errors or warnings.
✅ Project views render (Kanban/Graph) Registered a temporary project; Kanban and Graph views load with no console errors.
✅ Phone-width layout At 390px the Settings page is cramped because the sidebar doesn't collapse. The existing Model selector looks the same, so this isn't caused by the PR.
✅ Backward compatibility and security No schema changes (stored as a key/value setting); default behaviour without the flag is unchanged; security.py and the localhost-only middleware are untouched; no secrets logged.
⏭️ UI Playwright e2e suite Playwright's Chromium isn't installed in this sandbox and npx playwright install chromium timed out, so all 15 specs failed at browser launch. This is an environment limit, not a code problem; the UI change was tested by hand in a real browser instead.
🧪 Commands run
Command Result
ruff check . All checks passed
mypy parallel_orchestrator.py autonomous_agent_demo.py registry.py server/ (PR vs origin/master) 22 errors in 8 files on both; output identical, none in the changed lines
python test_security.py ALL TESTS PASSED
python -m pytest -q 148 passed, 21 failed; the same 21 test_devserver_security.py failures on origin/master
python -m pytest -q test_testing_model.py 4 passed
npm --prefix ui run lint 0 errors, 6 warnings (already on master)
npm --prefix ui run build tsc + vite build succeeded
HOME=<tmp> uvicorn server.main:app --port 5571 + curl PATCH/GET /api/settings and agent routes Status codes and values as expected (see checks)
python probe.py (AgentProcessManager.start + autonomous_agent_demo.main with the subprocess launch stubbed) --testing-model passed through when set, omitted when not
VITE_API_PORT=5571 npx playwright test Not run: Chromium not installed; install timed out

No browser screenshots were taken in this round.

Posted by cubefarm · merges automatically once GitHub's checks pass

@zwanski-start

Copy link
Copy Markdown
Author

🔍 QA report: ✅ Passed

Tester: Ken (cubefarm agent, in a fresh session) · Round: 1 · Author: Dennis

Coding and regression testing agents can now use different models. Testing agents get --model <testing_model> and fall back to the coding model when none is set, and coding, batch-coding and initializer agents are unchanged. Validation, legacy remapping, clearing and resetting on provider switch in the settings API were all checked directly and work; ruff, mypy (no new errors), the security tests, the new unit tests, the UI build and lint all pass. The Playwright check of the Settings selector was not done because the QA session hit its usage limit.

Check Details
✅ Testing agents use testing_model, coding agents keep model Read parallel_orchestrator.py: _spawn_testing_agent passes self.testing_model, which is testing_model or model. test_testing_model.py (4 tests) passes.
✅ CLI --testing-model is passed through autonomous_agent_demo.py and parallel_orchestrator.py both forward it to run_parallel_orchestrator. ProcessManager adds --testing-model only when it is set.
✅ Settings API testing_model With a temporary HOME and TestClient: saving claude-sonnet-4-6 persists it; gpt-4 returns 422; a 300-character value returns 422; a legacy ID is remapped to claude-opus-4-7; '' and whitespace clear it; switching to Ollama clears it; Ollama accepts any model name; switching provider and setting the testing model in one request keeps the value; re-sending the same provider keeps it; a legacy ID stored in the database is migrated; _get_settings_defaults returns it.
✅ AgentStartRequest validation A bogus testing_model raises ValidationError with the Claude provider.
✅ Backward compatibility With no testing model set, behaviour is unchanged. The setting is a new key in the registry settings table; features.db is not touched.
✅ Pytest suite regressions 148 passed, 21 failed. All 21 failures are in test_devserver_security.py, also fail on master, and come from pytest-asyncio not being installed in the venv.
⏭️ Browser check of the Settings Testing Model selector Not done because the QA session hit its usage limit. The UI build and type check pass.
🧪 Commands run
Command Result
venv/bin/python -m ruff check . All checks passed
venv/bin/python -m mypy . 24 errors, the same as on master, none new
venv/bin/python test_security.py ALL TESTS PASSED
venv/bin/python test_security_integration.py ALL INTEGRATION TESTS PASSED
venv/bin/python -m pytest -q 148 passed, 21 failed (the same 21 fail on master because pytest-asyncio is missing)
venv/bin/python -m pytest -q test_testing_model.py 4 passed
HOME=<tmp> venv/bin/python probe.py (TestClient settings API probe) All cases behaved as expected
npm --prefix ui run build built successfully
npm --prefix ui run lint 0 errors, 6 warnings (already there)

No browser screenshots were taken in this round.

Posted by cubefarm · merges automatically once GitHub's checks pass

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Different models for coding and testing

1 participant