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
24 changes: 15 additions & 9 deletions .agent-loop/LOOP_STATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

- Active initiative: `WS-POL-001` - Submission Artifact Policy Foundation
- Active planning chunk: none
- Active implementation chunk: none
- Branch: `main`
- Status: `WS-POL-001-08` is merged to `main` through PR #69 as `aea7024`.
Automatic pre-submit project setup now runs through Celery from guide/source
capture: sufficiency analysis runs first, blocked sufficiency stops policy
derivation, and passed or warning sufficiency creates only a draft
`SubmissionArtifactPolicy` for human Workstream approval.
- Active implementation chunk: `WS-POL-001-09` - OpenAI Agents SDK Only Project
Setup Runtime
- Branch: `codex/ws-pol-001-09-openai-agent-sdk-only`
- Status: `WS-POL-001-09` is in implementation and internal review. This chunk
removes the production `local_fixture` project setup runtime and the old
runtime selector so automatic project setup only uses the OpenAI Agents SDK
runtime behind the Workstream project-agent port.
- Last merged implementation SHA: `0c32c97`
- Last merge commit: `aea7024`
- Current gate: post-merge memory update for `WS-POL-001-08`
- Next chunk: inactive until the user gives an explicit start signal
- Current gate: deterministic verification and internal reviewer fanout for
`WS-POL-001-09`
- Next chunk: inactive until `WS-POL-001-09` reaches a human checkpoint

## Operating Rule

Expand All @@ -37,6 +38,11 @@ through Celery. It did not redesign post-submit policy, review, revision,
payment, reputation, blockchain integrations, frontend behavior, or task
submission runtime.

The active `WS-POL-001-09` chunk is a corrective hardening chunk for the project
setup runtime boundary. It removes the production fixture adapter and does not
change task, checker, post-submit, review, revision, payment, reputation,
blockchain, frontend, or object-storage behavior.

## Last Review State

- Last completed initiative: `WS-ENG-001` Codex zero-trust engineering loop bootstrap.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,3 +665,87 @@ Human review focus:

Task contract cleanup without weakening project-policy driven submission
intake.

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

Goal:

Remove the production `local_fixture` project setup runtime and the runtime
selector that made fixture-derived output look like real agent SDK output.
Automatic project guide sufficiency and submission artifact policy derivation
now run only through the OpenAI Agents SDK runtime behind Workstream's
project-agent port.

Risk:

L1

Depends on:

`WS-POL-001-08`

Allowed files:

```text
backend/app/core/config.py
backend/app/adapters/project_agents/**
backend/tests/test_projects.py
backend/tests/test_config.py
README.md
examples/terminal_benchmark/**
.agent-loop/LOOP_STATE.md
.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/STATUS.md
.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/CHUNK_MAP.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-*
```

Not allowed:

```text
backend/app/modules/tasks/**
backend/app/modules/checkers/**
backend/app/modules/projects/** except project-agent adapter imports if needed
backend/alembic/**
.github/workflows/**
demos/**
frontend/**
payment/reputation/blockchain code
object-storage implementation
new agent runtime provider implementation
production secrets or committed .env files
```

Acceptance criteria:

- Production project setup has no `local_fixture` runtime adapter.
- `WORKSTREAM_PROJECT_AGENT_RUNTIME_ADAPTER` is removed from active code and
current operator docs.
- The project-agent runtime factory builds the OpenAI Agents SDK runtime and
fails closed when the required model setting is missing.
- Setting the old runtime selector to `local_fixture` does not re-enable a
fixture runtime.
- Tests use explicit test-local fakes for deterministic project-agent behavior.
- Terminal Benchmark example docs and script do not describe a removed runtime
selector or fallback.
- README explains that automatic project setup needs OpenAI Agents SDK model and
API-key settings.
- Temporary Week 1 demo startup does not enable setup autostart without the
required OpenAI worker configuration.

Verification:

- Ruff, focused project-agent tests, docstring coverage, stale wording scan,
Markdown link check, and diff whitespace checks pass.

Required reviewers:

senior engineering, QA/test, security/auth, product/ops, architecture, docs,
reuse/dedup, test delta.

Human review focus:

The removed fixture path cannot be used as a production project setup runtime;
test fakes stay visibly test-local; operator docs do not imply fallback
behavior; and the project-agent port remains available for deliberate future
runtime providers.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

`WS-POL-001-01`, `WS-POL-001-02`, `WS-POL-001-03`, `WS-POL-001-04`,
`WS-POL-001-05`, `WS-POL-001-06`, `WS-POL-001-07`, and `WS-POL-001-08` are
merged to `main`. `WS-POL-001-08` merged through PR #69 as `aea7024` after
deterministic verification, internal reviewer fanout, GitHub Actions,
CodeRabbit review, external review response, and user merge approval.

No implementation chunk is active. The next chunk must start only after an
explicit user signal and a new chunk contract.
merged to `main`. `WS-POL-001-09` is active on
`codex/ws-pol-001-09-openai-agent-sdk-only` after the user's explicit correction
to remove the production fixture runtime and keep project setup on the OpenAI
Agents SDK runtime.

## Active Chunk

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

## Chunk Status

