Milestone 12 — Harness² adaptation and learning
State
Implementation PR #35 (https://github.com/miguelenes/harnessa-v1/pull/35) merged to main as 1c23b14c64527b576bc7528f8798c4fd697250a2. The final independent exact-head review covered 81d9ee2a642b76032520be22702e84bf7988dc58 against base 4b9df7953155801e6508be5d22e63415397f666b and found no new actionable issues (review disposition). The preceding exact-head review found a race where a passing receipt could be used after its persistence fence rejected it. The worker now downgrades rejected persistence to unknown, and cancellation takes precedence over any non-cancelled terminal state; a regression test covers receipt rejection. Follow-up acceptance PR #41 merged as 0762cf88bade77590cc18eb6403e7dad06bc54ab from reviewed head b39bfe0e8d4ca3ed3dac232d74635ac341defdb8. Fresh exact-head Standards and Spec reviews found no actionable issues (standards disposition, spec disposition); no formal approval was submitted because approval is optional. Local CI and CodeQL passed on the final head; documentation build passed and deployment was skipped by workflow conditions. All review threads were resolved. Acceptance evidence was completed with an authorized provider-backed run, a separately executed local holdout grader, and a second route diagnostic. No improvement is claimed: the accepted evidence run failed its baseline, so its candidate/composed outputs do not form a valid matched comparison. The prompt is archived unchanged after the accepted implementation and evidence merge. The pinned upstream integration, compatibility boundary, durable records, scoped APIs, candidate experience lifecycle, Harness Studio projection and deterministic offline checks are implemented.
Implementation evidence
- Upstream Harness² is pinned at
1cfe254e8d25b15f37048c3730134686abe60335under Apache-2.0, with eight upstream component categories mapped through a product manifest. - Five additive database tables store fixed project policy, task experiments, probe evidence references, scoped candidate experiences and append-only promotion/rollback decisions.
- Probe model calls use Harnessa's task/project budgeted probe pool and idempotency key. Candidate edits are validated against upstream's OpenCode surface, bounded, isolated beneath a candidate workspace, and checked for path escapes and named host-policy edits. Holdout-shaped context is rejected before dispatch.
- The ACP prompt now places repository and candidate harness guidance before a final immutable host-policy reminder; the added ACP regression test verifies the ordering and prohibited operations.
- Project API operations require membership; experiment creation requires an operator, HARNESS_PROBE task and ready frozen specification. Promotion and rollback require an administrator and the exact reviewed digest. Post-merge learning only produces an expiring
candidateexperience from a successful experiment and explicit evidence refs. - Harness Studio reads the authorized project manifest, experiment history, probe diffs and experience evidence and offers reviewed promotion/rollback actions.
HarnessExperimentWorkerclaims and heartbeats durable rows, recovers stale claims under a new fence, and dispatches matched baseline/candidate runs through the existing ACP adapter on the probe pool. It re-executes the selected final harness as composed evidence, stores bounded behavior-shape traces and run outcomes, attributes model requests to task/run budgets, and fences cancellation/policy drift. Before any sandbox/model dispatch, it scans the exact frozen Git tree and fails closed on holdout, hidden, answer, grader or rubric paths; ACP unavailable leaves queue rows queued. A live post-failure trace showed that an incomplete baseline could be selected for holdout grading; the worker now recordsnot_runwithcomposed_artifact_unavailableand persists it without calling the grader. Focused tests cover that fence alongside loop ownership, safe trace capture, unique bounded evidence labels, selected-harness re-execution, missing-composition failure, restricted-source rejection and queue preservation when ACP is unavailable.- After CAS artifacts are committed, the worker creates a frozen holdout manifest of task/base/spec/policy/harness identity and artifact references, then invokes the injected
HarnessEvaluator. Raw receipts are stored by content address; only status, judge revision and receipt digests are attached to the experiment. Grader feedback and scores are not copied into probe traces or agent context. The acceptance evaluator is a local HTTP process (local-holdout-v1:ed22ac26a00f686d2c2c) with a private synthetic model-cost holdout file and bearer-authenticated/evaluateendpoint; the OpenCode worker receives only the pass/fail receipt. The process and file are permission-isolated from the agent container, but are operated on the same host; no third-party evaluator account or external benchmark dataset is claimed. This setup is sufficient for the project’s small synthetic acceptance task and does not establish independent institutional evaluation. - The final review found the post-merge learning hook was hardcoded off; this was fixed on the branch and independently re-reviewed. A subsequent finding that verification feedback could follow the host-policy reminder was fixed in
dddb1d5, tested, independently re-reviewed, and its review thread resolved.
Verification
uv run ruff check apps/api tests scripts: passed.uv run mypy --strict --follow-imports=silent apps/api/harnessa: passed, 74 source files.pnpm typecheck: passed across web, API, contracts, React and Svelte design system.cd apps/api && uv run alembic heads:52c0a42de71f;uv run alembic upgrade head --sqlpassed, generating SQL for the five additive tables and worker heartbeat column.pnpm testwith disposable PostgreSQL 16.13 and Redis 8.10.2 services: 292 API unit tests passed, 70 integration tests passed, 1 skipped, and all web (30), cloud portal (2), marketing build/artifact, and coverage gates passed. API line/statement coverage was 85.11%; aggregate line coverage was 85.43% and statement coverage was 85.31%. The first full integration attempt had one transient websocketconnection_lost()failure; the isolated test and complete rerun passed.- Focused worker/Harness² adapter tests: 34 passed; worker integration tests: 5 passed, including experiment queueing, overview serialization, exact-digest promotion, rollback, stale-claim recovery, matched probe evidence, post-persistence holdout receipt redaction, unconfigured-grader blocking and evaluator timeout handling.
git diff --check: passed.pnpm --filter @harnessa/web typecheck,lint, andbuild: passed.- Follow-up focused checks:
uv run mypy --strict --follow-imports=silent apps/api/harnessapassed (75 files);uv run ruff check apps/api testsandgit diff --checkpassed; 71 focused ACP, sandbox, evaluator, Harness² and experiment-worker tests passed after updating evaluator fixtures to require a completed composition. - Hosted required checks passed on reviewed head
81d9ee2a642b76032520be22702e84bf7988dc58: Local CI (push and pull-request runs), CodeQL, and review-thread resolution. Documentation build passed; deployment was skipped by workflow conditions. Branch protection remained unchanged, with approval optional and required checks enforced. - Gateway follow-up on 2026-10-23: configured the existing pinned LiteLLM Proxy (
v1.83.14-stable.patch.3) withharnessa-deepseek-flashandharnessa-openrouter-deepseek-flash, keeping both provider keys confined to the LiteLLM service. The OpenRouter alias pins the DeepSeek provider and disables provider fallback; LiteLLM retries and fallback deployments remain off. The local Compose service reached healthy state,/health/readinessreturned 200, and/v1/modelslisted both aliases. A separate startup check with both provider variables empty also reached readiness 200, preserving credential-free startup. The ignored local.envhas mode0600. No provider credential validation or model request was performed. - A credential-free configuration contract test parses
infra/litellm/config.yamland asserts both aliases, their provider and key references, OpenRouter provider pinning, disabled proxy retries/fallbacks, and disabled message logging.uv run pytest tests/test_litellm_config.py -qpassed (2 tests);uv run ruff check tests/test_litellm_config.pyandgit diff --checkpassed. The test does not contact either provider. - Gateway setup follow-up PR #38 merged as
eec2d6d174b1b8b5c2cc34c0f63554505381c52d; its reviewed final head wasa800d6cc89b247953779cce2b3e6b2350c5f2040against base3712d51a9841da840c3262652d1ecd5014006add. The exact-head independent spec disposition found no issues (review comment); the earlier standards advisory to share YAML loading was fixed before that final review. Required Local CI, CodeQL, and review-thread resolution passed; the documentation build passed and deployment was skipped by workflow conditions. No formal approval was submitted; approval remains optional underProtect main. - Live provider-backed acceptance experiment
4dc026c7-ac2a-42f6-91ed-ed885991603bused frozen taskb3c91f9f-1dae-479b-96d8-8fa06d84fe62, baseee7e41d0df0e901816ac94ea372feafd10a4a8ef, Harness²1cfe254e8d25b15f37048c3730134686abe60335, OpenCode2.0.32@sha256:85986f556e985e377bd24cd68a5ccfbc647bb49e591194edda8a0e4542303319, andharnessa-deepseek-flash. The durable manifest638085f07435a72088d60bca1f5d6f7d04117f0b04bf9dff7d64590b9739125drecords a failed baseline, one failed and two delivered candidates, and delivered composed execution. The local holdout receipt passed (86f65cd71335aa0974faabd778e6a3914be9f2c1df1dda970a69644e6346e366). Current comparison-integrity logic rejects a gain because the baseline and selected final candidate were not both valid delivered rollouts; the earlier terminalsucceededstatus predates that integrity gate and is not accepted as proof of a matched comparison. - Follow-up direct-route experiment
1c9bef1b-43ef-41d8-9d75-c5860b57ab92likewise recorded baseline/candidate/composed artifacts and a passing local receipt, but current integrity validation identifiesbaseline_rollout_missing_or_failed. No gains are asserted. OpenRouter diagnostic experiment3c118b70-7212-4e28-b0db-b2f29c03e245used the same frozen task andharnessa-openrouter-deepseek-flash; it recorded 21,266 adaptation tokens and estimated$0.01014180for two adaptation requests, but endedblockedbefore a delivered composition because the upstream proposer returned a non-text response. Its old worker process reportedevaluator_error_RuntimeErrorfor an incomplete composition; the current implementation avoids that call and reportsnot_run. - The project model ledger at report time showed
$0.02227500billed,$1.06263552estimated, 2,891,225 input tokens, 145,723 output tokens, two requests with unknown usage and no pending reservations. The existing policy remained$25project/task,$5per run, 5,000,000 project/task tokens, 1,000,000 run tokens, 500 steps, 3,600 seconds and 4,096 output tokens. The user supplied no additional maximum spend; existing product-level guardrails were retained. Provider keys were sourced by name from~/.zshrcand remained confined to LiteLLM; values were not logged or committed.
Remaining release evidence
The local grader validates a private synthetic acceptance suite and the receipt-isolation contract; it is not a third-party benchmark or independent institutional evaluator. The provider-backed run recorded outcomes and provenance but did not validate a matched gain, and the OpenRouter diagnostic was blocked on a non-text adaptation response. Promotion remains unavailable without a valid baseline/final-candidate comparison plus matching receipt and fixed regression/security/cost gates. The task is routed through Harnessa's budgeted LiteLLM gateway; no provider fallback or proxy retry is enabled. M12 was completed and archived after PR #41's exact-head reviews, required checks, and protected merge. M13 is the next milestone and is active in the planning index.