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
33 changes: 17 additions & 16 deletions .agent-loop/LOOP_STATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

## Current State

- Active initiative: `WS-POL-001` - Submission Artifact Policy Foundation
- Active planning chunk: none
- Active implementation chunk: `WS-POL-001-16` - Terminal Benchmark Live API Drill
- Branch: `codex/ws-pol-001-16-terminal-benchmark-live-api-drill`
- Status: `WS-POL-001-16` completed the final clean Terminal Benchmark live API
drill through real HTTP-visible APIs. The accepted run used sanitized source
material, automatic project setup, live `submission-requirements`-derived
worker packets, blocked pre-submit no-side-effect proof, successful
submission finalization, durable checker-run visibility, and final
`review_pending` task state without database inspection as lifecycle proof.
- Last merged implementation SHA: `b72a5b9`
- Last merge commit: `b1a9851`
- Current gate: PR creation and human checkpoint for `WS-POL-001-16`; internal
reviewer fanout and evidence gate are complete.
- Next chunk: inactive until this chunk is reviewed, merged, and followed by a
post-merge memory update.
- Active initiative: `WS-POL-002` - Post-Submit Checker Foundation
- Active planning chunk: `WS-POL-002-PLAN` - Post-submit checker foundation planning
- Active implementation chunk: none
- Branch: `codex/ws-pol-002-post-submit-checker-planning`
- Status: `WS-POL-001-16` merged through PR #84. Planning has started for
`WS-POL-002`, which will make post-submit checker setup follow the same
project-guide-derived, compiler-validated, deterministic shape as the
pre-submit checker pipeline.
- Last merged implementation SHA: `be2d5ec`
- Last merge commit: `a3d2a3f`
- Current gate: planning/specification for `WS-POL-002`; no implementation
chunk is active.
- Next chunk: `WS-POL-002-01` is proposed only and inactive until the
planning PR is reviewed and the user gives an explicit start signal.

## Operating Rule

Expand Down Expand Up @@ -128,3 +126,6 @@ blockchain, frontend, or agent-runtime behavior.
- `WS-POL-001-13` PR trust bundle is tracked at `.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-13-pr-trust-bundle.md`.
- PR #79 merged into `main` as `53a57c3`; it implemented `WS-POL-001-14`
submission finalization and HTTP-visible Terminal Benchmark proof semantics.
- PR #84 merged into `main` as `a3d2a3f`; it implemented `WS-POL-001-16`
Terminal Benchmark live API drill evidence, privacy scrub, and a professional
PDF report proving the current lifecycle through HTTP-visible APIs.
32 changes: 32 additions & 0 deletions .agent-loop/REVIEW_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,35 @@ description warning was fixed before merge.

Next gate: no active implementation chunk. Wait for the user's next explicit
chunk start signal.

## 2026-07-09 - WS-POL-001-16 Merged

PR #84 merged into `main` as `a3d2a3f1701391c8dafdca6cff2f0f80dbebda3b`.

Reviewed revision: `49101d4ad3fc22ec6e6065b1e593ef04145db953`.

Required reviewer tracks:

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

Result: PASS after internal review and privacy-scrub fixes. Agent Gates,
Backend, Week 1 API Demo UI, and external review passed before merge.

Scope: Terminal Benchmark live API drill evidence, privacy scrub, professional
PDF report, setup/policy/task/submission/checker-run lifecycle proof through
HTTP-visible APIs, and no database inspection as proof.

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

Trust bundle: `.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-16-pr-trust-bundle.md`

Next gate: `WS-POL-002` planning for post-submit checker foundation. No
implementation chunk is active until the user explicitly starts it.
8 changes: 5 additions & 3 deletions .agent-loop/WORK_QUEUE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Chunk | Title | Risk | Status |
|---|---|---:|---|
| `WS-POL-001-16` | Terminal Benchmark Live API Drill | L1 | Active on `codex/ws-pol-001-16-terminal-benchmark-live-api-drill` |
| `WS-POL-002-PLAN` | Post-Submit Checker Foundation Planning | L1 | Active on `codex/ws-pol-002-post-submit-checker-planning` |

## Completed

Expand All @@ -28,11 +28,13 @@
| `WS-POL-001-13` | Task Context And Submission Requirement APIs | L1 | Merged through PR #77 as `b567bac` on 2026-07-08 |
| `WS-POL-001-14` | Submission Finalize And No-DB Terminal Benchmark Proof | L1 | Merged through PR #79 as `53a57c3` on 2026-07-08 |
| `WS-POL-001-15` | Agent Derivation Policy Conflict Hardening | L1 | Merged through PR #81 as `b1a9851` on 2026-07-08 |
| `WS-POL-001-16` | Terminal Benchmark Live API Drill | L1 | Merged through PR #84 as `a3d2a3f` on 2026-07-09 |

## Proposed Next

Stop after `WS-POL-001-16` is implemented, reviewed, and opened for human
review. Do not start another implementation chunk from this branch.
Stop after `WS-POL-002-PLAN` is reviewed. Do not start `WS-POL-002-01` until
the planning PR is merged and the user explicitly starts the implementation
chunk.

