Skip to content

feat(desktop): install an app from an AppImage or an upstream tarball, pinned by its SHA-256 - #9215

Merged
morluto merged 748 commits into
morluto:mainfrom
earakely-scale:feat/desktop-download-installs
Nov 9, 2026
Merged

morluto merged 748 commits into
morluto:mainfrom
earakely-scale:feat/desktop-download-installs

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #9185 and #9199: this branch includes their merge, 4d4d92dbe. Please review 3832e7ee2, 07d1e3639 and 77206cc5cb. It adds 659 lines of source (about 80 of them moved), 516 of tests and 296 of docs.

Summary

A build request can now install an app from its project's AppImage or tarball, pinned by URL and SHA-256. The exported bundle downloads the same file and unpacks it with the same script. Neither the build nor the bundle holds the app.

Problem and expected behavior

Build computers installed only from apt: the Ubuntu archive, an apt repository, or a .deb by URL. The skill told the agent to stop for anything else. Three apps on an arm64 build host showed what that leaves out:

  • Pinta is not in Ubuntu 24.04's archive and ships for Linux only on Flathub.
  • FreeCAD 1.1.4 ships an aarch64 AppImage of 721 MB. Extracted with --appimage-extract, it opened in the computer with no extra packages.
  • draw.io 32.6.10 ships an arm64 .deb that the existing path installs. Its Depends omits ALSA, so it exits with libasound.so.2: cannot open shared object file.

The capture of an extracted AppImage records its package as unknown. The export then refused it as not an apt package.

Expected now: a request names {"kind": "appimage", ...} or {"kind": "tarball", ...}. The build computer installs it, and the export installs the same bytes the same way.

Change and scope

Request. install takes two new kinds, each with url, sha256, one architecture and extra_packages:

  • appimage: desktop_entry names the .desktop file the image ships at its top, such as org.freecad.FreeCAD.
  • tarball: adds program, the program's path inside the archive, and an optional name for the menu. REA writes the desktop entry.

The schema refuses a program path with .. or a leading /, and an uppercase SHA-256. It refuses a URL with credentials or not over http or https, and a two-line name.

Install. agentenv downloads the file when the bundle is put and refuses other bytes. A root run script, install-download.sh, then works with the network off:

  • It unpacks the file under /opt/rea-apps/<desktop_entry> and removes the download.
  • An AppImage is extracted with its own --appimage-extract, so FUSE is not needed.
  • The image's own entry is installed under /usr/local/share/applications. Each Exec program becomes the extracted AppRun, TryExec is dropped, and its SVG or PNG icon is copied.
  • An image without the named entry fails the build and lists the entries it has.
  • A tarball is read with Python's tarfile, since the computer has no xz program. gzip, bzip2 and xz work.
  • REA writes a tarball's entry as a file in the environment folder. It runs program %F, and the script installs it.

Order. The script runs after REA's own layer and before the Electron rewrite. So electron: true adds --no-sandbox to the entry the download installed.

Export. The build computer passes the request's download to the export as a JSON file, --download-install. The CLI takes the same flag. From it the export renders:

  • downloads=[Download(...)] and run=[RunScript(script="install-download.sh")];
  • the same script, byte for byte, and a tarball's entry;
  • no apt package for the app, with extra_packages beside it as before.

It refuses (download_install):

  • a file that names no AppImage or tarball install;
  • a capture that launched another desktop entry;
  • a captured program outside /opt/rea-apps/<desktop_entry>;
  • a capture host of another architecture.

It also refuses --package-url beside the file.

Structure. The shared schema and script renderer are in appDownloadInstall.ts. The export's decision is in appExportDownload.ts. The README install text moved from appExport.ts to appExportInstallText.ts, which keeps both files under oxlint's 500-line limit.

Docs and skill. The skill's install table gains both kinds. It says when to take each, and where the SHA-256 comes from. It also notes two VSCodium quirks found in validation. The build-computer and export guides describe the step and the flag. The spec, plan and verification are in docs/specs/desktop-app-environments/download-installs/.

Not included:

  • Flathub. bubblewrap needs user namespaces the computer refuses: No permissions to create new namespace. With seccomp and AppArmor unconfined it still fails on setting up uid map: Permission denied. That comes from the Ubuntu 24.04 host's kernel.apparmor_restrict_unprivileged_userns=1. Neither setting is REA's.
  • One request for both architectures, zstd tarballs, and AppImages without --appimage-extract.
  • Reclaiming the download's space. agentenv copies it into the app's image layer before the script runs. FreeCAD adds 756 MB there and 3.18 GB extracted.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the build request's install schema, then the build bundle's install, then the export's install decision.
  • Contribution scope fit and linked maintainer decision: same approved desktop-environments work as feat(desktop): capture a Linux desktop application in use #8874. The seven decisions are in the desktop-environments design note on installing apps from outside apt.
  • CLI and MCP/tool-catalog contract:
    • start_build_computer accepts the appimage and tarball install kinds.
    • rea export-desktop-application --download-install FILE is new.
    • Existing kinds and flags are unchanged.
  • Provider, bridge, target-format, or platform compatibility: Linux build computers on amd64 or arm64, one architecture per download.
  • Evidence, artifact, provenance, or reconstruction contract: the export's evidence parameters gain download_install, true or false.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable):
    • The computer fetches only the URL the request names and checks its SHA-256.
    • The script writes only under /opt/rea-apps/<desktop_entry> and /usr/local/share.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: one new CLI option and two new MCP input kinds.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: all 11 failed on the base first, each on an assertion.
    • the bundle declares an AppImage's Download for its one architecture, passes its extra_packages, and runs REA's layer, then the download, then the Electron rewrite;
    • a tarball's Download and the exact entry REA writes;
    • the schema refusals listed above;
    • the AppImage script runs under sh against a stub image. It installs the entry with absolute Exec lines, no TryExec, and the icon, in a readable folder;
    • an image without the named entry fails and names drawio.desktop;
    • the tarball script unpacks a real .tar.xz, installs the entry and removes the download, and a missing program fails;
    • the export declares the download, and its script equals the build computer's;
    • the export writes a tarball's entry beside the script;
    • the export refuses a program outside the folder, writes nothing, and refuses --package-url beside the file or a file naming no install;
    • through MCP, an AppImage request's export receives --download-install with the request's download, and its bundle downloads the image.
  • Base reproduction or other evidence: an arm64 Ubuntu 24.04 host with agentenv 0.9.1431.
    • FreeCAD 1.1.4 AppImage. The build computer started in 714 s, 436 s of them queued behind other builds. The capture opened FreeCAD in 7.7 s. Changing the cube's Length from 10 to 25 mm gave a draft check on Document.xml through the .FCStd view. The bundle's computer started in 267 s, and agentenv's probe passed with FreeCAD launched at boot. Witness held: seed, edit, 24 mm near miss, reset.
    • VSCodium 1.143.17232 tarball, electron: true. The installed entry read codium --no-sandbox %F. The first capture exited on libnspr4.so, so the request added libnss3 and libasound2t64. Adding "olive oil" to a list exported and witnessed: seed, edit, "olive oils" near miss, reset all held.
    • draw.io 32.6.10 .deb with libasound2t64, through the unchanged path. agentenv resolved the virtual libgtk-3-0. Renaming a box from Draft to Approved witnessed all four stages.
  • User-visible CLI/MCP output (if applicable): FreeCAD's exported class declares packages=Packages(apt=[]), the AppImage's Download with to="vendor/app.AppImage", arch="arm64", and run=[RunScript(script="install-download.sh")]. Its limitation reads: "The computer downloads the AppImage from once, when the bundle is put, refuses it unless its SHA-256 is …".
  • Remaining proof gaps:
    • No amd64 run. FreeCAD, VSCodium and draw.io publish x86_64 builds of the same releases.
    • The apps ran on the tree before the final lint refactor and the name check change. The rendered script is unchanged, and all tests pass after them.
    • No solver runs.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • After 77206cc5cb, 17 build tests, 76 desktop entry/export tests, 51 application export tests, typecheck and targeted oxlint passed. The generated installer regression covers quoted env and checks its installed command through the shared desktop parser. The offline Python parser must remain aligned with the TypeScript parser; real AppImage execution was not repeated after this fix. This stacked branch currently conflicts with the base.

  • npx oxfmt --check .: passed.

  • oxlint on the 16 changed and new source and test files: no diagnostics.

  • npm run typecheck: no errors outside the API-contract files, which fail only on a dependency missing locally.

  • vitest over src/domain/desktop src/application/desktop tests/boundary/providers tests/boundary/mcp/build tests/boundary/cli/desktop and the advertised-pattern test: 3,264 passed and 51 failed. The 51 are the same tests in the same 12 files that fail on the base. They are provider and CLI tests that need tools or a build this machine lacks.

  • npx knip: the same two unresolved worker aliases as the base, which need build artifacts. Nothing new.

  • npm run verify:module-boundaries: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Existing install kinds, flags and bundles are unchanged.
  • Real Hopper/Ghidra, browser, or OS coverage: arm64 Ubuntu 24.04 build computers for the three apps; macOS for the source tests.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review:
    • Downloads are pinned by SHA-256, and agentenv refuses other bytes.
    • URLs with a user name or password are refused.
    • Script values come only from schema-checked tokens; the renderer refuses any other.
    • A tarball's free-text name goes into a file REA writes, never into the shell.
    • tarfile extracts with the tar filter, which keeps paths inside the folder.

