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
85 changes: 85 additions & 0 deletions .github/workflows/agent-evals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Coding task evaluations

# First stage of #2085. Candidate results only. No baseline promotion or publishing.
# Trust boundaries: docs/architecture/tla/EvalWorkflow.tla.
on:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: agent-evals
cancel-in-progress: false

jobs:
evaluate:
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 120
environment: final-vscode-review-smoke
steps:
- name: Checkout exact approved revision
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false

- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-pnpm
with:
install-args: "--frozen-lockfile"

- name: Install display dependencies
timeout-minutes: 5
run: sudo apt-get update && sudo apt-get install -y xvfb libasound2t64

- name: Prepare trust policy
env:
CANDIDATE_SHA: ${{ github.sha }}
TRUST_FILE: ${{ runner.temp }}/agent-evals-trust.json
run: |
set -euo pipefail
docker info > /dev/null
node --import tsx --input-type=module -e '
import { safeWriteJson } from "./src/utils/safeWriteJson.ts";
const sha = process.env.CANDIDATE_SHA;
if (!/^[0-9a-f]{40}$/.test(sha ?? "")) throw new Error("Invalid candidate SHA");
await safeWriteJson(process.env.TRUST_FILE, { version: 1, approvedCommits: [sha] });
'

# The side builds its own isolated worktree. Do not build a second copy here.
- name: Evaluate candidate
id: candidate
timeout-minutes: 105
env:
SOLHEIM_API_KEY: ${{ secrets.FINAL_SMOKE_OPENAI_API_KEY }}
CODING_EVALS_SIDE: candidate
CANDIDATE_SHA: ${{ github.sha }}
TRUST_FILE: ${{ runner.temp }}/agent-evals-trust.json
EVAL_OUT: ${{ runner.temp }}/agent-evals
run: |
set -euo pipefail
test "$(git rev-parse HEAD)" = "$CANDIDATE_SHA"
test -z "$(git status --porcelain --untracked-files=all)"
xvfb-run -a -s "-screen 0 1280x720x24 -nolisten tcp" \
pnpm coding-evals:side --trust-file "$TRUST_FILE" --out "$EVAL_OUT"

- name: Write candidate summary
if: ${{ !cancelled() && (steps.candidate.outcome == 'success' || steps.candidate.outcome == 'failure') }}
env:
CANDIDATE_SHA: ${{ github.sha }}
EVAL_OUT: ${{ runner.temp }}/agent-evals
run: node --import tsx scripts/agent-evals/coding-summary.mts