Expand All @@ -27,12 +25,13 @@ None.
| `WS-POL-001-06` | Merged | `codex/ws-pol-001-06-terminal-benchmark-drill` | 67 | Hardens the Terminal Benchmark proof harness and removes stale project guide/payment contracts before continuing pre-submit checker work. |
| `WS-POL-001-07` | Merged | `codex/ws-pol-001-07-task-contract-cleanup` | 68 | Removes task-owned `required_files`/`required_evidence` from request/response/model/migration and keeps artifact requirements project-policy driven. |
| `WS-POL-001-08` | Merged | `codex/ws-pol-001-08-celery-project-setup` | 69 | Makes guide/source capture enqueue Celery pre-submit setup automatically: sufficiency first, blocked stops, draft submission artifact policy next; removes remaining construction-state compatibility surfaces. |
| `WS-POL-001-09` | In review | `codex/ws-pol-001-09-openai-agent-sdk-only` | - | Removes the production `local_fixture` project setup runtime and old runtime selector; keeps deterministic test behavior in explicit test-local fakes only. |

## Blockers

| Blocker | Owner | Next action |
|---|---|---|
| None | - | Await explicit user start signal for the next bounded chunk. |
| None | - | Complete deterministic verification and internal review for `WS-POL-001-09`. |

## Follow-Ups

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Chunk Contract: WS-POL-001-09 - OpenAI Agents SDK Only Project Setup Runtime

## Initiative

WS-POL-001 - Submission Artifact Policy Foundation

## Goal

Remove the production `local_fixture` project setup runtime and the runtime
selector that made fixture-derived policies look like real agent SDK output.
Project guide sufficiency and submission artifact policy derivation now run
through the OpenAI Agents SDK runtime. Tests may use explicit test-local fakes,
but production code must not expose a no-network fixture adapter.

## Why This Chunk Exists

The Terminal Benchmark live API drill proved the lifecycle plumbing, but it also
showed that a fixture runtime can confuse the real product question: whether the
agent SDK can derive a project-specific `SubmissionArtifactPolicy` from the full
project guide. Workstream should fail closed when the real agent runtime is not
configured instead of silently producing generic fixture policy.

## Risk Class

L1

## Allowed Files

```text
backend/app/core/config.py
backend/app/adapters/project_agents/**
backend/tests/test_projects.py
backend/tests/test_config.py
README.md
examples/terminal_benchmark/**
.agent-loop/LOOP_STATE.md
.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/STATUS.md
.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/CHUNK_MAP.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-*
```

## Not Allowed

```text
backend/app/modules/tasks/**
backend/app/modules/checkers/**
backend/app/modules/projects/** except project-agent adapter imports if needed
backend/alembic/**
.github/workflows/**
demos/** except README command wording if directly impacted
frontend/**
payment/reputation/blockchain code
object-storage implementation
new agent runtime provider implementation
production secrets or committed .env files
```

## Acceptance Criteria

- Production project setup has no `local_fixture` runtime adapter.
- `WORKSTREAM_PROJECT_AGENT_RUNTIME_ADAPTER` is removed from active code and
current operator docs.
- The project-agent runtime factory builds the OpenAI Agents SDK runtime and
fails closed when the required model setting is missing.
- Tests use explicit test-local fakes for deterministic project-agent behavior;
no production fixture adapter is imported by test setup routes.
- Terminal Benchmark example docs and script no longer refer to the removed
runtime selector.
- README explains that automatic project setup needs OpenAI Agents SDK model and
API-key settings.
- Temporary Week 1 demo startup does not enable setup autostart without the
required OpenAI worker configuration.
- Stale wording scan, Markdown link check, ruff, focused project-agent tests,
docstring coverage, and diff whitespace checks pass.

## Verification Commands

```bash
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_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 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/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
```

## Required Internal Reviewers

- senior engineering
- QA/test
- security/auth
- product/ops
- architecture
- docs
- reuse/dedup
- test delta

## Human Review Focus

- The removed fixture path cannot be used as a production project setup runtime.
- Test fakes are visibly test-local and cannot be mistaken for agent SDK output.
- Operator docs do not mention a removed runtime selector or imply fallback
behavior.
- Workstream still keeps the project-agent port so future runtimes can be added
deliberately in a separate chunk.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# External Review Response: WS-POL-001-09

## Scope

External review feedback for PR #71: `Remove fixture project agent runtime`.

Internal sub-agent evidence is tracked separately in:

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

## CodeRabbit Review

CodeRabbit completed review on 2026-07-06 and reported one nitpick.

| Source | Finding | Severity | Status | Response |
|---|---|---:|---|---|
| CodeRabbit | Repeated deterministic project-agent runtime monkeypatch boilerplate in `backend/tests/test_projects.py`. | Trivial | Fixed | Added the test-local `deterministic_project_agent_runtime` fixture and replaced repeated deterministic monkeypatch blocks. Custom failing/spoofing/capturing runtime patches remain local because they test different behaviors. |

## Verification

```bash
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_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 source_snapshot_integrity_accepts_v1_manifest_without_content_excerpt or sufficiency_agent_blocks_thin_guides or derivation_agent_allows_warning_report_without_acknowledgement_and_is_idempotent or agent_derived_warning_policy_requires_acknowledgement_before_approval or derivation_agent_validates_existing_policy_integrity_before_reuse or agent_derived_submission_artifact_policy_body_is_immutable' -q
python3 scripts/check_stale_workstream_wording.py
python3 scripts/check_markdown_links.py
git diff --check
```

Results:

- ruff: passed.
- Focused post-CodeRabbit pytest slice: 11 passed, 188 deselected.
- Stale wording scan: passed.
- Markdown link check: passed for 9 changed Markdown files.
- Diff whitespace check: passed.

## Remaining External State

GitHub Actions and CodeRabbit must rerun after this response and fix are pushed.
Loading
Loading