Maintainer follow-up

Preserved the author's spaced Exec/TryExec parsing fix and required task checklist. Moved subprocess-based installer/launcher proof to the provider boundary suite while keeping pure rendering cases in the domain suite. Integrated format ownership, seed/export and setup lifetime/readiness repairs from the corrected parents. Additional checks passed: npm run docs:check.

At head d13b52bee1, the affected tests below completed with 317 passed (317); npm run check:fast, npm run format:check and git diff --check passed. This includes the updated parent stack and main through 25d3c7237f. Checks use source/domain and controlled boundary fixtures; no real desktop provider qualification was performed. Current-head CI and review remain required before auto-merge.

node node_modules/vitest/vitest.mjs run src/domain/desktop/appBuild.test.ts tests/boundary/providers/desktopBuildInstall.test.ts src/application/desktop/DesktopApplicationExport.test.ts tests/boundary/mcp/buildCaptureRetryMcp.test.ts src/domain/desktop/viewPointer.test.ts src/domain/desktop/appTaskChecks.test.ts src/application/desktop/DesktopTaskExport.test.ts src/application/MacHopper.test.ts src/application/LinuxHopper.test.ts src/application/desktop/DesktopTaskDraftNotes.test.ts src/domain/desktop/stateRoles.test.ts

Author readiness

Human owner: @earakely-scale

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-07T01:50:03.177674Z
We couldn’t complete this review. Comment @codex review to try again.
3832e7e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5 Tier: plus

[Medium impact] The changes reach Linux desktop build, capture, and export workflows.

Do not merge until wrong positioned-note text is rejected, the remaining reference-number gap is closed, and the required owned file reader is used.

Findings

  1. P1 Wrong notes still pass ▶
  2. P1 Reference numbers go unchecked ▶
  3. P2 Download file reads skip guards ▶
Fix with agent prompt
### Issue 1
src/domain/desktop/appTaskDraftItems.ts:137-140
`placedItemCheck` searches the whole layer with `text_contains`. A task drafted from a new Xournal++ note saying `Buy eggs` also passes with `Do not Buy eggs`. The note count stays the same, the kept-note guards pass, and `texts.covers` prevents a more specific check. The agent can therefore receive full credit for the wrong note.

Compare the new note's whole text without tying it to its position.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

### Issue 2
src/domain/desktop/appTaskDraftLineGuards.ts:143-150
`volatileAt` treats every token matching the letters-underscore-six-digits pattern as an app-generated value, even inside ordinary user text. Adding `Reference: ABC_123456` therefore suggests a count of lines containing only `Reference: `, so `Reference: WRONG` passes. Tasks asking users to enter a reference number can pass without checking the number.

Only omit a value when the file's parsed facts identify it as generated metadata. Otherwise, keep the requested text exact.

### Issue 3
src/application/desktop/DesktopExportInstall.ts:79-81
`readDownloadInstall` checks `stat(path)`, then opens the path again with unbounded `readFile` and no cancellation signal. If the file grows or changes between those calls, the export can read more than its stated 64 KiB limit.

The repository requires: “Give descriptor-backed reads an owner before opening the file.” Reuse the shared owned reader, check the size on its open handle, and pass the export's signal. This repository requirement must be satisfied before merging.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds SHA-256-pinned AppImage and tarball installs through a shared build/export script.

  • Desktop builds and exports install pinned AppImages and tarballs.
  • Linux desktop build hosts can be set up and checked for readiness.
  • Desktop captures carry app state and task evidence through build and export.
  • Task drafts can check more kinds of captured app data.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Request["Build request: URL + SHA-256"] --> Download["agentenv checks downloaded bytes"]
  Download --> Installer["Shared install-download.sh"]
  Installer --> App["App under /opt/rea-apps"]
  App --> Capture["Capture app and task"]
  Request --> Description["Download install description"]
  Description --> Export["Export bundle"]
  Capture --> Export
  Export --> Download
Loading

Reviews (9) · Last reviewed commit: "Merge remote-tracking branch 'live-5600/..." · Reviewed by Greptile

Comment thread src/domain/desktop/appExport.ts Resolved
# Conflicts:
#	src/domain/desktop/appTaskDraftNoise.test.ts
# Conflicts:
#	src/application/desktop/DesktopApplicationExport.ts
#	src/application/desktop/DesktopBuildComputers.ts
#	src/desktop/AgentEnvComputer.ts
#	src/domain/desktop/stateRoles.ts
# Conflicts:
#	docs/desktop-application-tasks.md
#	docs/desktop-build-witness.md
#	docs/specs/desktop-app-environments/build-witness/spec.md
#	src/domain/desktop/appTaskDraftNamed.ts
#	src/domain/desktop/appTaskDraftNoise.ts
#	src/domain/desktop/appTaskDraftValues.test.ts
# Conflicts:
#	src/domain/desktop/appTaskDraftNamed.ts
#	src/domain/desktop/appTaskDraftNoise.ts
# Conflicts:
#	src/application/Setup.ts
#	src/composition/capabilityServices.ts
#	src/doctorRuntime.ts
# Conflicts:
#	.agents/skills/reverse-engineer-anything/references/desktop-build.md
#	docs/desktop-application-capture.md
#	docs/desktop-application-export.md
#	docs/desktop-application-state.md
#	docs/desktop-application-tasks.md
#	docs/desktop-build-computer.md
#	docs/desktop-build-witness.md
#	docs/specs/desktop-app-environments/build-witness/spec.md
#	docs/specs/desktop-app-environments/build-witness/verification.md
#	src/application/desktop/DesktopApplicationCapture.ts
#	src/application/desktop/DesktopApplicationExport.test.ts
#	src/application/desktop/DesktopApplicationExport.ts
#	src/application/desktop/DesktopBuildBundle.ts
#	src/application/desktop/DesktopBuildCapture.ts
#	src/application/desktop/DesktopBuildComputers.ts
#	src/application/desktop/DesktopBuildOutputRead.test.ts
#	src/application/desktop/DesktopBuildSummary.ts
#	src/application/desktop/DesktopBuildWitness.test.ts
#	src/application/desktop/DesktopExportFiles.ts
#	src/application/desktop/DesktopExportLaunch.ts
#	src/application/desktop/DesktopGzipDocument.test.ts
#	src/application/desktop/DesktopTaskDraft.ts
#	src/application/desktop/DesktopTaskDraftNotes.test.ts
#	src/application/desktop/DesktopTaskExport.test.ts
#	src/composition/capabilityServices.ts
#	src/contracts/desktopBuildToolContracts.ts
#	src/desktop/DesktopApplicationSession.test.ts
#	src/domain/desktop/appExport.test.ts
#	src/domain/desktop/appExport.ts
#	src/domain/desktop/appExportPython.ts
#	src/domain/desktop/appExportUnowned.test.ts
#	src/domain/desktop/appExportUnowned.ts
#	src/domain/desktop/appTaskChecks.fixture.ts
#	src/domain/desktop/appTaskChecks.ts
#	src/domain/desktop/appTaskDraft.fixture.ts
#	src/domain/desktop/appTaskDraft.ts
#	src/domain/desktop/appTaskDraftAdded.test.ts
#	src/domain/desktop/appTaskDraftAdded.ts
#	src/domain/desktop/appTaskDraftFileNotes.test.ts
#	src/domain/desktop/appTaskDraftFileNotes.ts
#	src/domain/desktop/appTaskDraftGuards.test.ts
#	src/domain/desktop/appTaskDraftGuards.ts
#	src/domain/desktop/appTaskDraftLineGuards.ts
#	src/domain/desktop/appTaskDraftNamed.ts
#	src/domain/desktop/appTaskDraftNoise.test.ts
#	src/domain/desktop/appTaskDraftNoise.ts
#	src/domain/desktop/appTaskDraftNotes.ts
#	src/domain/desktop/appTaskDraftPositional.test.ts
#	src/domain/desktop/appTaskDraftScalars.ts
#	src/domain/desktop/appTaskDraftText.ts
#	src/domain/desktop/appTaskDraftTextAdded.test.ts
#	src/domain/desktop/appTaskDraftValues.test.ts
#	src/domain/desktop/appTaskDraftValues.ts
#	src/domain/desktop/appTaskPython.ts
#	src/domain/desktop/attributeRank.ts
#	src/domain/desktop/desktopCapture.test.ts
#	src/domain/desktop/desktopCapture.ts
#	src/domain/desktop/positionalKeys.ts
#	src/domain/desktop/runtimeFiles.ts
#	src/domain/desktop/seedDocument.test.ts
#	src/domain/desktop/seedScrub.ts
#	src/domain/desktop/selectorCandidates.ts
#	src/domain/desktop/stateChanges.ts
#	src/domain/desktop/stateFormats.ts
#	src/domain/desktop/stateRoles.test.ts
#	src/domain/desktop/stateRoles.ts
#	src/domain/desktop/viewPointer.test.ts
#	src/domain/desktop/viewPointer.ts
#	tests/boundary/mcp/buildCaptureDraftMcp.test.ts
#	tests/boundary/mcp/buildCaptureRetryMcp.test.ts
#	tests/boundary/mcp/buildComputerMcp.test.ts
#	tests/boundary/providers/desktopExportPython.test.ts
#	tests/fixtures/buildCaptureFakes.ts
#	tests/fixtures/buildComputerMcp.ts
# Conflicts:
#	.agents/skills/reverse-engineer-anything/references/desktop-build.md
#	docs/desktop-application-export.md
#	docs/desktop-application-tasks.md
#	docs/desktop-build-computer.md
#	src/application/DesktopBuildDoctor.test.ts
#	src/application/DesktopBuildDoctor.ts
#	src/application/MacHopper.test.ts
#	src/application/desktop/DesktopApplicationExport.ts
#	src/application/desktop/DesktopBuildCapture.ts
#	src/application/desktop/DesktopBuildExport.ts
#	src/application/desktop/DesktopExportInstall.ts
#	src/cli/desktopCaptureCommands.ts
#	src/desktop/DesktopBuildDoctorFacts.test.ts
#	src/desktop/DesktopBuildDoctorFacts.ts
#	src/domain/desktop/appBuild.test.ts
#	src/domain/desktop/appBuild.ts
#	src/domain/desktop/appExport.ts
#	src/domain/desktop/appExportInstall.ts
#	src/domain/desktop/appExportPython.ts
#	src/domain/desktop/appTask.ts
#	src/domain/desktop/appTaskChecks.fixture.ts
#	src/domain/desktop/appTaskDraftItems.test.ts
#	src/domain/desktop/appTaskDraftItems.ts
#	src/domain/desktop/appTaskDraftLineGuards.test.ts
#	src/domain/desktop/appTaskPythonPointer.ts
#	src/domain/desktop/viewPointer.ts
#	tests/boundary/mcp/buildCaptureRetryMcp.test.ts
#	tests/fixtures/buildCaptureFakes.ts
@morluto
morluto merged commit 26d81af into morluto:main Nov 9, 2026
4 checks passed
@morluto morluto mentioned this pull request Nov 11, 2026
3 tasks done
@morluto morluto added area: setup Setup, packaging, upgrade, install, Doctor, and client registration enhancement New feature or request labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: setup Setup, packaging, upgrade, install, Doctor, and client registration enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants