Skip to content

Remove fixture project agent runtime#71

Merged
abiorh-claw merged 4 commits into
mainfrom
codex/ws-pol-001-09-openai-agent-sdk-only
Jul 6, 2026
Merged

Remove fixture project agent runtime#71
abiorh-claw merged 4 commits into
mainfrom
codex/ws-pol-001-09-openai-agent-sdk-only

Conversation

@Abiorh001

@Abiorh001 Abiorh001 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

PR Trust Bundle: WS-POL-001-09

Chunk

WS-POL-001-09 - OpenAI Agents SDK Only Project Setup Runtime

Goal

Remove the production deterministic project-agent fixture runtime so project
guide sufficiency and submission artifact policy derivation run only through
the OpenAI Agents SDK runtime in current production code.

Human-Approved Intent

The user explicitly rejected the local fixture runtime because it made the
Terminal Benchmark proof look like real agent SDK derivation. The current
product question is whether the OpenAI Agents SDK can derive the project
submission policy from the full guide/source material. Workstream must fail
closed when the model-backed runtime is not configured.

Chunk contract:

  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/chunks/WS-POL-001-09-openai-agent-sdk-only-project-setup.md

What Changed

  • Deleted backend/app/adapters/project_agents/local_fixture.py.
  • Removed project_agent_runtime_adapter from active settings.
  • Simplified the project-agent factory to build OpenAIAgentSdkProjectGuideRuntime.
  • Added explicit test-local fake runtime in backend/tests/test_projects.py.
  • Strengthened selector regression tests so the old
    WORKSTREAM_PROJECT_AGENT_RUNTIME_ADAPTER=local_fixture environment variable
    is ignored in test and cannot restore fixture behavior.
  • Updated README and Terminal Benchmark examples to require OpenAI Agents SDK
    model/API-key settings and to avoid fallback/runtime-fixture wording.
  • Added active WS-POL-001-09 loop state, status, chunk-map entry, and chunk
    contract without rewriting prior chunk history.

Why It Changed

The fixture runtime was useful while plumbing the lifecycle, but it is now
harmful because it can hide whether model-backed setup actually works. A project
guide should trigger Workstream's real project-agent runtime. Tests can still
use explicit fakes, but production code should not expose a deterministic
fixture adapter.

Design Chosen

  • Keep the ProjectGuideAgentRuntime port/interface.
  • Use OpenAI Agents SDK as the only active runtime implementation.
  • Fail closed if WORKSTREAM_PROJECT_AGENT_OPENAI_AGENT_SDK_MODEL is missing.
  • Treat the old runtime selector as ignored legacy environment noise.
  • Keep deterministic behavior test-local and visibly named as a test fake.

Alternatives Rejected

  • Keep local_fixture as dev/test production adapter: rejected because it
    confuses real project setup proof.
  • Keep a runtime selector with one live option: rejected because it implies
    another supported production path.
  • Move deterministic fake into shared production code: rejected because the
    fake exists only for tests.

Scope Control

No task lifecycle, checker runtime, post-submit policy, review/revision,
payment, reputation, blockchain, frontend, object storage, or workflow changes
were added.

Historical chunk contracts remain unchanged. The superseding decision is
recorded only in WS-POL-001-09 artifacts and active status/map files.

Product Behavior

Automatic project setup now requires OpenAI Agents SDK configuration. If the
model is missing, setup routes fail closed through the existing sanitized agent
runtime error path. The Week 1 demo keeps project setup autostart disabled so it
does not imply a configured agent worker.

Acceptance Criteria Proof

  • No production local_fixture source remains.
  • WORKSTREAM_PROJECT_AGENT_RUNTIME_ADAPTER is no longer a Settings field.
  • Factory builds only OpenAIAgentSdkProjectGuideRuntime.
  • Selector regression tests prove the old selector does not re-enable fixture
    behavior.
  • Tests use DeterministicTestProjectGuideAgentRuntime only inside
    backend/tests/test_projects.py.
  • README and examples no longer document a runtime selector or deterministic
    fallback.
  • Week 1 demo startup sets WORKSTREAM_PROJECT_SETUP_PIPELINE_AUTOSTART=false.

Tests/Checks Run

cd backend && .venv/bin/python -m ruff check app/core/config.py app/adapters/project_agents tests/test_projects.py tests/test_config.py
cd backend && .venv/bin/python -m pytest tests/test_projects.py -k 'project_agent_factory_requires_openai_agent_sdk_model or project_agent_factory_ignores_removed_runtime_selector' -q
cd backend && .venv/bin/python -m pytest tests/test_projects.py -k 'project_agent_factory_requires_openai_agent_sdk_model or project_agent_factory_ignores_removed_runtime_selector or openai_runtime_misconfiguration_is_sanitized_and_agent_route_only' -q
cd backend && .venv/bin/python -m pytest tests/test_config.py tests/test_projects.py -k 'create_guide_autostart_runs_celery_pipeline_to_draft_policy or create_guide_autostart_stops_before_derivation_when_sufficiency_blocks or project_agent_factory_requires_openai_agent_sdk_model or project_agent_factory_ignores_removed_runtime_selector or sufficiency_agent_route_is_async_idempotent_and_secret_safe or openai_runtime_misconfiguration_is_sanitized_and_agent_route_only or derivation_agent_allows_warning_report_without_acknowledgement_and_is_idempotent or agent_derived_warning_policy_requires_acknowledgement_before_approval' -q
cd backend && .venv/bin/python -m pytest tests/test_projects.py -k 'agent or autostart or source_snapshot_integrity or openai or project_setup_pipeline' -q
cd backend && .venv/bin/python -m pytest tests/test_config.py tests/test_projects.py -q
cd backend && .venv/bin/docstr-coverage app/adapters/project_agents app/core/config.py --config .docstr.yaml
python3 scripts/check_stale_workstream_wording.py
python3 scripts/check_markdown_links.py
git diff --check

Result summary:

  • ruff: passed.
  • Selector regressions: 2 passed.
  • Selector/runtime route focused tests: 3 passed.
  • Expanded focused project-agent slice: 8 passed.
  • Broader project-agent/autostart slice: 31 passed.
  • Full config/projects suite: 198 passed.
  • Docstring coverage: 100.0%.
  • Stale wording, Markdown link, and diff whitespace checks: passed.

Test Delta

Tests added or strengthened:

  • test_project_agent_factory_requires_openai_agent_sdk_model
  • test_project_agent_factory_ignores_removed_runtime_selector
  • explicit test-local fake runtime for route/autostart tests.

Tests removed or rewritten:

  • old production local_fixture outside-dev fail-closed test removed because
    the production fixture adapter no longer exists.

CI Integrity

  • No GitHub workflow was changed.
  • No lint/test/docstring command was weakened.
  • No dependency was added.

Reviewer Results

Internal review evidence:

  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-09-internal-review-evidence.md

Reviewed code SHA: 4cd69b525665d5c9000734300aa313d9713c575f

Reviewed at: 2026-07-06T04:59:38Z

Reviewer Result Blocking findings Notes
senior engineering PASS None Runtime factory and scope history reviewed.
QA/test PASS None Acceptance criteria and focused checks reviewed.
security/auth PASS None Fail-closed config and secret handling reviewed.
product/ops PASS None Operator docs and product/runtime separation reviewed.
architecture PASS WITH LOW RISKS None Project-agent port and scope integrity reviewed.
docs PASS None Runtime selector/fallback wording reviewed.
reuse/dedup PASS WITH LOW RISKS None No production abstraction issue; low repeated test monkeypatch note.
test delta PASS None Selector regression tests reviewed.

External Review

External review has not run yet for this branch. CodeRabbit/GitHub findings
must be recorded separately if a PR is opened.

Remaining Risks

  • External CI and CodeRabbit are pending until PR creation.
  • Repeated test-local runtime monkeypatches can be extracted later if the test
    surface grows.

Human Review Focus

  • Confirm production project setup should now have only the OpenAI Agents SDK
    runtime path.
  • Confirm test-local fakes are acceptable and visibly separated from production.
  • Confirm historical chunk contracts are preserved while WS-POL-001-09 records
    the superseding decision.

Human Merge Ownership

Only the user can approve and merge this PR. Codex must not merge it without
explicit user approval for that specific PR.

Summary by CodeRabbit

  • New Features

    • Project setup now uses the OpenAI Agents SDK path by default, with clearer setup requirements for the needed model and API key.
  • Bug Fixes

    • Removed the legacy fixture-based runtime from production behavior.
    • Project setup now fails safely when required model configuration is missing.
    • Updated demo startup guidance to avoid unintended automatic setup behavior.
  • Documentation

    • Refreshed README and example notes to match the new setup flow and source-material terminology.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Abiorh001, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 571d35fb-2e36-495e-b870-2e8ff91d572d

📥 Commits

Reviewing files that changed from the base of the PR and between 5378931 and 35dbc97.

📒 Files selected for processing (4)
  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-09-external-review-response.md
  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-09-internal-review-evidence.md
  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-09-pr-trust-bundle.md
  • backend/tests/test_projects.py
📝 Walkthrough

Walkthrough

The change removes the production local_fixture project-agent runtime and its WORKSTREAM_PROJECT_AGENT_RUNTIME_ADAPTER selector, making the project-agent factory always construct the OpenAI Agents SDK runtime. Tests migrate to a deterministic test-local fake runtime, and README, examples, and initiative-tracking docs are updated accordingly.

Changes

OpenAI Agents SDK-only runtime

Layer / File(s) Summary
Settings and runtime factory
backend/app/core/config.py, backend/app/adapters/project_agents/__init__.py, backend/app/adapters/project_agents/local_fixture.py
Removes project_agent_runtime_adapter setting and the local_fixture.py module; factory now unconditionally builds OpenAIAgentSdkProjectGuideRuntime.
Test suite migration
backend/tests/test_projects.py
Adds DeterministicTestProjectGuideAgentRuntime, patches numerous tests to use it, and adds factory tests validating required model config and ignored legacy selector.
README and terminal benchmark docs
README.md, examples/terminal_benchmark/README.md, examples/terminal_benchmark/LOCAL_VALIDATION_NOTES.md, examples/terminal_benchmark/terminal_benchmark_api_e2e.py
Updates setup/demo instructions for OpenAI Agents SDK env vars, disables Week 1 demo autostart, and renames fixture wording/paths to source-material.
Initiative tracking docs
.agent-loop/LOOP_STATE.md, .agent-loop/initiatives/.../STATUS.md, .agent-loop/initiatives/.../CHUNK_MAP.md, .agent-loop/initiatives/.../chunks/WS-POL-001-09-*.md, .agent-loop/initiatives/.../reviews/WS-POL-001-09-*.md
Adds/updates chunk tracking, status, review evidence, and trust-bundle documents for the WS-POL-001-09 chunk.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • Flow-Research/workstream#61: Introduced the project-agent runtime boundary and factory selection mechanism that this PR modifies by removing the fixture branch.

Suggested reviewers: abiorh-claw

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: removing the production fixture project agent runtime.
Description check ✅ Passed The description covers the required template sections and includes goal, intent, scope, evidence, tests, review results, and risks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ws-pol-001-09-openai-agent-sdk-only

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
backend/tests/test_projects.py (1)

643-647: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Repeated monkeypatch boilerplate across ~9 tests.

The same monkeypatch.setattr(project_service_module, "get_project_guide_agent_runtime", lambda: DeterministicTestProjectGuideAgentRuntime()) block is duplicated in every test that needs the deterministic runtime. A shared fixture would reduce duplication and centralize future changes to the fake runtime wiring.

♻️ Proposed fixture extraction
+@pytest.fixture
+def deterministic_project_agent_runtime(monkeypatch: pytest.MonkeyPatch) -> None:
+    monkeypatch.setattr(
+        project_service_module,
+        "get_project_guide_agent_runtime",
+        lambda: DeterministicTestProjectGuideAgentRuntime(),
+    )
+
+
 async def test_create_guide_autostart_runs_celery_pipeline_to_draft_policy(
     project_client: AsyncClient,
-    monkeypatch: pytest.MonkeyPatch,
+    deterministic_project_agent_runtime: None,
 ) -> None:
     monkeypatch.setenv("WORKSTREAM_PROJECT_SETUP_PIPELINE_AUTOSTART", "true")
     monkeypatch.setenv("WORKSTREAM_CELERY_TASK_ALWAYS_EAGER", "true")
     get_settings.cache_clear()
-    monkeypatch.setattr(
-        project_service_module,
-        "get_project_guide_agent_runtime",
-        lambda: DeterministicTestProjectGuideAgentRuntime(),
-    )
Note: tests that also need `monkeypatch` for other purposes (e.g. `OPENAI_API_KEY` at line 1591) would keep the `monkeypatch` fixture alongside this new one.

Also applies to: 692-696, 1587-1596, 1806-1812, 2237-2245, 2263-2271, 2305-2313, 2462-2470, 2515-2523

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/tests/test_projects.py` around lines 643 - 647, The deterministic
runtime monkeypatch is duplicated across multiple project service tests, so
extract it into a shared fixture to centralize the wiring. Create a reusable
fixture around project_service_module.get_project_guide_agent_runtime that
returns DeterministicTestProjectGuideAgentRuntime(), then replace the repeated
monkeypatch.setattr blocks in the affected tests with that fixture while keeping
any other monkeypatch usage (like environment setup) alongside it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@backend/tests/test_projects.py`:
- Around line 643-647: The deterministic runtime monkeypatch is duplicated
across multiple project service tests, so extract it into a shared fixture to
centralize the wiring. Create a reusable fixture around
project_service_module.get_project_guide_agent_runtime that returns
DeterministicTestProjectGuideAgentRuntime(), then replace the repeated
monkeypatch.setattr blocks in the affected tests with that fixture while keeping
any other monkeypatch usage (like environment setup) alongside it.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f8adcac6-c4e9-479e-9f4a-c967def5ce29

📥 Commits

Reviewing files that changed from the base of the PR and between e8cce20 and 5378931.

📒 Files selected for processing (14)
  • .agent-loop/LOOP_STATE.md
  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/CHUNK_MAP.md
  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/STATUS.md
  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/chunks/WS-POL-001-09-openai-agent-sdk-only-project-setup.md
  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-09-internal-review-evidence.md
  • .agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-09-pr-trust-bundle.md
  • README.md
  • backend/app/adapters/project_agents/__init__.py
  • backend/app/adapters/project_agents/local_fixture.py
  • backend/app/core/config.py
  • backend/tests/test_projects.py
  • examples/terminal_benchmark/LOCAL_VALIDATION_NOTES.md
  • examples/terminal_benchmark/README.md
  • examples/terminal_benchmark/terminal_benchmark_api_e2e.py
💤 Files with no reviewable changes (2)
  • backend/app/adapters/project_agents/local_fixture.py
  • backend/app/core/config.py

@abiorh-claw abiorh-claw self-requested a review July 6, 2026 05:42
@abiorh-claw abiorh-claw merged commit 8a524de into main Jul 6, 2026
4 checks passed
@abiorh-claw abiorh-claw deleted the codex/ws-pol-001-09-openai-agent-sdk-only branch July 6, 2026 05:43
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.

2 participants