## Blocked

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Current Status

`WS-POL-001-01` through `WS-POL-001-15` are merged to `main`.
`WS-POL-001-01` through `WS-POL-001-16` are merged to `main`.
`WS-POL-001-16` completed the final clean Terminal Benchmark live API drill
through real HTTP calls, using sanitized source material and a worker packet
derived from the live `submission-requirements` response. Evidence is recorded
and internal reviewer fanout is complete. The branch is ready for PR/human
checkpoint.
derived from the live `submission-requirements` response. Evidence is recorded,
reviewed, privacy-scrubbed, rendered as a professional PDF report, and merged
through PR #84.
`WS-POL-001-14` replaced public submission lock wording with finalization,
defined system actor audit semantics, and merged PR #79's HTTP-visible Terminal
Benchmark proof evidence. The accepted post-merge no-DB Terminal Benchmark
Expand All @@ -17,7 +17,7 @@ reran that accepted drill successfully before merging through PR #81.

## Active Chunk

`WS-POL-001-16` - Terminal Benchmark Live API Drill.
None. `WS-POL-001` is complete through `WS-POL-001-16`.

## Chunk Status

Expand All @@ -38,7 +38,7 @@ reran that accepted drill successfully before merging through PR #81.
| `WS-POL-001-13` | Merged | `codex/ws-pol-001-13-task-context-apis` | 77 | Adds task work-context, worker submission-requirements, and operator-only locked-context APIs. |
| `WS-POL-001-14` | Merged | `codex/ws-pol-001-14-submission-finalize` | 79 | Replaces public submission lock with finalize, defines system actor audit semantics, scopes operator visibility, and proves the Terminal Benchmark flow through HTTP-visible lifecycle responses. |
| `WS-POL-001-15` | Merged | `codex/ws-pol-001-15-agent-derivation-hardening` | 81 | Hardens agent-derived submission artifact policy instructions after the no-DB Terminal Benchmark drill exposed a required-artifact/forbidden-pattern self-conflict. |
| `WS-POL-001-16` | Internal review complete | `codex/ws-pol-001-16-terminal-benchmark-live-api-drill` | - | Proved a human-visible Terminal Benchmark drill through real HTTP APIs without DB inspection as lifecycle proof; PR/human checkpoint is pending. |
| `WS-POL-001-16` | Merged | `codex/ws-pol-001-16-terminal-benchmark-live-api-drill` | 84 | Proved a human-visible Terminal Benchmark drill through real HTTP APIs without DB inspection as lifecycle proof; merged as `a3d2a3f`. |

## Blockers

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Chunk Map: WS-POL-002 - Post-Submit Checker Foundation

## Rule

Only one chunk may be active at a time. Do not start the next chunk until the
current chunk is implemented, verified, internally reviewed, externally
reviewed, merged by explicit human approval, and followed by a memory update.

## Chunks

| Chunk | Title | Risk | Status |
|---|---|---:|---|
| `WS-POL-002-01` | Post-Submit Provenance And Compiler Contract | L1 | Proposed |
| `WS-POL-002-02` | Post-Submit Derivation Agent And Resumable Setup Integration | L1 | Proposed |
| `WS-POL-002-03` | Server-Owned Policy Approval And Visibility APIs | L1 | Proposed |
| `WS-POL-002-04` | Locked Runtime Execution And Routing Hardening | L1 | Proposed |
| `WS-POL-002-05` | Terminal Benchmark Post-Submit Live API Proof | L1 | Proposed |

## Dependency Order

```text
WS-POL-002-01
-> WS-POL-002-02
-> WS-POL-002-03
-> WS-POL-002-04
-> WS-POL-002-05
```

## Stop Condition

After this planning chunk is reviewed, stop. The first implementation chunk is
inactive until the user explicitly starts `WS-POL-002-01`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Decisions: WS-POL-002 - Post-Submit Checker Foundation

## D1. Post-Submit Policy Is Project-Scoped

`PostSubmitCheckerPolicy` remains attached to the project guide/source snapshot
context. Tasks lock the applicable project policy. Tasks do not derive,
compile, or own unique post-submit checker policies.

## D2. Agent Derivation Happens During Setup Only

The post-submit policy derivation agent runs during project setup. It receives
locked guide/source material plus relevant project policy context and emits a
constrained checker specification.

The agent does not evaluate worker submissions.

## D3. Runtime Is Deterministic

Runtime post-submit evaluation executes Workstream-registered deterministic
checkers only. v0.1 does not allow arbitrary generated checker code as the
default path.

## D4. Defaults Cannot Be Weakened

The default durable post-submit checkers always run. Project-specific policy may
add registered checkers or tighten routing/severity, but it cannot remove
default checks or downgrade their required coverage.

## D5. Unsupported Required Checks Block Setup

If the project guide implies a required post-submit check that cannot be
represented by registered deterministic checker primitives, setup must surface a
clear blocking gap. Workstream must not silently ignore it or pretend the
project is fully protected.

## D6. Manual Guide Payload Is Obsolete

The long-term contract removes client-authored `post_submit_checker_policy`
from guide create/update request bodies. Workstream owns generated post-submit
policy setup and approval. No backward compatibility alias should be added once
the server-owned path replaces the manual payload.

## D7. Worker-Facing Outcomes Stay Simple

Post-submit checker failure that the worker can fix routes to `needs_revision`.
Internal setup defects and trusted checker failures stay in internal repair
routes and are hidden from worker-facing checker results.

## D8. Evidence Must Be API-Visible

The final proof must use API-visible setup runs, generated policy outputs,
task locked context, submission finalization, checker runs, audit events, and
task status. Database inspection is not accepted as lifecycle proof.
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Discovery: WS-POL-002 - Post-Submit Checker Foundation

## Current Code Path

The backend already has a durable post-submit checker gate.

Current runtime chain:

```text
Submission finalization
-> task status evaluation_pending
-> CheckerService.run_submission_checkers
-> locked PostSubmitCheckerPolicy id/version/hash/body validation
-> registered deterministic checker execution
-> durable CheckerRun and CheckerResult rows
-> review_pending | needs_revision | internal blocked/retry route
```

Key files discovered:

- `backend/app/modules/projects/post_submit_policy.py`
- `backend/app/modules/projects/models.py`
- `backend/app/modules/projects/service.py`
- `backend/app/modules/tasks/service.py`
- `backend/app/modules/tasks/models.py`
- `backend/app/modules/checkers/runner.py`
- `backend/app/modules/checkers/service.py`
- `backend/app/modules/checkers/models.py`
- `backend/tests/test_checkers.py`

## Current Default Post-Submit Checkers

`DEFAULT_DURABLE_CHECKERS` currently contains:

- `check_submission_packet`
- `check_policy_context_present`
- `check_evidence_present`
- `check_evidence_integrity`
- `check_required_files`
- `check_forbidden_files`
- `check_confidentiality_attestation`
- `check_low_quality_generated_artifacts`

The checker registry also includes `check_acceptance_criteria_present`, which
is a setup/readiness checker and is not part of the default durable list unless
a policy requires it.

## Current Policy Shape

`PostSubmitCheckerPolicy` is stored in the physical `checker_policies` table
and is attached to a project guide version.

Current canonical body fields:

- `schema_version`
- `project_id`
- `guide_version`
- `default_checkers`
- `required_checkers`
- `warning_checkers`
- `execution_checkers`
- `blocking_severities`

The policy hash is a canonical JSON hash of the policy body.

Task screening locks:

- post-submit checker policy id
- post-submit checker policy version
- post-submit checker policy hash
- post-submit checker policy body

Submissions copy that locked policy context from the task.

Checker runs copy the locked policy context from the submission.

## What Is Already Correct

- Post-submit checker runtime is separated from pre-submit intake.
- Pre-submit failures prevent submission creation.
- Post-submit failures happen after finalization and create durable checker
evidence.
- The persisted post-submit evaluation status is `evaluation_pending`.
- Successful gate results route to `review_pending`.
- Worker-fixable checker failures route to `needs_revision`.
- Internal setup defects and trusted checker infrastructure failures can stay
hidden from workers.
- Task/submission/checker-run provenance is locked to the post-submit policy
id/version/hash/body.
- Guide activation already validates that a post-submit checker policy exists,
hashes correctly, and references registered checkers.

## Gaps

The missing part is setup-time policy generation and approval.

Current gaps:

- `ProjectGuideCreate` and `ProjectGuideUpdate` still accept manual
`post_submit_checker_policy` input.
- There is no `PostSubmitCheckerPolicyDerivationAgent`.
- There is no post-submit policy compiler equivalent to the pre-submit compiler
contract.
- Project-specific post-submit checker choices are not derived from the guide
source material.
- Unsupported project-specific checker needs are not represented as explicit
setup blockers.
- Policy visibility exists through downstream locked-context/checker-run
responses, but setup visibility for generated post-submit policy derivation is
not yet first-class.
- The Terminal Benchmark live API drill proves current post-submit execution,
not derived post-submit policy setup.

## Constraints From Existing Architecture

- Post-submit policy must remain project-scoped.
- Task-specific checker generation is explicitly rejected.
- Default Workstream checkers cannot be weakened.
- Runtime must use deterministic checkers, not an agent.
- Celery is the correct setup/job boundary for long-running derivation work.
- The Flow authentication boundary remains external; Workstream only verifies
tokens and uses local actor/profile records for product authorization.
- No backward compatibility layer should preserve obsolete request fields once
the new path exists.

## Implementation Implication

WS-POL-002 should not redesign the runtime gate from scratch. It should extend
the project setup pipeline so post-submit policy is derived, compiled, approved,
locked, visible, and proven with APIs the same way pre-submit policy now is.
Loading
Loading