feat(ce-optimize): remote experiment backend with paired self-measurement - #1709
Closed
kieranklaassen wants to merge 2 commits into
Closed
kieranklaassen wants to merge 2 commits into
kieranklaassen wants to merge 2 commits into
Conversation
…ment execution.backend: remote dispatches each experiment to a detached worker with its own checkout, on a harness whose dispatch returns a receipt and lands its work as a pushed ref or store file (the third capability condition in the body's Execution Surface; without it the run uses worktree). The worker verifies base_sha, implements inside scope.mutable, measures baseline and candidate paired on its own machine, writes result.yaml, and pushes optimize-exp/<spec>/exp-NNN. The orchestrator accepts a result only when base_sha matches and the range touches only mutable scope, runs decide.mjs on the worker's pair, and before any keep obtains a confirmation pairing the candidate's author did not produce. remote requires a paired or relative comparison; the parallel probe and worktree budget do not apply to it. Log schema gains comparisons[].machine, measured_by, and the result.yaml shape. Co-authored-by: Kieran Klaassen <kieranklaassen@users.noreply.github.com>
…arability Co-authored-by: Kieran Klaassen <kieranklaassen@users.noreply.github.com>
cursor
Bot
force-pushed
the
cursor/ce-optimize-long-runs-remote-54a9
branch
from
September 14, 2026 18:37
051a91b to
9f0aa9c
Compare
cursor
Bot
changed the base branch from
cursor/ce-optimize-long-runs-54a9
to
cursor/feat/ce-optimize-eval-discipline-01d6
September 14, 2026 18:38
tmchow
added this pull request to stack #1713
September 15, 2026 00:04
cursor Bot
pushed a commit
that referenced
this pull request
Sep 15, 2026
Co-authored-by: Kieran Klaassen <kieranklaassen@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Design C of the approved
ce-optimizelong-runs brainstorm, stacked on #1707 (eval discipline), which is stacked on #1708 (Design B). Addsexecution.backend: remote(Q7): one experiment per detached worker with its own checkout, collected asynchronously through B's tick/receipt model. Nothing about what counts as an improvement changes;decide.mjsstill makes every decision.Third capability condition in
SKILL.md## Execution Surface: a detached worker is a dispatch whose result arrives as a pushed ref, a store file, or a host-delivered message, not as edits in the local tree.remoteneeds one; without it that spec runs onworktree. No vendor names in the body; the one example table inpersistence.mdgains a column.Worker contract (Q2).
experiment-prompt-template.mdgets one delta block appended only forremote: verify HEAD is{base_sha}, implement insidescope.mutable, measure paired (baseline commit and candidate on the same machine, alternating samples), writeresult.yaml(base_sha,head_sha,machine, both snapshots, correctness; per-casecasesand cost fields only when the harness emits them), commit and pushoptimize-exp/<spec>/exp-NNN, report a structured result. The rest of the template is unchanged.Orchestrator side (
loop.md).remoterow in the dispatch table; isolation is the worker's checkout, so the recipe recordsbase_shaand pushes it. Falls back to theworktreerow for the whole run when no such capability is in the tool list.remoteresult is accepted only whenbase_shamatches what was dispatched, the range touches onlyscope.mutable+result.yaml, and both snapshots carry the required objectives; otherwiseerror, never repaired. The worker's pair is the selection measurement;result.yamlis copied into<state-root>as the recovery marker. A worker result carries only the selection pairing, so a configured holdout answers a would-be keep withnext_measurement: holdoutlike any other backend.remotewinner: a pairing the candidate's author did not produce (this checkout or a fresh confirmation worker), at the full protocol, which also runs the holdout when the last decision asked for it. Persisted askind: standaloneandkind: holdoutpairings, each withmachineandmeasured_by;decide.mjsruns on those snapshots, never the worker's.result.yamlis stripped from what merges.Schema.
backendenum +remote; rule:remoterequirescomparison.methodpairedorrelative(cross-machine absolute numbers are not comparable);max_concurrentnote per backend. Log schema:comparisons[].machineandcomparisons[].measured_byon every pairing kind includingholdout, plus aresult_markershape.measurement.md: 1.4/1.5 apply only when experiments share this machine.Files
skills/ce-optimize/SKILL.md(7949 bytes CRLF-adjusted; a few sentences compacted to fit the third condition under the 8000 Codex bound, none of them pinned behavior)references/{loop,measurement,persistence}.md,references/experiment-prompt-template.md, both schemastests/skills/ce-optimize-decide.test.ts– one new pin test (enum value, validation rule, body names the third condition, template delta present and instruction 4 of the base template intact, collection/confirmation/holdout routing conditions, log-schema fields)docs/guides/ce-optimize.md–remoteparagraph in Reference; FAQ on cross-machine comparabilityDesign choices the doc left open (closest to today's behavior)
base_shaor a range outside mutable scope is anerrorand closed, not retried automatically.add_sample,confirm) for a remote candidate re-dispatch to the same worker (or a new one from the samehead_sha); the holdout never goes to the worker. The log entry stays one experiment.result.yamlcopy is in the state root.scripts/experiment-worktree.shuntouched; nofetch-exphelper was needed.Rebase onto #1707
Conflicts in
loop.md3.4 (eval's holdout-before-keep bullet vs. the remote confirmation bullet) and the guide FAQ were resolved by keeping the eval blocks verbatim and restating the remote bullet so the independent confirmation is the single owner of the holdout measurement. No eval-discipline content was rewritten.Validation
bun install,bun run release:validate(35 skills, in sync).bun run testafter the rebase: 4120 pass, 2 fail – both subprocess timeouts in unrelated files (ce-babysit-pr-snapshot,cliinstall-from-GitHub) that pass when run alone (205 pass / 0 fail).Security Disclosure
No new shell in the skill. The remote worker prompt instructs the worker to push only to
optimize-exp/<spec>/exp-NNNand never to the optimization branch; the orchestrator validates a returned result bybase_shamatch and a mutable-scope-only commit range before using any number, and requires an independently produced confirmation (and holdout, when configured) measurement before merging. Worker-suppliedresult.yamlis treated as a claim, copied into the state root, and never edited. Residual risk: a worker can still report false numbers for an exploratory pair; that only costs one confirmation measurement, since the keep decision is not taken from the worker's pair alone.Agent Disclosure
Cursor cloud agent · Claude Fable 5.1(as stated by the harness context; no version beyond that is visible)