Repository navigation
feat(desktop): capture, draft, export and witness a task inside a build computer - #9045
Conversation
[Medium impact] The latest cleanup refactor appears safe to merge. SummaryThis PR adds capture, task drafting, export, reset, and recorded task checks on build computers. The latest change groups the saved cleanup error with its release function and checks repeated failures.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Capture starting state and edit] --> B[Stop capture and draft task]
B --> C[Export bundle]
C --> D[Start fresh computer]
D --> E[Check starting state, edit, near miss, and reset]
E --> F[Save record and recording]
F -->|Saved with handles closed| G[Return saved record]
F -->|Saved with handles still open| H[Keep error and release function together]
H -->|Close fails: return same error| H
H -->|Close succeeds| G
Reviews (21) · Last reviewed commit: "fix(desktop): keep one published witness..." · Reviewed by Greptile |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> # Conflicts: # src/application/desktop/DesktopTaskExport.ts
…ld skill Co-Authored-By: Claude Opus 5.5 <[email protected]>
…kill Resolves where morluto#9050's DOCTYPE policy and whole-text checks meet the build stack's syntax-only XML pass and undecided rule: one saxes pass applies the DOCTYPE policy, checking an external-id-only declaration against XML 1.0's grammar so it agrees with the DOM parser; a UTF-16 seed with a plain DOCTYPE reads as XML like a UTF-8 one; and text checks follow the cut-view rule in both evaluators (a text_contains match on a cut element stays decided, a miss or a text_equals there is undecided). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d-document Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-seed-document Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ld computer - start_build_capture runs REA's capture inside the computer through a small controller over computer-exec, after a user-space apt-get update; mark_build_checkpoint returns once the capture confirms the checkpoint; stop_build_capture returns the draft between seed and end. - export_build_environment exports with the requester's task inside the computer and fetches the bundle through data/get in bounded batches. - check_build_task grades a computer's data/get with REA's evaluator and, through seed, after_edit, near_miss and after_reset stages, records a witness with the action log and the screen recording; act_on_build_computer gains reset. - Capture progress lines carry window, checkpoint and refusal events; apps start in the home; a pack script builds the runtime archive; long tools send progress notifications. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…se the near-miss reset hole - A capture whose start answer is lost is stopped at once and kept unreleased until the stop is confirmed; a lost checkpoint answer is recovered from the capture's own log, and draft and export use the checkpoints its Evidence records; stop can be repeated to resume reading its result. - A witness can check its seed again after a failed read, and keeps its stages in a saving state until the record is written, so a failed save can be retried without reading the app again. - after_edit and near_miss count only click, drag, scroll, type and key, so a reset no longer stands in for the near-miss edit. - A .deb build keeps its package file for capture and passes its URL to export; bundle downloads write each checked file before fetching the next; an apt-get update failure reports its exit code and log tail; reset sends progress while it waits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd first frames drawn From the blind Inkscape rebuild: - Paths in ~/.local/share/Trash get a desktop_trash reason and the shared_desktop role, so a file trashed before seed is neither owned nor seeded; the export names it in a limitation. - The keep helper runs with PYTHONDONTWRITEBYTECODE=1, so starting a computer from a bundle folder no longer writes __pycache__ into it. - start_build_computer waits, bounded, until the first frame is not one colour before returning it. From review: a .deb that apt also offers exports from apt, since export passes --package-url only when the capture says the package must come from its file. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s nothing, and tie the witness to its bundle A review found five gaps. - Commands in the computer answer only when they end, but fetch stops waiting for headers after 300 s. So a slow export, draft or start always failed. A command with its own deadline now waits on node:http, bounded by that deadline. - after_reset held whenever some check failed, so a reset that changed nothing passed on the near-miss state. Each check must now come out as it did at the seed. - A failed or partial apt-get update left lists that looked complete, so a second start skipped the update. The update is now recorded only when it succeeds, and rerun otherwise. - A witness on a bundle computer graded whatever task it was given. Its seed stage now refuses a task whose steps or checks differ from the bundle's. - A task too large for one command argument (96 KiB) is refused before the export runs, instead of failing with E2BIG in the computer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The witness doc keeps this branch's synthetic-seed and launch-document sentences beside morluto#9045's 96 KiB task limit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Both sides' new capture tests are kept, the witness doc gains morluto#9045's 96 KiB task limit, and an import morluto#9045's fix left unused is dropped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
morluto#9045's review fixes meet this branch's settle rule. A witness stage grades settled results. after_reset then compares them with the seed's, and the record carries settled, read_cut and the optional remediation. The bundle tie runs when the seed stage opens. The build computer passes its bundle path and settle timing to the witness. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The build computers module keeps this branch's extraPackagesOf import and drops the BuildRequest type morluto#9045's fix no longer uses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ery JS regex mode main's advertised-pattern test compiles every input schema pattern in v mode, which refuses an unescaped hyphen in a character class. The checkpoint name's hyphen is now escaped, and it means the same in u mode. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@morluto this one is ready for review. It builds on main, merges cleanly, and all checks pass. The description's "Final review round" section lists the main merges and the fixes from an independent review of this PR's diff. |
Keep the build-witness spec beside the XML text-check spec, and keep cut-view failures undecided while accepting main's whole-text checks. Co-authored-by: morluto <[email protected]>
…t update A cancel after data/reset no longer drops the restore from the action log, so a near miss cannot treat the restored seed as an edit. An unreadable seed check that later passes leaves after_reset undecided instead of failing the witness. apt-get update is kept only when Error-Mode reports success and a package list was fetched. The controller reply schema lives with the controller, and capture progress lines are read by their domain parser.
Bring the reset, seed-comparison and apt-list fixes forward, and keep morluto#9049's rule that a cut element's text stays undecided.
after_reset stays undecided when any check was not read, even if another check still fails and the unread result's boolean matches the seed. A text check for a child past a truncated view is undecided in both evaluators. A reset whose reply is lost blocks a near miss until a later input or a reset whose reply arrives.
A recording that fails to end or download is not written into the witness folder, and a manifest already received is fetched again without ending the recording twice. A folder that is published while its handles fail to close keeps that record and retries the same cleanup instead of writing the folder again.
A second failure to close a published witness returns the original error, so its record and cleanup lease stay bound. A reset the app itself refuses is an AppDataRefusal; only a reply that is not that refusal stays unsettled. A missing child of a cut view is undecided with the same description in both evaluators, and the shared cases cover it.
A published record and its bound cleanup error stay together. A later close failure returns that error, and the unused path that built a fresh adapter error is gone.
Summary
With this PR, Claude Code builds and proves a computer-app environment inside an agentenv computer through REA's MCP tools: it captures the app as Claude uses it, drafts and exports the task, then witnesses that task in a fresh computer. It is the third of four PRs for "a bundle from a request". The fourth is the skill that walks Claude through the flow.
Problem and expected behavior
#9041 lets Claude drive a computer, but nothing turned that into an environment. After this change:
start_build_capturestarts REA's capture of the app inside the computer, after a user-spaceapt-get updateso package sources are found.Claude makes the starting document in the app and calls
mark_build_checkpoint seed. Then it makes the edit and callsmark_build_checkpoint end. Each call returns only once the capture confirms the checkpoint was taken, with its counts.stop_build_capturereturns the package and the draft betweenseedandend: the changed files and suggested checks.export_build_environmentexports with the task Claude wrote, inside the computer, and fetches the bundle to a local folder.In a fresh computer of that bundle,
check_build_taskgrades the app'sdata/getwith REA's evaluator through the stagesseed,after_edit,near_missandafter_reset.act_on_build_computergainsreset.The witness holds only if:
data/reset.It writes
witness.jsonEvidence (rea.desktop-build-witness) with the action log and the screen recording.Change and scope
window_open,checkpoint(with counts, after the checkpoint is taken) andcheckpoint_refusedevents.bridge/agentenv/capture.py, run throughcomputer-exec/v1.start(apt lists underAPT_CONFIG, then the capture detached on a FIFO),mark,stop,run(draft and export) andlist.AGENTENV_*.AgentEnvComputergainsexec(bounded, token redacted),homeFiles(boundeddata/getbatches checked against the listing),appDataandwaitUntilReady.BuildComputerController.tsruns the controller.DesktopBuildCapture.ts,DesktopBuildExport.tsandDesktopBuildCommands.tscover capture, draft and export.DesktopBuildWitness.tsandDesktopBuildWitnessRecord.tscover grading, the stages and the record.DesktopBuildSteps.tsholds the step tools.DesktopOutputTree.ts, the export's safe output-tree writer, moves out so the build export and the witness share it.buildWitness.tsholds the stage order and rules. An applied input action is required beforeafter_editandnear_miss, and the reset must be the last change beforeafter_reset.buildCapture.tsholds the checkpoint name rules.npm run pack:build-computer-runtime -- <out.tar.xz>builds the REA archive.8d04d4d22):after_editandnear_misscount only click, drag, scroll, type and key, so a reset can't stand in for the near-miss edit..debbuilds: they keep their package file for capture and pass its URL to export.4158a3691):f6e9decf7), from a blind Inkscape rebuild with the build skill:__pycache__into it..debexports: a.debthat apt also offers exports from apt.docs/desktop-build-witness.md, updates to the capture, export and build-computer guides, and abuild-witnessspec folder.Contract and boundary impact
applicationfamily, plus capture's progress events.resetaction.capture-desktop-applicationprogress lines gain aneventfield.cdto the captured working directory before launch.rea.desktop-build-witnessEvidence.~/.rea-build, which the capture leaves out.Expected effects:
Evidence and regression coverage
New tests, each failing on the base:
buildWitness.test.ts;launchCommandcases;buildCaptureMcp.test.tsandbuildWitnessMcp.test.ts, run against an extended fake computer with exec,data/getpaths anddata/reset;Real end-to-end run on an Ubuntu 24.04 amd64 VM (agentenv-framework 0.9.1431), through REA's real MCP tools, with Claude as the building agent:
start_build_captureseedmarked in 0.45 s and confirmed; a secondseedrefusedendmarked;stop_build_capturedrafted exactly that linefailing_on_seedcovering the new line's checks; the launch line hascd "$HOME"seed: the new-line checks fail;after_edit: all pass;near_miss("call the dentists"): the line check fails;after_reset: they fail again, with the reset ready in 0.8 s.After the merge with feat(desktop): keep an agentenv computer up and drive it through REA's MCP tools #9041's fixes, a real start, capture, checkpoint, stop and close round passed on the VM. The start took 22.7 s and returned a JPEG screenshot.
For evidence-bearing changes:
Validation performed
npm run typecheck,format:check,build:cachedthenknip,jscpd,docs:check,docs:build,verify:test-discovery,verify:architecture-guards,verify:module-boundariesandmcp-catalog:check.lintfails only on main'stests/acceptance/webSourceLocationCli.test.ts.Compatibility, safety, and release
bridge/agentenv/capture.pyis added to the package'sfiles; there is a newpack:build-computer-runtimescript.Known gaps:
verify.pyand a separate solving agent run in the milestone's validation, not here.Final review round
main is merged in (
91bd1765a): its Electron launch script now sits beside this branch's package-file copy in the build bundle. An independent review of this PR's diff found five gaps, fixed in3855a38cd, each with a test that failed first:node:http, bounded by that deadline.after_resetheld whenever some check failed, so a reset that restored nothing passed. Each check must now come out as it did atseed.apt-get updatelooked complete to the next start. The update is recorded only when it succeeds, and rerun otherwise.seed, a witness on a bundle computer refuses a task whose steps or checks differ from the bundle's.Known gaps:
after_resetcompares checks' results, so a near miss failing exactly the seed's checks can't show a reset that restored nothing; the witness record does not yet carry the bundle's file digests.main is merged in again at
b128538c7, now with #8982.ff9c13246escapes the checkpoint name pattern's hyphen so it compiles in every JS regex mode, as main's advertised-pattern test requires.Author readiness
Human owner: @earakely-scale
Before merge
type(scope): outcome.🤖 Generated with Claude Code