- name: Upload candidate results and traces
if: ${{ !cancelled() && (steps.candidate.outcome == 'success' || steps.candidate.outcome == 'failure') }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: agent-evals-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/agent-evals/side-results.json
${{ runner.temp }}/agent-evals/candidate-report.md
${{ runner.temp }}/agent-evals/artifacts
if-no-files-found: error
retention-days: 90
2 changes: 2 additions & 0 deletions .github/workflows/code-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ jobs:
run: pnpm solheim-smoke:check-types
- name: Test agent evals units
run: pnpm test:agent-evals:unit
- name: Validate coding evaluation workflow
run: node --test scripts/agent-evals-workflow.test.mjs
- name: Check agent evals types
run: pnpm agent-evals:check-types
- name: Model-check task lifecycle protocols
Expand Down
2 changes: 2 additions & 0 deletions docs/architecture/tla/EvalComparisonInputs.NoCheckKeys.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions docs/architecture/tla/EvalComparisonInputs.NoCheckOutcomes.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/architecture/tla/EvalComparisonInputs.NoCheckTimer.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/architecture/tla/EvalComparisonInputs.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 34 additions & 46 deletions docs/architecture/tla/EvalComparisonInputs.tla
Original file line number Diff line number Diff line change
@@ -1,53 +1,39 @@
---- MODULE EvalComparisonInputs ----
\* Source: codingRepetitionPlan supplies execution and validation keys.
\* Source: CLI minutes and side-results.json. Sink: timer and positional pairs.
\* Failures: a large timer runs at 1 ms; partial keys shift positional pairs.
\* Invariants: TimerSafe and KeysComplete forbid these failures.
\* Expect: old guards fail both checks. These invariants follow the review.
\* PR 2154 threads: discussion_r4624089802 and discussion_r4624089824.
\* Review: 0 covered, 2 added, 0 gap. Parsing and metric content are oracles.
\* Scope: each integer key stands for one fixture and repetition pair.
\* Property: coding-report.test.ts and coding-compare-script.test.ts.
\* Result: fixed passes in 640 states. No new code bug was found.
\* Control: NoCheckKeys fails KeysComplete; NoCheckTimer fails TimerSafe.
\* Replay: Missing keys and 35792 minutes fail on HEAD and pass with the fixes.
\* Cost: this review took about 12 agent minutes total. Each TLC run took under 1 second.
\* Gate: 401 eval tests, eval type check, and shared ESLint pass.
\* Run each EvalComparisonInputs config with EvalComparisonInputsMC on each fix commit.
\* Refactor: one code plan replaces two copies. Expect no new model failure.
\* Result: all input checks keep their prior results. No new code bug was found.
\* Property: coding-fixtures.test.ts checks literal names, versions, order, and fresh entries.
\* Sabotage: omit one fixture from the shared plan. The independent code test fails.
\* Restored plan passes. The plan builder is outside the input model.
\* Cost: the simplification took about 3 agent minutes across these models.
\* Source: side-results.json metrics. Sink: paired deltas, cost and outcome rows.
\* Failure: a null duration reads as zero and shows as a speedup.
\* Invariant: ValuesSafe accepts only well-formed values. It follows review.
\* PR 2154 discussion_r4719753641. Review: 0 covered, 1 added, 0 gap.
\* Expect: the old validator fails ValuesSafe. No new bug is expected.
\* Result: fixed passes in 696 states. NoCheckValues accepts a null duration.
\* Replay: the null duration test fails on the old validator and passes now.
\* Findings: no new code bug was found by TLC. No false alarm was found.
\* Property: coding-report.test.ts checks bad kinds for each report metric.
\* Gate: 408 eval tests, eval type check, and shared ESLint pass.
\* Lint: src ESLint excludes scripts. Suppression counts did not change.
\* Cost: about 10 agent minutes for both fixes. Each TLC run took under 1 second.
\* PR 2154 discussion_r4725130159: the test helper kept an absent duration.
\* Review: 0 covered, 0 added, 1 gap. This model cannot check test fixture creation.
\* Source: coding-report.test.ts check helper. Sink: validateSideResultFile.
\* Expect: no model change. ValueOk already permits an absent duration.
\* Property: serialize the whole fixture, then assert that durationMs is absent.
\* Sabotage: the old helper fails the absence assertion. The fixed helper passes.
\* Result: fixed passes in 696 states. All three controls fail their invariants.
\* Findings: no new code bug or false alarm was found. No model state was added.
\* Gate: 410 eval tests, eval and extension type checks, and shared ESLint pass.
\* Cost: shared with the EvalComparisonRelease review, about 10 agent minutes.
\* Source: codingRepetitionPlan, CLI minutes, and side-results.json.
\* Sink: timers, paired report values, and candidate summary outcomes.
\* Failures: timer overflow, incomplete keys, invalid metric values, or inconsistent outcomes.
\* Invariants: TimerSafe, KeysComplete, ValuesSafe, and OutcomesAgree.
\* Scope: parsing and metric content are oracles. Integer keys stand for fixture/repetition pairs.
\* Expect: shared validation holds; removing each check violates its invariant.
\* Stance: review findings preceded their invariants. Outcome agreement follows the simplification request.
\* Review total: 0 covered, 3 added, 1 gap.
\* PR 2154: discussion_r4624089802, discussion_r4624089824, and discussion_r4719753641 added checks.
\* PR 2154: discussion_r4725130159 is a gap; this model cannot check test fixture construction.
\* Replay: incomplete keys, 35792 minutes, and null duration fail with the fixed validator.
\* Replay: the corrected JSON fixture helper preserves absent duration; the old helper fails its assertion.
\* Property: coding-report.test.ts checks input kinds, key sets, and baseline/candidate outcome agreement.
\* Property: coding-compare-script.test.ts checks CLI timer bounds.
\* Property: coding-fixtures.test.ts checks literal plan entries independently of the builder.
\* Refactor: move outcome agreement from coding-summary.mts to validateSideResultFile.
\* Summary behavior stays the same. Comparison now rejects inconsistent record and metric outcomes.
\* Expect: NoCheckOutcomes fails; valid outcomes remain accepted for both side labels.
\* Prior result: base passed in 696 states. All three original controls failed their invariants.
\* Prior findings: no additional code bug or false alarm was found by TLC.
\* Prior gate: 410 evaluation tests, both type checks, and applicable lint passed.
\* Prior cost: about 35 agent minutes, including shared review work.
\* Run: TLA_JAR=<jar> docs/architecture/tla/check.sh EvalComparisonInputs.
\* This model does not prove the implementation correct.
\* Result: base passes in 708 states. All four negative controls fail their invariants.
\* Replay: both side-label tests fail on the old validator and pass with shared outcome validation.
\* Findings: the old comparison accepted inconsistent outcomes. No additional model defect was found.
\* Gate: 426 evaluation tests, 33 workflow tests, both type checks, and applicable lint pass.
\* Cost: about 9 additional agent minutes shared across this simplification.
EXTENDS Naturals, Sequences, FiniteSets
CONSTANTS Inputs, Minutes, ExpectedKeys, CheckKeys, CheckTimer, CheckValues
CONSTANTS Inputs, Minutes, ExpectedKeys, CheckKeys, CheckTimer, CheckValues, CheckOutcomes
VARIABLES keys, agrees, minutes, metric, result
vars == <<keys, agrees, minutes, metric, result>>
\* A metric is one field that the report reads, and the kind of its JSON value.
Metrics == {"duration", "usd", "outcome"} \X {"valid", "absent", "null", "wrongType", "outOfRange"}
Metrics == {"duration", "usd", "outcome"} \X {"valid", "absent", "null", "wrongType", "outOfRange", "mismatched"}
ValueOk == metric[2] = "valid" \/ metric = <<"duration", "absent">>
KeySet == {keys[i] : i \in DOMAIN keys}
Complete == KeySet = ExpectedKeys /\ Len(keys) = Cardinality(ExpectedKeys) /\ agrees
Expand All @@ -58,12 +44,14 @@ Init == /\ keys \in Inputs /\ agrees \in BOOLEAN /\ minutes \in Minutes
/\ result = "pending"
Validate == /\ result = "pending"
/\ result' = IF (~CheckKeys \/ Complete) /\ (~CheckTimer \/ minutes <= 35791)
/\ (~CheckValues \/ ValueOk)
/\ (~CheckValues \/ ValueOk \/ metric = <<"outcome", "mismatched">>)
/\ (~CheckOutcomes \/ metric # <<"outcome", "mismatched">>)
THEN "accepted" ELSE "rejected"
/\ UNCHANGED <<keys, agrees, minutes, metric>>
Next == Validate
Spec == Init /\ [][Next]_vars
KeysComplete == result = "accepted" => Complete
ValuesSafe == result = "accepted" => ValueOk
TimerSafe == result = "accepted" => minutes <= 2147483647 \div 60000
OutcomesAgree == result = "accepted" => metric # <<"outcome", "mismatched">>
====
7 changes: 7 additions & 0 deletions docs/architecture/tla/EvalHostPreparation.ExtraBuild.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions docs/architecture/tla/EvalHostPreparation.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions docs/architecture/tla/EvalHostPreparation.tla
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---- MODULE EvalHostPreparation ----
\* Source: coding-side.mts preparation loop, Turbo bundle dependency, and verifyHostBuildOutputs.
\* Sink: the first createHostRuntime launch in the prepared worktree.
\* Failures: launch with incomplete outputs, or build the webview twice per side.
\* Invariants: LaunchRequiresBuildOutputs and WebviewBuiltOnce.
\* Scope: build success and file inspection are oracles. Output kinds are bounded in code tests.
\* Expect: output guards and one bundle hold. Removed output checks and an extra build fail.
\* Stance: the missing bundle fault and review finding preceded their invariants.
\* Review: 0 covered, 1 added, 0 gap. PR 2781 discussion_r4734380494.
\* Replay: the old workspace build misses extension.js; removing preflight fails the CLI tests.
\* Replay: restoring the standalone webview build fails the preparation CLI test.
\* Property: host-build.test.ts checks 64 file-kind combinations and symlink rejection.
\* Property: coding-side.test.ts checks command order, isolation, interruption, and preflight.
\* Live: the fixed runner passed five local attempts and the full 15-attempt CI run.
\* Refactor: derive WebviewBuilds from ExtraWebviewBuild instead of storing duplicate state.
\* Expect: the same 17 states and both negative controls remain sufficient.
\* Prior result: base passes in 17 states. NoCheckOutputs and ExtraBuild fail.
\* Findings: TLC reproduced known faults. No additional code bug or false alarm was found.
\* Prior gate: 424 evaluation tests, 33 workflow tests, both type checks, and applicable lint passed.
\* Prior cost: about 34 agent minutes, shared with the workflow and path changes.
\* Run: TLA_JAR=<jar> docs/architecture/tla/check.sh EvalHostPreparation.
\* This model does not prove the implementation correct.
\* Result: base still passes in 17 states. Both negative controls fail.
\* Finding: a constant invariant prevented state exploration in ExtraBuild.
\* Refinement: check the derived build count at host launch; ExtraBuild now has a state counterexample.
\* Gate: 426 evaluation tests, 33 workflow tests, both type checks, and applicable lint pass.
\* Cost: about 9 additional agent minutes shared across this simplification.
EXTENDS Naturals
CONSTANTS Outputs, CheckOutputs, ExtraWebviewBuild
VARIABLES outputs, stage
vars == <<outputs, stage>>
Complete == outputs.extension /\ outputs.webviewScript /\ outputs.webviewStyles
Init == /\ outputs \in Outputs
/\ stage = "built"
Verify == /\ stage = "built"
/\ stage' = IF ~CheckOutputs \/ Complete THEN "ready" ELSE "rejected"
/\ UNCHANGED outputs
Launch == /\ stage = "ready"
/\ stage' = "launched"
/\ UNCHANGED outputs
Next == Verify \/ Launch
Spec == Init /\ [][Next]_vars
LaunchRequiresBuildOutputs == stage = "launched" => Complete
WebviewBuilds == IF ExtraWebviewBuild THEN 2 ELSE 1
WebviewBuiltOnce == stage = "launched" => WebviewBuilds = 1
====
7 changes: 7 additions & 0 deletions docs/architecture/tla/EvalHostPreparationMC.tla
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---- MODULE EvalHostPreparationMC ----
\* One prepared tree has three required build outputs.
EXTENDS EvalHostPreparation
Enabled == TRUE
Disabled == FALSE
MCOutputs == [extension : BOOLEAN, webviewScript : BOOLEAN, webviewStyles : BOOLEAN]
====
5 changes: 5 additions & 0 deletions docs/architecture/tla/EvalScriptPath.NoDecode.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions docs/architecture/tla/EvalScriptPath.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions docs/architecture/tla/EvalScriptPath.tla
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---- MODULE EvalScriptPath ----
\* Source: runSummary file URL. Sink: Node script argument.
\* Failure: URL encoding changes the filesystem path sent to Node.
\* Invariant: ScriptPathPreserved requires the original path.
\* Scope: encoding and decoding are bounded oracles, not a copy of Node URL parsing.
\* Expect: pathname fails for encoded characters; fileURLToPath preserves the path.
\* Stance: the review finding preceded this invariant.
\* Review: 0 covered, 1 added, 0 gap. PR 2781 discussion_r4734380488.
\* Result: base passes in 3 states. NoDecode violates ScriptPathPreserved.
\* Replay: pathname fails the real path-domain test. fileURLToPath passes all four paths.
\* Property: workflow tests launch scripts from plain, space, percent, and Unicode paths.
\* Findings: no additional code bug or false alarm was found.
\* Prior gate: 424 evaluation tests, 33 workflow tests, both type checks, and applicable lint passed.
\* Prior cost: about 10 agent minutes, shared with the workflow and host review changes.
\* Change: consolidate header evidence. Expect no model or code behavior change.
\* Run: TLA_JAR=<jar> docs/architecture/tla/check.sh EvalScriptPath.
\* This model does not prove Node or the implementation correct.
\* Result: base still passes in 3 states. NoDecode still fails. No behavior changed.
\* Gate: 426 evaluation tests, 33 workflow tests, both type checks, and applicable lint pass.
\* Cost: about 9 additional agent minutes shared across this simplification.
EXTENDS Naturals
CONSTANTS Paths, Decode
VARIABLE input
vars == <<input>>
Init == input \in Paths
Spec == Init /\ [][UNCHANGED input]_vars
Argument == IF Decode THEN input.original ELSE input.encoded
ScriptPathPreserved == Argument = input.original
====
8 changes: 8 additions & 0 deletions docs/architecture/tla/EvalScriptPathMC.tla
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---- MODULE EvalScriptPathMC ----
EXTENDS EvalScriptPath
Enabled == TRUE
Disabled == FALSE
MCPaths == { [original |-> "/tmp/Zoo/code.mjs", encoded |-> "/tmp/Zoo/code.mjs"],
[original |-> "/tmp/Zoo Code/code.mjs", encoded |-> "/tmp/Zoo%20Code/code.mjs"],
[original |-> "/tmp/Zoo%Code/code.mjs", encoded |-> "/tmp/Zoo%25Code/code.mjs"] }
====
10 changes: 10 additions & 0 deletions docs/architecture/tla/EvalWorkflow.NoApproval.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions docs/architecture/tla/EvalWorkflow.NoCandidate.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading