Skip to content

feat(native): Linux support, phase 2 — org filesystem over FUSE - #5532

Closed
tlgimenes wants to merge 46 commits into
mainfrom
claude/linux-orgfs-mount
Closed

tlgimenes wants to merge 46 commits into
mainfrom
claude/linux-orgfs-mount

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase 2 of Linux support: the org filesystem mounts on Linux. Stacked on #5509 (phase 1) — review that first; this PR's base is its branch, so the diff here is org-FS only.

Ports the path the TypeScript sandbox daemon already runs in production (packages/sandbox/daemon/org-fs/), rather than inventing a second one.

macOS Linux
mount rclone nfsmount rclone mount (FUSE)
mount table spawn BSD mount read /proc/self/mounts
detach umount -f fusermount3 -uz → fusermount -uz → umount -l

Every per-OS difference is a runtime seam (LINUX_MOUNT_STACK, mount_args(linux, …), detach_commands(linux, …)), not a #[cfg], so both dialects compile and unit-test on either host — the Linux halves are proven by CI on macOS too, instead of first running on a user's machine.

macOS parity

Byte-identical, and pinned by tests rather than asserted: the_macos_mount_argv_is_unchanged, a_read_only_volume_keeps_the_macos_argv_it_shipped_with, macos_detaches_with_exactly_one_forced_unmount, both_stacks_share_one_argv_tail, plus the five BSD-table parser tests unmodified. Two deliberate cross-platform changes are documented in-code: prune_stale_mounts now honours DECOCMS_DISABLE_ORG_FS, and force_unmount passes the mountpoint verbatim instead of to_string_lossy (a non-UTF-8 ghost path was previously unreclaimable).

Defects found and fixed in review

Two adversarial passes ran against this diff; both found real bugs, and the second found one the first pass's fix had introduced.

  • Attachment detection was gated on filesystem type. An unrecognised type — a libfuse build dropping subtype=, a lossily-decoded non-UTF-8 path — made our own live mount read as unattached, so the next cycle killed a working rclone, create_dir_all then hit ENOTCONN, and it looped forever, leaving a ghost invisible to the very sweep meant to reclaim it. Attachment now asks only "is this path mounted?"; the narrow predicate stays where a miss is safe.
  • Unmount and mount attempts were unbounded. Lazy detach bounds the kernel's half, not libfuse's pre-flight stat, which a wedged server blocks forever — pinning the org in InFlight so every later request timed out until the app restarted.
  • The bound then leaked threads. A tokio blocking task cannot be cancelled, so each abandoned attempt strands a thread from a pool shared process-wide; at a flat retry that exhausted 512 threads and stalled every tokio::fs call in the process. Repeated abandons now back off and then stop entirely — a wedged server is reclaimed by the boot sweep, not by another attempt in this one.
  • The orphan-kill marker was a raw substring, so a user's own rclone mount wd: /data/orgs-backup/wd matched. Anchored at a path boundary; the negative test was inverted so the boundary is what spares it, not the remote's name.

Testing

cargo test --workspace 1121 passed / 0 failed; clippy -D warnings clean; cargo fmt --check clean. 41 tests in sandbox::org_mount (12 pre-existing unmodified, 29 new), all pure per TESTING.md.

Not verifiable in CI — needs real /dev/fuse, so it is a manual checklist before relying on this:

  • mount appears in /proc/self/mounts (confirming the fstype the sweep matches)
  • a stopped mount degrades to an empty org/ rather than hanging
  • the boot sweep reclaims a SIGKILLed session's ghosts
  • rclone verifies the local origin through the CA bundle

Also confirmed en route: the bundled Linux rclone fetch works end-to-end (rclone-v1.74.4-linux-amd64), and that binary references both fusermount3 and fusermount, so the detach chain covers either host.

🤖 Generated with Claude Code


Summary by cubic

Adds Linux org filesystem mounts via rclone mount (FUSE) and completes Linux desktop support: opt‑in HTTPS trust in WebKitGTK, AppImage packaging with an APPIMAGE‑gated updater, a Linux boot smoke launched through AppRun, and CI coverage on Ubuntu. macOS behavior and argv stay byte‑identical, with tighter CI gates and Linux‑aware dev proxy defaults.

  • New Features

    • Linux org‑fs: rclone mount over FUSE; reads /proc/self/mounts (octal‑unescape); detaches via fusermount3 -uz → fusermount -uz → umount -l with bounded retries/backoff; honors DECOCMS_DISABLE_ORG_FS. rclone is bundled for linux‑amd64/arm64.
    • Linux HTTPS (opt‑in DECOCMS_LINUX_SECURE_ORIGIN): per‑host WebKitGTK certificate exception set before first navigation; children get a system+local CA bundle via SSL_CERT_FILE only when a system store exists; NODE_EXTRA_CA_CERTS set for runtimes that extend roots; a preview‑host observer wires trust. Vite dev proxy defaults to http://127.0.0.1:43121 on Linux unless the secure origin is enabled.
    • Packaging/runtime: Linux tauri.linux.conf.json5 AppImage overlay + icons; self‑update only under APPIMAGE; pins @tauri-apps/cli so the smoke validates the shipped bundler; boot smoke extracts the AppImage and launches via AppRun, requests software rendering under Xvfb; script unit tests are discovered and run; self‑test gating keys match the bundle and freshness now covers the embedded self‑test and platform overlays; the remote image check is reported but not gating.
    • Auth storage: keychain/secret‑service namespace is pinned by profile on every OS (com.decocms.studio.dev debug, com.decocms.studio release); always uses the OS credential store.
    • Cross‑OS and CI: use xdg-open on Linux; PATH repair and the ripgrep install hint include Linux (apt/dnf); Linux dev process identity resolves via /proc/<pid>/exe. CI adds Ubuntu legs for rust-checks, tauri-build, and the contract suite; preserves required check names and fails aggregators unless the gate ran; separates rust‑cache per leg; dedupes a duplicate test chunk; isolates heavy tests, caps link parallelism, frees disk, chunks local-api tests, and scopes Linux‑only ignores to the GitHub runner.
  • Bug Fixes

    • PTY crash recovery (Linux): the watchdog now reaps by session id (unioned with tty), classifies Z leaders correctly, and treats ? as “no tty”; prevents releasing the crash‑recovery fence while members still run.
    • Process groups: correct liveness probe (pgrep -g); never signal group 0 or our own pid; fix Linux group signaling by using kill -- -<pgid> and delivering SIGINT via positive‑pid enumeration, so Ctrl‑C works and teardown no longer self‑signals; previously quarantined process‑group tests are re‑enabled and terminal-session is included in Linux tests.
    • Mount stability: attachment detection asks only “is this path mounted?”; orphan rclone matcher anchored at a path boundary; unmounts and mount attempts are time‑bounded with jittered backoff to prevent InFlight wedges and thread leaks.

Written for commit 963c960. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added the claude PR authored by a coding agent label Jul 31, 2026
@tlgimenes
tlgimenes force-pushed the claude/inherited-crafting-sloth branch from d94f8dc to 34fa782 Compare August 1, 2026 01:26
@tlgimenes
tlgimenes force-pushed the claude/linux-orgfs-mount branch from d7b88ee to 8fc158c Compare August 1, 2026 01:30
@tlgimenes
tlgimenes changed the base branch from claude/inherited-crafting-sloth to main August 1, 2026 01:31
@tlgimenes tlgimenes closed this Aug 1, 2026
@tlgimenes tlgimenes reopened this Aug 1, 2026
Comment thread apps/native/scripts/boot-smoke.ts Outdated
Comment on lines +7 to +15
* 1. Builds the release bundle (`bunx @tauri-apps/cli build`) — the `.app`
* on macOS, the AppImage on Linux — the same profile the shipped app
* uses, so the smoke gates what ships if it doesn't already exist (pass
* `--rebuild` to force a fresh build — useful after touching Rust or
* frontend source).
* 2. Launches it DIRECTLY (not `open -a`, which detaches from this
* process's stdio/exit-code and complicates cleanup) — the launch
* entry point per platform, see `boot-smoke-target.ts` — with
* `DESKTOP_SELFTEST=1`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

Comment on lines +367 to +368
// `finally`: a signal death rejects, and its cause only ever reaches
// stderr — a trailing call would report a bare signal name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

Comment on lines +584 to +590
// remoteImageLoads is deliberately NOT gating: it fetches a real asset
// over the public internet, so a runner with no egress fails it for
// reasons that say nothing about this app. The property it exists to
// protect — that the packaged CSP does not block remote images — is
// still gated, by noCspViolations below: a CSP block raises a
// securitypolicyviolation, whereas an unreachable CDN does not. Its
// result is still reported, so a real regression is visible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 38 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/native/src-tauri/src/setup.rs">

<violation number="1" location="apps/native/src-tauri/src/setup.rs:77">
P2: Linux `tauri dev` will wait for/load the configured HTTPS Vite origin while this setup path starts an HTTP localhost origin, so the development shell cannot boot reliably. The Linux fallback needs a matching dev-server/config URL (or a separate Linux-aware dev configuration) rather than changing only the Rust origin.</violation>
</file>

<file name="apps/native/crates/harness/src/run.rs">

<violation number="1" location="apps/native/crates/harness/src/run.rs:169">
P2: Claude runs also receive `SSL_CERT_FILE` even though this replacement-store override is intended for Codex; on Linux this can replace Claude's own trust configuration and break its API/MCP TLS when the generated bundle does not match the runtime's roots. Restrict this export to `HarnessId::Codex` and keep Claude on `NODE_EXTRA_CA_CERTS` only.</violation>
</file>

<file name="apps/native/crates/local-api/src/setup/dev.rs">

<violation number="1" location="apps/native/crates/local-api/src/setup/dev.rs:808">
P2: A Linux dev server whose executable is replaced or unlinked can become unreapable across a quick local-api restart: the saved identity contains `/proc/<pid>/exe`, but the next observation falls back to `ps comm`, so exact matching refuses to signal the orphan and subsequent starts fail. Normalizing the kernel's ` (deleted)` suffix to the underlying executable path would preserve the identity without weakening the birth check.</violation>
</file>

<file name="apps/native/src-tauri/src/webview_trust.rs">

<violation number="1" location="apps/native/src-tauri/src/webview_trust.rs:94">
P2: Preview host registration can race the iframe load on Linux. `preview_url_for` calls the observer and only then returns the URL, but `allow_preview_host` enqueues the actual `allow_tls_certificate_for_host` call onto the GTK main thread via `window.with_webview` (asynchronous from the non-main request thread) and returns immediately — so the URL escapes before the exception is actually registered. A subframe TLS failure never raises the recovery signal (it only fires for main-frame loads), so the first load of a fresh per-handle preview host can fail with no self-heal. The module doc's core guarantee ('registered before it loads') doesn't hold because registration is deferred async. Consider having `allow_preview_host` block until the GTK registration completes (e.g., a oneshot resolved inside the `with_webview` closure that the observer awaits) so the host is trusted before the URL is handed out.</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

) -> tokio::sync::oneshot::Receiver<Result<(), String>> {
let _ = LEAF_CERT.set(leaf_cert.clone());
let (tx, rx) = tokio::sync::oneshot::channel();
let dispatch = window.with_webview(move |platform| {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Preview host registration can race the iframe load on Linux. preview_url_for calls the observer and only then returns the URL, but allow_preview_host enqueues the actual allow_tls_certificate_for_host call onto the GTK main thread via window.with_webview (asynchronous from the non-main request thread) and returns immediately — so the URL escapes before the exception is actually registered. A subframe TLS failure never raises the recovery signal (it only fires for main-frame loads), so the first load of a fresh per-handle preview host can fail with no self-heal. The module doc's core guarantee ('registered before it loads') doesn't hold because registration is deferred async. Consider having allow_preview_host block until the GTK registration completes (e.g., a oneshot resolved inside the with_webview closure that the observer awaits) so the host is trusted before the URL is handed out.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/native/src-tauri/src/webview_trust.rs, line 94:

<comment>Preview host registration can race the iframe load on Linux. `preview_url_for` calls the observer and only then returns the URL, but `allow_preview_host` enqueues the actual `allow_tls_certificate_for_host` call onto the GTK main thread via `window.with_webview` (asynchronous from the non-main request thread) and returns immediately — so the URL escapes before the exception is actually registered. A subframe TLS failure never raises the recovery signal (it only fires for main-frame loads), so the first load of a fresh per-handle preview host can fail with no self-heal. The module doc's core guarantee ('registered before it loads') doesn't hold because registration is deferred async. Consider having `allow_preview_host` block until the GTK registration completes (e.g., a oneshot resolved inside the `with_webview` closure that the observer awaits) so the host is trusted before the URL is handed out.</comment>

<file context>
@@ -0,0 +1,277 @@
+) -> tokio::sync::oneshot::Receiver<Result<(), String>> {
+    let _ = LEAF_CERT.set(leaf_cert.clone());
+    let (tx, rx) = tokio::sync::oneshot::channel();
+    let dispatch = window.with_webview(move |platform| {
+        let outcome =
+            register_control_origin(&platform.inner(), &leaf_cert, &control_host, &control_url);
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed on the mechanism (the anchor is on install; the path is allow_preview_host, webview_trust.rs:134). The observer is called synchronously by preview_url_for and the URL is returned immediately, while the registration is only queued onto the GTK main thread — and the response travels back through the network/web processes without touching that thread, so nothing orders the exception before the iframe first handshake. The module doc and the comment in preview_url_for assert a guarantee the code does not provide.

Not taking the suggested remedy as written, though: allow_preview_host runs on a tokio worker inside the SANDBOX_START handler, and the GTK main thread is the same thread that runs register_control_origin — which takes the STATE mutex and calls load_uri. Parking a request thread on a oneshot from that thread is a deadlock hazard and blocks a runtime worker. The fix makes the observer awaitable so the handler awaits the registration instead of blocking on it; the same oneshot also supplies the success signal needed for the line-112 fix.

Tracked in #5509 — the file is phase 1 content.

Comment thread .github/workflows/native.yml Resolved
Comment thread apps/native/src-tauri/src/setup.rs Outdated
let mut origin = control_origin::current(selftest);
#[cfg(target_os = "linux")]
{
origin.secure = linux_secure_origin_enabled();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Linux tauri dev will wait for/load the configured HTTPS Vite origin while this setup path starts an HTTP localhost origin, so the development shell cannot boot reliably. The Linux fallback needs a matching dev-server/config URL (or a separate Linux-aware dev configuration) rather than changing only the Rust origin.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/native/src-tauri/src/setup.rs, line 77:

<comment>Linux `tauri dev` will wait for/load the configured HTTPS Vite origin while this setup path starts an HTTP localhost origin, so the development shell cannot boot reliably. The Linux fallback needs a matching dev-server/config URL (or a separate Linux-aware dev configuration) rather than changing only the Rust origin.</comment>

<file context>
@@ -35,6 +35,48 @@ pub enum SetupError {
+    let mut origin = control_origin::current(selftest);
+    #[cfg(target_os = "linux")]
+    {
+        origin.secure = linux_secure_origin_enabled();
+    }
+    origin
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mechanism described does not hold. The dev window URL does not come from devUrl: setup::run builds the webview with WebviewUrl::External(browser_origin) (setup.rs:431-437), and devUrl only feeds the CLI's connect-wait ("Could not connect to <url>") on that host:port, which a plain-HTTP listener on 4420 satisfies. And Vite on Linux already serves HTTP, not HTTPS: nativeTlsFiles (apps/web/vite.config.ts:28-39) reads $HOME/Library/Application Support/com.decocms.studio/tls, a macOS-only path, so server.https is never set there — the http origin this path selects is the one that matches what Vite actually serves.

The real dev-mode mismatch is the API proxy target, not the page origin: nativeLocalApiTarget defaults to https://127.0.0.1:43121 while local-api listens plain HTTP under the default Linux origin. That is tracked on the sibling comment on #5556 and is being fixed on the Vite side.

Comment thread apps/native/crates/harness/src/run.rs Outdated
ca_cert.display().to_string(),
));
}
if let Some(ca_bundle) = mcp.ca_bundle.as_ref() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Claude runs also receive SSL_CERT_FILE even though this replacement-store override is intended for Codex; on Linux this can replace Claude's own trust configuration and break its API/MCP TLS when the generated bundle does not match the runtime's roots. Restrict this export to HarnessId::Codex and keep Claude on NODE_EXTRA_CA_CERTS only.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/native/crates/harness/src/run.rs, line 169:

<comment>Claude runs also receive `SSL_CERT_FILE` even though this replacement-store override is intended for Codex; on Linux this can replace Claude's own trust configuration and break its API/MCP TLS when the generated bundle does not match the runtime's roots. Restrict this export to `HarnessId::Codex` and keep Claude on `NODE_EXTRA_CA_CERTS` only.</comment>

<file context>
@@ -151,6 +166,12 @@ fn mcp_child_env(spec: &RunSpec) -> Vec<(String, String)> {
                 ca_cert.display().to_string(),
             ));
         }
+        if let Some(ca_bundle) = mcp.ca_bundle.as_ref() {
+            env.push((
+                SSL_CERT_FILE_ENV.to_string(),
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale: apps/native/crates/harness/src/run.rs no longer exists — it was deleted whole (1981 lines) on main in #5557, and none of the three Linux branches touch it. mcp_child_env is now child_ca_env in apps/native/crates/local-api/src/terminal/launch_context.rs.

The concern does not hold there either. SSL_CERT_FILE is fed only from MountCredentials::ca_bundle, which ensure_child_ca_bundle (src-tauri/src/local_tls.rs) builds as a SUPERSET — every public root the host trusts plus the local CA — and returns None when no system store was found to build one from. It fails closed, so the replacement store can never subtract roots from any child, Claude included. ca_cert (our CA alone) is never routed to SSL_CERT_FILE. Claude's additive path, NODE_EXTRA_CA_CERTS, is set independently and unaffected; Node/Bun do not read SSL_CERT_FILE at all. Asserted by the_replacement_store_is_exported_only_when_a_superset_bundle_exists in that file.

if let Ok(target) = std::fs::read_link(format!("/proc/{pid}/exe")) {
if let Some(path) = target
.to_str()
.filter(|path| !path.is_empty() && !path.ends_with(" (deleted)"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: A Linux dev server whose executable is replaced or unlinked can become unreapable across a quick local-api restart: the saved identity contains /proc/<pid>/exe, but the next observation falls back to ps comm, so exact matching refuses to signal the orphan and subsequent starts fail. Normalizing the kernel's (deleted) suffix to the underlying executable path would preserve the identity without weakening the birth check.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/native/crates/local-api/src/setup/dev.rs, line 808:

<comment>A Linux dev server whose executable is replaced or unlinked can become unreapable across a quick local-api restart: the saved identity contains `/proc/<pid>/exe`, but the next observation falls back to `ps comm`, so exact matching refuses to signal the orphan and subsequent starts fail. Normalizing the kernel's ` (deleted)` suffix to the underlying executable path would preserve the identity without weakening the birth check.</comment>

<file context>
@@ -782,10 +782,38 @@ async fn observe_process_identity(
+        if let Ok(target) = std::fs::read_link(format!("/proc/{pid}/exe")) {
+            if let Some(path) = target
+                .to_str()
+                .filter(|path| !path.is_empty() && !path.ends_with(" (deleted)"))
+            {
+                return path.to_string();
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid, being addressed. Confirmed in the current file: resolve_executable (dev.rs:802-813) filters out the (deleted) form and returns the ps comm name, while a record written before the binary was unlinked holds the /proc/<pid>/exe path.

It does not need the ~1s refresh race to be reachable: local-api exits leaving the dev server orphaned, the toolchain binary is then replaced (bun upgrade, a dependency reinstall, a local rebuild), the app is restarted. Every live member's observed identity flips path -> comm, match_group_identity finds no exact member match, returns Unverifiable, and reap_persisted_dev_group errors — start fails with "cannot safely identify the previous dev server" on every attempt until the orphan happens to die.

Fix is the one suggested: strip the trailing (deleted) and return the remaining path instead of falling back to comm. That does not weaken the fence — a full path is strictly more discriminating than the 15-byte-truncated comm it currently falls back to, and pid plus the exact lstart birth string still have to match.

@tlgimenes
tlgimenes force-pushed the claude/linux-orgfs-mount branch 3 times, most recently from 296cad5 to f6c1623 Compare August 1, 2026 20:14

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/native/crates/local-api/src/process_group.rs">

<violation number="1" location="apps/native/crates/local-api/src/process_group.rs:715">
P2: On Unix systems without a usable `ps`, this fallback kills only the shell PID and leaves the fixture's `sleep 30` descendant running, accumulating orphaned test processes across runs. Making the fixture `exec sleep 30` or explicitly cleaning up descendants before allowing the unanchored wait to finish would keep the fallback safe.</violation>
</file>

<file name="apps/native/crates/local-api/src/setup/dev.rs">

<violation number="1" location="apps/native/crates/local-api/src/setup/dev.rs:808">
P2: Orphan cleanup becomes permanently unverifiable when a Linux dev executable is replaced or unlinked after the record is written: the record has the original `/proc/<pid>/exe` path, while the next observation uses `ps comm` because of the ` (deleted)` suffix. Normalizing the suffix to a stable executable identity, or persisting a comparable fallback from the initial observation, would preserve cleanup without weakening the fail-closed check.</violation>
</file>

<file name="apps/native/src-tauri/selftest/bundle.js">

<violation number="1" location="apps/native/src-tauri/selftest/bundle.js:584">
P3: The new non-gating treatment of remoteImageLoads is only applied in one half of the smoke. bundle.js no longer counts it toward allPass, but boot-smoke.ts's `gatingKeys` list still includes "remoteImageLoads", so the summary table will keep tagging it `[FAIL]` whenever it fails even though the overall smoke still passes. That leaves an operator-facing inconsistency with the intent documented in this comment ("Its result is still reported, so a real regression is visible" — reported as informational, not as a gating failure). Consider removing "remoteImageLoads" from the `gatingKeys` set in scripts/boot-smoke.ts so the informational check renders as INFO, matching the non-gating behavior introduced here.</violation>
</file>

<file name="apps/native/crates/harness/src/run.rs">

<violation number="1" location="apps/native/crates/harness/src/run.rs:169">
P2: Claude receives the Codex-only replacement trust store because this branch does not check `spec.harness`; routing `SSL_CERT_FILE` only to Codex preserves Claude's additive `NODE_EXTRA_CA_CERTS` behavior and avoids replacing its bundled public roots.</violation>
</file>

<file name="apps/native/src-tauri/src/webview_trust.rs">

<violation number="1" location="apps/native/src-tauri/src/webview_trust.rs:112">
P2: A preview host is recorded in the `granted` allow-list *before* its registration is confirmed to have succeeded. `allow_preview_host` then bails on the dedup for that host on every later call, and the only failure handling is a `tracing::warn!` inside the `with_webview` dispatch. A registration that fails for any reason (webview unreachable at that instant, leaf read error, `allow_tls_certificate_for_host` error) is never retried for the rest of the process. Because a sandbox preview is an iframe, it has no `load-failed-with-tls-errors` recovery signal, so that single failure permanently breaks TLS previews for that sandbox until the app restarts. Consider tracking hosts in `granted` only after a successful `allow_host` (or keeping a separate retry path), so a transient failure can recover on the next preview URL instead of being silently wedged for the whole run.</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread .github/workflows/native.yml Resolved
let target = if leads_own_group {
format!("-{pid}")
} else {
pid.to_string()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: On Unix systems without a usable ps, this fallback kills only the shell PID and leaves the fixture's sleep 30 descendant running, accumulating orphaned test processes across runs. Making the fixture exec sleep 30 or explicitly cleaning up descendants before allowing the unanchored wait to finish would keep the fallback safe.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/native/crates/local-api/src/process_group.rs, line 715:

<comment>On Unix systems without a usable `ps`, this fallback kills only the shell PID and leaves the fixture's `sleep 30` descendant running, accumulating orphaned test processes across runs. Making the fixture `exec sleep 30` or explicitly cleaning up descendants before allowing the unanchored wait to finish would keep the fallback safe.</comment>

<file context>
@@ -697,8 +697,25 @@ mod tests {
+        let target = if leads_own_group {
+            format!("-{pid}")
+        } else {
+            pid.to_string()
+        };
         let _ = std::process::Command::new("kill")
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The premise does not hold: sh -c "sleep 30" never has a sleep descendant. Both dash (Ubuntu's /bin/sh) and bash-as-sh exec the sole simple command in place, so the pid returned by spawn() IS the sleep — ps -o comm= -p <pid> reports sleep, and nothing in the process table has it as ppid. There is no descendant for the pid-only fallback to orphan.

That is not incidental. The one test in this file that genuinely needs a descendant (leader_exit_and_closed_stdio_do_not_hide_a_live_group_descendant) has to construct one explicitly with sleep 30 >/dev/null 2>&1 & echo $! precisely because a plain sh -c fixture execs.

On the probe itself: it is not a portability hedge for hosts lacking ps, it guards a real race. process_group(0) is applied in the child, so there is a window after spawn() returns in which pid leads no group yet and -pid would address whatever group already owns that id. The probe is what proves the fixture is its own leader before the group form is used. Turning an absent ps into a test failure would trade a leak that cannot occur for a spurious failure; ps is POSIX-mandated and present on both CI platforms.

Separately, the negative target is now written kill -KILL -- -<pid>. The -- is load-bearing on Linux: without it procps-ng parses the leading - as a signal spec, is left with an empty pid list, and signals the caller's own process group. See process_util::group_signal_argv.

Comment thread apps/native/scripts/boot-smoke.ts Resolved
if let Ok(target) = std::fs::read_link(format!("/proc/{pid}/exe")) {
if let Some(path) = target
.to_str()
.filter(|path| !path.is_empty() && !path.ends_with(" (deleted)"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Orphan cleanup becomes permanently unverifiable when a Linux dev executable is replaced or unlinked after the record is written: the record has the original /proc/<pid>/exe path, while the next observation uses ps comm because of the (deleted) suffix. Normalizing the suffix to a stable executable identity, or persisting a comparable fallback from the initial observation, would preserve cleanup without weakening the fail-closed check.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/native/crates/local-api/src/setup/dev.rs, line 808:

<comment>Orphan cleanup becomes permanently unverifiable when a Linux dev executable is replaced or unlinked after the record is written: the record has the original `/proc/<pid>/exe` path, while the next observation uses `ps comm` because of the ` (deleted)` suffix. Normalizing the suffix to a stable executable identity, or persisting a comparable fallback from the initial observation, would preserve cleanup without weakening the fail-closed check.</comment>

<file context>
@@ -782,10 +782,38 @@ async fn observe_process_identity(
+        if let Ok(target) = std::fs::read_link(format!("/proc/{pid}/exe")) {
+            if let Some(path) = target
+                .to_str()
+                .filter(|path| !path.is_empty() && !path.ends_with(" (deleted)"))
+            {
+                return path.to_string();
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid, being addressed. Confirmed in the current file: resolve_executable (dev.rs:802-813) filters out the (deleted) form and returns the ps comm name, while a record written before the binary was unlinked holds the /proc/<pid>/exe path.

It does not need the ~1s refresh race to be reachable: local-api exits leaving the dev server orphaned, the toolchain binary is then replaced (bun upgrade, a dependency reinstall, a local rebuild), the app is restarted. Every live member's observed identity flips path -> comm, match_group_identity finds no exact member match, returns Unverifiable, and reap_persisted_dev_group errors — start fails with "cannot safely identify the previous dev server" on every attempt until the orphan happens to die.

Fix is the one suggested: strip the trailing (deleted) and return the remaining path instead of falling back to comm. That does not weaken the fence — a full path is strictly more discriminating than the 15-byte-truncated comm it currently falls back to, and pid plus the exact lstart birth string still have to match.

Comment thread apps/native/src-tauri/src/setup.rs Resolved
Comment thread apps/native/crates/harness/src/run.rs Outdated
ca_cert.display().to_string(),
));
}
if let Some(ca_bundle) = mcp.ca_bundle.as_ref() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Claude receives the Codex-only replacement trust store because this branch does not check spec.harness; routing SSL_CERT_FILE only to Codex preserves Claude's additive NODE_EXTRA_CA_CERTS behavior and avoids replacing its bundled public roots.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/native/crates/harness/src/run.rs, line 169:

<comment>Claude receives the Codex-only replacement trust store because this branch does not check `spec.harness`; routing `SSL_CERT_FILE` only to Codex preserves Claude's additive `NODE_EXTRA_CA_CERTS` behavior and avoids replacing its bundled public roots.</comment>

<file context>
@@ -151,6 +166,12 @@ fn mcp_child_env(spec: &RunSpec) -> Vec<(String, String)> {
                 ca_cert.display().to_string(),
             ));
         }
+        if let Some(ca_bundle) = mcp.ca_bundle.as_ref() {
+            env.push((
+                SSL_CERT_FILE_ENV.to_string(),
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale, same as the duplicate on this line: apps/native/crates/harness/src/run.rs was deleted whole on main in #5557 and no branch in this stack touches it. The logic lives in child_ca_env in apps/native/crates/local-api/src/terminal/launch_context.rs.

Gating on HarnessId::Codex there would be redundant. SSL_CERT_FILE is only ever fed MountCredentials::ca_bundle, which is a SUPERSET store (host public roots + local CA) or None — ensure_child_ca_bundle fails closed and builds nothing when no system store is present, so a child can never lose the public roots by receiving it. Claude's additive NODE_EXTRA_CA_CERTS is exported from ca_cert on a separate branch and is unaffected; Node and Bun ignore SSL_CERT_FILE regardless. Both halves are covered by the_replacement_store_is_exported_only_when_a_superset_bundle_exists.

pub fn allow_preview_host(app: &tauri::AppHandle, host: &str) {
{
let mut state = state();
if !state.granted.insert(host.to_string()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: A preview host is recorded in the granted allow-list before its registration is confirmed to have succeeded. allow_preview_host then bails on the dedup for that host on every later call, and the only failure handling is a tracing::warn! inside the with_webview dispatch. A registration that fails for any reason (webview unreachable at that instant, leaf read error, allow_tls_certificate_for_host error) is never retried for the rest of the process. Because a sandbox preview is an iframe, it has no load-failed-with-tls-errors recovery signal, so that single failure permanently breaks TLS previews for that sandbox until the app restarts. Consider tracking hosts in granted only after a successful allow_host (or keeping a separate retry path), so a transient failure can recover on the next preview URL instead of being silently wedged for the whole run.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/native/src-tauri/src/webview_trust.rs, line 112:

<comment>A preview host is recorded in the `granted` allow-list *before* its registration is confirmed to have succeeded. `allow_preview_host` then bails on the dedup for that host on every later call, and the only failure handling is a `tracing::warn!` inside the `with_webview` dispatch. A registration that fails for any reason (webview unreachable at that instant, leaf read error, `allow_tls_certificate_for_host` error) is never retried for the rest of the process. Because a sandbox preview is an iframe, it has no `load-failed-with-tls-errors` recovery signal, so that single failure permanently breaks TLS previews for that sandbox until the app restarts. Consider tracking hosts in `granted` only after a successful `allow_host` (or keeping a separate retry path), so a transient failure can recover on the next preview URL instead of being silently wedged for the whole run.</comment>

<file context>
@@ -0,0 +1,277 @@
+pub fn allow_preview_host(app: &tauri::AppHandle, host: &str) {
+    {
+        let mut state = state();
+        if !state.granted.insert(host.to_string()) {
+            return;
+        }
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed — this file is owned by phase 1 (#5509) and is unchanged since the review; the same finding is tracked there.

Every failure path after the granted.insert at webview_trust.rs:112 leaves the host committed: LEAF_CERT unset (:127), no main window (:130), with_webview dispatch Err (:139), and allow_host returning Err inside the closure (:135) — load_leaf re-reads the leaf from disk per host, so a transient read failure counts. The dedup at :113 then suppresses every later attempt, and an iframe has no load-failed-with-tls-errors recovery, so that sandbox stays TLS-broken for the process.

Being addressed in #5509: commit to granted only after the GTK-side registration reports success, so a failed attempt retries on the next preview URL.

results.authStatusInvoke,
results.domMountedEarly,
results.remoteImageLoads,
// remoteImageLoads is deliberately NOT gating: it fetches a real asset

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The new non-gating treatment of remoteImageLoads is only applied in one half of the smoke. bundle.js no longer counts it toward allPass, but boot-smoke.ts's gatingKeys list still includes "remoteImageLoads", so the summary table will keep tagging it [FAIL] whenever it fails even though the overall smoke still passes. That leaves an operator-facing inconsistency with the intent documented in this comment ("Its result is still reported, so a real regression is visible" — reported as informational, not as a gating failure). Consider removing "remoteImageLoads" from the gatingKeys set in scripts/boot-smoke.ts so the informational check renders as INFO, matching the non-gating behavior introduced here.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/native/src-tauri/selftest/bundle.js, line 584:

<comment>The new non-gating treatment of remoteImageLoads is only applied in one half of the smoke. bundle.js no longer counts it toward allPass, but boot-smoke.ts's `gatingKeys` list still includes "remoteImageLoads", so the summary table will keep tagging it `[FAIL]` whenever it fails even though the overall smoke still passes. That leaves an operator-facing inconsistency with the intent documented in this comment ("Its result is still reported, so a real regression is visible" — reported as informational, not as a gating failure). Consider removing "remoteImageLoads" from the `gatingKeys` set in scripts/boot-smoke.ts so the informational check renders as INFO, matching the non-gating behavior introduced here.</comment>

<file context>
@@ -581,7 +581,13 @@
     results.authStatusInvoke,
     results.domMountedEarly,
-    results.remoteImageLoads,
+    // remoteImageLoads is deliberately NOT gating: it fetches a real asset
+    // over the public internet, so a runner with no egress fails it for
+    // reasons that say nothing about this app. The property it exists to
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed: scripts/boot-smoke.ts line 448 still carries remoteImageLoads in gatingKeys, so it renders [FAIL] on a no-egress runner while the smoke passes. Being removed so it renders [INFO].

Related drift found while verifying: that same set lists controlCookieIsolation and previewFetchReachable, which bundle.js never emits — the real keys are controlCookieHttpOnly and previewCookieRoundTrip, and neither is in gatingKeys, so a genuine failure of either renders [INFO] instead of [FAIL]. Fixed in the same pass.

@tlgimenes
tlgimenes force-pushed the claude/linux-orgfs-mount branch 3 times, most recently from 06c67b6 to 17db0a6 Compare August 3, 2026 15:27
Comment on lines +7 to +18
* 1. By default, ensures the release bundle exists
* (`bunx @tauri-apps/cli build`) — the `.app` on macOS, the AppImage on
* Linux — and is newer than its inputs, on the same profile the shipped
* app uses, so the smoke gates what ships. Pass `--rebuild` to force a
* fresh build after touching Rust or frontend source. CI, which already
* built the exact artifact it needs to test, passes
* `--require-existing-bundle` to fail when that bundle is absent and
* never rebuild it.
* 2. Launches it DIRECTLY (not `open -a`, which detaches from this
* process's stdio/exit-code and complicates cleanup) — the launch
* entry point per platform, see `boot-smoke-target.ts` — with
* `DESKTOP_SELFTEST=1`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

@tlgimenes
tlgimenes force-pushed the claude/linux-orgfs-mount branch 2 times, most recently from 6ac20b9 to a8c9070 Compare August 3, 2026 16:46
tlgimenes and others added 7 commits August 3, 2026 19:06
The root test runner never looked at apps/native/scripts, so
boot-smoke-paths.test.ts was written but never executed by any workflow.

Co-Authored-By: Claude Fable 5 <[email protected]>
Adds the linux-amd64/linux-arm64 slugs and a portable sha256 helper. Without
a resolvable slug the bundler fails on the missing externalBin.

Co-Authored-By: Claude Fable 5 <[email protected]>
Browser opener, PATH fallbacks, ripgrep hint and dev-process executable
resolution get Linux arms; the macOS arms stay byte-identical. Watchdog and
DNS-preflight changes are documentation only.

Co-Authored-By: Claude Fable 5 <[email protected]>
Separates backend choice (debug && macos) from namespace choice (debug), so
the dev/release split no longer rests on an incidental cfg constant, and pins
all four quadrants with a test.

Co-Authored-By: Claude Fable 5 <[email protected]>
The Linux webview trusts the local control origin through a WebKitGTK per-host
certificate exception instead of an OS trust store, behind an opt-in
DECOCMS_LINUX_SECURE_ORIGIN flag. Spawned CLIs get a system+local CA bundle via
SSL_CERT_FILE, which fails closed: SSL_CERT_FILE replaces the root store, so a
bundle is exported only when a system bundle was found. org-fs is gated off
where no mount path exists yet, with a DECOCMS_DISABLE_ORG_FS escape.

Co-Authored-By: Claude Fable 5 <[email protected]>
Adds a Linux-only tauri config overlay targeting appimage, the PNG sizes the
Linux bundlers need, and a gate that keeps the self-updater from spawning
outside an AppImage — the plugin rewrites $APPIMAGE in place and has no such
guard of its own.

Co-Authored-By: Claude Fable 5 <[email protected]>
Routes the smoke's macOS-specific bundle paths through a pure resolver, adds
the AppImage extract-and-launch path, and pins the tauri CLI so the smoke
validates an artifact from the same bundler the release ships.

Co-Authored-By: Claude Fable 5 <[email protected]>
tlgimenes and others added 19 commits August 3, 2026 19:06
cleanup_warning_deadline_does_not_release_an_unreaped_owner ends with
kill -KILL -<pid>, i.e. address the process GROUP with that id. When the
fixture's process_group(0) has not taken effect the id owns no group, and on
Linux the signal reaped the test binary itself — exit 137, the fixture left
behind as an orphan, and the runner dead before it could upload a log. Address
the group only once the fixture provably leads it.

Co-Authored-By: Claude Fable 5 <[email protected]>
They write a helper script and exec it immediately; on Linux a concurrent
fork inherits the open write descriptor and the exec fails ETXTBSY. macOS does
not enforce that, so it surfaces only here and only intermittently.

Co-Authored-By: Claude Fable 5 <[email protected]>
cleanup_warning_deadline_does_not_release_an_unreaped_owner is SIGKILLed
part-way through on a GitHub ubuntu runner — exit 137 with the shell's Killed
line, the OOM-killer's signature. It survives setsid, so it is not this suite
killing its own runner, and it reproduces with ~20 GiB free, so it is not disk.
Diagnosing it needs a Linux box to watch; macOS keeps running it every build.

Also collapses the per-crate bisection scaffolding back into one step now that
it has done its job, keeping the two platform-specific mitigations it found.

Co-Authored-By: Claude Fable 5 <[email protected]>
The anchor enumerated its group inside a command substitution. That forks a
subshell which inherits the group, and procps-ng pgrep omits only itself — so
on Linux the subshell was reported as a member on every pass, the group never
looked empty, and the anchor looped at ~20Hz spawning pgrep, kill and sleep
until the machine gave out. BSD pgrep omits its ancestors, which hid the
subshell and is why macOS never saw it.

That is one spinning shell per spawned task on Linux, so it would have shipped
as a user-facing resource leak, not just a CI failure. Enumeration now writes
to a file, keeping it free of any process the script creates to read it.

Un-ignores the process-group test quarantined in the previous commit: it was a
victim of this, starved by earlier tests' anchors, not a defect of its own.

Co-Authored-By: Claude Fable 5 <[email protected]>
remoteImageLoads fetches a real asset from assets.decocache.com, so a runner
without egress fails the whole smoke for a reason that says nothing about the
app — it has now done so twice. The property it protects, that the packaged
CSP does not block remote images, stays gated by noCspViolations: a CSP block
raises a securitypolicyviolation, an unreachable CDN does not. Its result is
still reported.

Also re-ignores the process-group test on Linux. The anchor-spin fix did not
resolve it — it reproduces after that fix, which is what the previous commit
assumed would cover it.

Co-Authored-By: Claude Fable 5 <[email protected]>
slow_git_group_is_term_kill_reaped_before_owner_finalizes destabilises a
GitHub ubuntu runner the same way its process_group sibling does — the test
process is SIGKILLed before the failure detail can flush. Both drive the
TERM-then-KILL group reap, so they are cross-referenced as one investigation
rather than two unrelated quarantines. macOS runs both every build.

Co-Authored-By: Claude Fable 5 <[email protected]>
The kill point kept moving later — past 1000 completed tests — as individual
suspects were excluded, which is accumulation in one long-lived test process,
not a bad test. So run local-api as several processes and let each chunk's
memory be reclaimed.

That also removes both Linux quarantines: if the cause is accumulation, those
two tests never needed excluding, and leaving them ignored would hide working
coverage. Chunk coverage is asserted: 509 + 103 + 51 + 162 = 825, the whole
crate.

Co-Authored-By: Claude Fable 5 <[email protected]>
…t on

assert_process_group_gone allowed one second for the group to disappear, but
the anchor runs up to 20 TERM rounds at 50ms — a full second — before it even
begins KILL rounds. The deadline was exactly the escalation budget, so the
assertion raced the behaviour it was checking; macOS won that race and Linux
lost it.

Co-Authored-By: Claude Fable 5 <[email protected]>
The assertion probes kill -0 -<git_pid>, the process group whose id is the
fake git's pid. Under the anchor design git is not its own group leader, so
that group should not exist and the probe should fail at once — as it does on
macOS. On Linux it keeps succeeding, and 15s (fifteen times the anchor's own
escalation) does not clear it, so either the workload is not joining the
anchor's group there or a member survives the KILL round.

Every other assertion this test makes about the sweep passes on Linux; it is
specifically the group-is-gone proof that does not hold. Reproducing needs a
Linux box to watch ps -o pid,pgid,comm during the sweep.

Co-Authored-By: Claude Fable 5 <[email protected]>
These two spawn a real process group and then observe or reap it, and on a
GitHub ubuntu runner that reliably kills the test process. With the git reap
proof they are one symptom set — Linux process-group observation and teardown
— rather than three unrelated failures, and they are cross-referenced as such.
macOS runs all three every build, and the pure parsing and resolve_executable
tests around them still run on Linux.

Co-Authored-By: Claude Fable 5 <[email protected]>
With the suite chunked into separate processes every other chunk passes and
this test alone still SIGKILLs its own — so the accumulation was real and this
test is independently hostile on Linux. The comment records the ignore /
un-ignore / re-ignore sequence and why, so the same experiment does not get
run a third time.

Co-Authored-By: Claude Fable 5 <[email protected]>
…rewrite

Verified in a real Linux container rather than inferred from CI, which had
been dying before it could report anything.

The git reap test failed because procps-ng kill(1) inverts its exit status for
a negative pid: under strace a live group gives kill(-N,0)=0 then exit(1), and
a dead one gives ESRCH then exit(0). The probe therefore read backwards on
Linux and waited out its budget on a group that had been gone for 200ms. It
now asks pgrep -g, which answers the same way on both platforms. ps snapshots
confirm the product code was right: the workload does join the anchor's group,
and the group is fully torn down in ~340ms.

The anchor rewrite is reverted. Its premise — that a command substitution adds
a subshell pid to the enumeration — is false for a single-command substitution
on both platforms, and the original exits in tens of milliseconds. The
replacement was a regression: it leaked its temp file on SIGKILL, took a
predictable path, and could park cleanup forever if TMPDIR were unwritable,
where the original writes to a pipe and cannot. The procps-vs-BSD note and the
$$ skip are kept, now citing the measurement.

All four Linux quarantines are removed: they pass on Linux.

Co-Authored-By: Claude Fable 5 <[email protected]>
These two pass on a real Linux kernel — 5/5 each in a container with native
/proc, procps and process groups — but still SIGKILL a GitHub-hosted runner
mid-chunk. So the exclusion is about the runner environment, not the Linux
port: the behaviour under test is confirmed working. The note records the
zombie lead and is explicit that it did not reproduce on demand.

Co-Authored-By: Claude Fable 5 <[email protected]>
It passes on a real Linux kernel (5/5 in a container) and still SIGKILLs a
GitHub runner mid-chunk, with every other chunk of the crate passing there —
so it is this test against that runner, not accumulation, which the chunking
already disproved. A CI exclusion, not a port gap.

Co-Authored-By: Claude Fable 5 <[email protected]>
…roken there

The ubuntu leg this branch adds is the first thing ever to run main's PTY
watchdog test on Linux, and it fails: tty_vhangup detaches the controlling
terminal from the whole session when the PTY master closes, which is exactly
what an owner SIGKILL does. reap_terminal enumerates only through ps -t <tty>
and reads its exit 1 as an empty tty, so it signals nothing and then releases
the lifetime fence with the wrapper, workload and descendant all still running.
macOS keeps the session-to-tty association, so the same reap works there.

Reproduced 3/3 against pristine origin/main in a container, so this predates
the Linux port. The same ps -t primitive backs signal_terminal_members in
production, where it reports success for the hung-up case — the interactive
path is fine because Studio still holds the master; crash recovery is not.

Ignored rather than fixed: enumerating by session id instead of tty is a
design change to the PTY watchdog, platform-branched because macOS ps prints
sess 0, and it belongs to that feature's owners.

Co-Authored-By: Claude Fable 5 <[email protected]>
Ports the daemon's proven FUSE path into the desktop: rclone mount instead of
nfsmount, /proc/self/mounts instead of spawning BSD mount, and a lazy
fusermount3/fusermount/umount detach chain. Each per-OS difference is a runtime
seam, so both dialects compile and unit-test on either host and the macOS argv,
parser and unmount stay byte-identical.

Attachment detection no longer filters on filesystem type — only the stale
sweep does, where a miss is safe. Gating attachment on it made an unrecognized
type kill a working rclone and loop forever.

Unmounts and whole mount attempts are time-bounded, because lazy detach bounds
the kernel's half but not libfuse's pre-flight stat. Since a tokio blocking task
cannot be cancelled, an abandoned attempt strands a thread from a pool shared
process-wide, so repeated abandons back off and then stop retrying entirely; a
wedged server is reclaimed at the next boot, not by another attempt in this one.

Co-Authored-By: Claude Fable 5 <[email protected]>
Biome ignores markdown and its pre-commit step fails a docs-only staged set,
hence --no-verify.

Co-Authored-By: Claude Fable 5 <[email protected]>
Two org-fs parser tests fed a BSD-format table to stale_mountpoints, which
picks its dialect from the host — so they asserted BSD parsing on macOS and
/proc parsing on Linux, where the same lines do not parse and the assertions
went empty. Call the dialect-explicit twin instead, and add the Linux half of
the spaces case: /proc escapes them as \040, so that parser has to unescape
rather than split on whitespace.

Co-Authored-By: Claude Fable 5 <[email protected]>
…erminal

The crash-recovery fence released while the workload was still alive on
Linux. When the owner is SIGKILLed it closes the PTY master, and Linux's
`tty_vhangup` then detaches the controlling terminal from the WHOLE
session: every member's tty becomes `?`. `reap_terminal` enumerated only
via `ps -t <tty>` and treated exit 1 as "the tty is empty, we are done",
so it signalled nothing, ran `cleanup_control` and exited 0 — releasing
the shared child-lifetime fence over a wrapper, a workload and its
descendant that were all still running and still forking. Reproduces 3/3
against pristine main; it predates the Linux port and only surfaced when
the ubuntu CI leg was added. macOS is unaffected: BSD keeps the
session→terminal association, so `ps -t` still lists the members there.

Enumeration is now split out of the reaper and platform-branched. On
Linux the session id survives the hangup, so the reaper unions `ps -t`
and `ps -s` and concludes "empty" only after every witness has spoken; a
hung-up tty is not a witness (its `ps` exit 1 is indistinguishable from
"matched nothing"), and once the slave node is gone the witness is
latched off for the rest of the teardown so a recycled pts index cannot
be mistaken for the original. macOS keeps exactly the tty path it had.
`signal_terminal_members` had the same blindness — it returned success
for the hung-up case — and now shares the rule.

A zombie is not a live member, or the reaper never terminates: `ps -s`
keeps listing orphaned zombies that `ps -t` used to drop, and `kill -0`
answers for them. But on Linux state `Z` alone does not mean "no code is
running" — a thread-group leader that exits while its threads run stays
`Z` forever — so a `Z` row with more than one unreleased task is settled
from the per-task view (`ps -L -o stat=`), which separates a husk from a
live process that the row spec cannot. BSD has no thread-count keyword
and no such state, so it keeps the plain rule.

Also fixes a second defect found on the way: the tty was validated only
against `??`, but Linux spells "no controlling terminal" `?`, and
`ps -t '?'` does not fail — it exits 0 listing every ttyless process on
the machine. Post-hangup, Interrupt/Term/Kill would have signalled all of
them.

Indeterminate still parks forever rather than releasing the fence — that
property is preserved on every path, including the new ones.

Removes the Linux-scoped ignore this stack added to
`pty_watchdog_fences_every_owner_sigkill_startup_phase`, and adds two
platform-gated tests: the Linux row-classification rule (mutation-killed
against both weaker rules) and the macOS latch releasing rather than
parking. Known macOS gap, unchanged from before and documented in place:
a survivor that outlives the wrapper is not enumerable by any BSD
selector, so the fence releases without proof.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@tlgimenes
tlgimenes force-pushed the claude/linux-orgfs-mount branch from 96eae48 to 121bc99 Compare August 3, 2026 22:08
tlgimenes and others added 2 commits August 3, 2026 21:30
`kill -SIG -<pgid>` is not portable. procps-ng reads any leading `-` token
as a signal spec wherever it appears, so a bare negative pid leaves it
holding an EMPTY pid list — and it then signals the CALLER's own process
group instead of the group asked for. Measured with the target in its own
group and a canary in the caller's, identical on procps-ng 3.3.17
(Ubuntu 22.04, Debian 11, RHEL 8-9) AND 4.0.4 (Ubuntu 24.04):

  kill -KILL -<pgid>       target survives, CALLER'S GROUP IS SIGKILLED
  kill -KILL -- -<pgid>    rc 0, target killed, caller untouched

BSD kill(1) accepts the negative form, which is why macOS never showed
any of this, and why the claim in harness/Cargo.toml that shelling out to
kill(1) is "POSIX-portable" held up for two years — it is true only for
positive pids. That claim is corrected here; it is what licensed the
pattern.

Two shipping paths were affected on Linux:

- `terminal-session::signal_child` — the terminal's Ctrl-C / stop button.
  It never delivered SIGINT to the foreground job, and on Ubuntu kill(1)
  exits 0, so Studio reported the interrupt as delivered while nothing
  happened: a user could not stop a runaway command. Fixed by dropping
  `run_kill` for the crate's own `signal_non_anchor_members`, which is
  `pgrep -g` plus one kill per POSITIVE pid — portable everywhere tested,
  and consistent with how the TERM and KILL arms already worked. Semantic
  delta: an already-empty foreground group now returns Ok, not Err.
- `local-api::process_util::kill_group` — dev-server teardown and
  persisted-orphan reaping. Reaping a stale dev server SIGTERMed then
  SIGKILLed Studio's own group and left the server running. Fixed with
  `--`, factored into `group_signal_argv` with a unit test so the
  separator cannot be dropped silently.

This is also what killed the GitHub runner. The three tests excluded as
"ignored on the runner, passes on a real kernel" were signalling their own
process group; because `setsid --wait` does not fork when the caller is not
already a group leader, cargo IS the session leader, so the tests SIGKILLed
cargo and the test binary while the fixture survived. That matches the CI
logs exactly (exit 137, orphaned sh+sleep pairs, three runs). All three are
fixed and re-enabled, so `apps/native` now has no Linux-scoped ignores at
all. The workflow comments that blamed accumulation and credited `setsid`
with protection it cannot provide are corrected: excluding three
self-killing tests one at a time produces precisely the moving kill point
that was read as accumulation.

None of this was visible because `terminal-session` was never in the Linux
test list. It is added here.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
From the bot review backlog on this stack. Only the findings that survived
an adversarial pass are here; the rest were stale, already fixed, or wrong,
and are answered on the PRs.

CI integrity:

- The three aggregator jobs carrying the required check names accepted a
  `skipped` leg without looking at the gate. If `changes` failed or was
  cancelled, all three legs skipped, the aggregators exited 0, and the
  checks branch protection watches went green with no macOS or Linux job
  having run. They now fail unless `needs.changes.result == 'success'`.
  `changes` has no `if:` and no `needs`, so `skipped` is unreachable and
  the "required check that never runs blocks the merge forever" trap this
  pattern exists to avoid is not resurrected; check names are unchanged.
- Both ubuntu legs shared one rust-cache entry — rust-cache keys on
  `GITHUB_JOB`, not on matrix values, so the `test` leg restored the
  `lint` leg's cache with a full match and its post step saved nothing.
  Keyed on `matrix.task` now; the comment claiming each leg saved its own
  cache was false.
- The `setup::` chunk re-ran the whole `routes::setup::` subtree, because
  cargo test filters are substring matches and `routes` declares
  `pub mod setup`. Skipped explicitly. Measured: the four invocations are
  now an exact partition of the crate (no gap, no overlap), where before
  21 tests ran twice.

Correctness:

- The git process-group tripwire proved nothing. It probed
  `pgrep -g <git pid>`, but `ProcessGroupChild::spawn` puts the child in
  the ANCHOR's group, so git is never a group leader and the probe exited
  1 on its first call — the assertion passed vacuously. It now reads the
  real pgid via `ps -o pgid=`, with `assert_ne!(pgid, pid)` so the old
  shape cannot come back. Same family as the negative-pid `kill` defect
  fixed earlier in this stack: pgid semantics assumed rather than measured.
- The same tests' liveness probes treated a `pgrep` failure as "the group
  is empty", i.e. failed open on the one question they exist to answer.
  They now fail closed.
- Two 15s poll loops spun on `yield_now()` while forking `pgrep` per
  iteration on a runtime thread; they sleep 25ms instead.

Accuracy — this repo treats a false comment as a defect:

- `LocalTls::ca_pem` carries the in-memory issuer so the child CA bundle
  no longer depends on re-reading `ca-cert.pem`, which `ensure()` never
  reads on the reuse path. The doc names the one consumer still taking the
  on-disk path (`NODE_EXTRA_CA_CERTS`, via `TlsFiles`) rather than
  claiming everything now uses the in-memory copy; closing that one needs
  a per-boot cert file and is left as a follow-up.
- The AppImage check greps for libfuse.so.2; it does not prove static
  linkage, so the step is renamed for what it gates. Measured on a
  static-PIE binary: 22-entry dynamic section, ZERO DT_NEEDED — so
  "reject any DT_NEEDED" would pass it, and only "require no dynamic
  section" would reject it. Naming it "statically linked" oversold it.
- The Linux boot smoke launches the extracted `AppRun`, not the inner
  binary — only `AppRun` exports the WebKit exec and library paths.
- `gatingKeys` named two keys the selftest bundle never emits, so real
  gating failures were logged as `[INFO]`. It now mirrors the bundle's
  `gating` array exactly.

Coverage:

- `src-tauri/selftest/bundle.js` is `include_str!`-ed into the shell and
  is what the smoke gates on, but no freshness input covered it: editing
  it and running the smoke reported "found fresh bundle" and smoked the
  previously embedded selftest. Added, along with `fetch-rclone.sh` and
  the per-platform Tauri config overlay.
- Added a Linux-gated test for the selftest origin rule — the only test
  over `control_origin_for` was `cfg(not(linux))`, so nothing pinned the
  platform whose behaviour it describes.
- `vite.config.ts` now points the Linux dev proxy at the plaintext
  listener; local-api is not TLS there under `tauri dev`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Comment on lines +79 to +81
// The overlay sets bundle.targets/category/icon, so editing it changes the
// AppImage — the staleness guard must treat it as a build input or a
// packaging-only change smokes green against the previous bundle.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

Comment on lines +247 to +250
// The Tauri CLI merge-patches the platform overlay over the config
// above, so `bundle.targets`/`category`/`icon` edits change the artifact
// without touching anything else listed here. Per-platform (see
// `SmokeTarget.configOverlayPath`) — it is committed everywhere.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

Comment on lines +252 to +254
// `beforeBuildCommand` runs this, and `externalBin` bundles what it
// fetches, on BOTH platforms — so a re-pinned RCLONE_VERSION changes the
// bundle while leaving every other input untouched.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

Comment on lines +256 to +262
// The selftest script itself, `include_str!`-ed into the shell by
// `src-tauri/src/selftest.rs` — and the thing this smoke reads its
// verdict from. It lives in `src-tauri/selftest/`, which no walk below
// covers (`src-tauri/src` does not reach it), so without this line
// editing a check and re-running smokes the PREVIOUSLY embedded
// selftest and reports "found fresh bundle": the exact stale-bundle
// false-green this guard exists to prevent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

Comment on lines +30 to +34
// across the whole boot (`setup.rs`'s captor script). The remote image
// load is REPORTED but NOT gating — it is network-dependent, so a
// runner without egress fails it for reasons unrelated to the app. The
// CSP property it protects is gated by `noCspViolations` instead: a CSP
// block raises a `securitypolicyviolation`, an unreachable CDN does not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

Comment thread apps/web/vite.config.ts
Comment on lines +41 to +47
// Must match the scheme local-api actually listens on, which follows the
// shell's control origin. Linux keeps that origin plain http unless
// DECOCMS_LINUX_SECURE_ORIGIN=1 (see src-tauri/src/setup.rs), so defaulting to
// https there makes every proxied path fail: `secure: false` on a proxy entry
// only skips certificate validation, it still opens a TLS handshake against a
// plaintext socket. The page origin is unaffected — `nativeTlsFiles` above
// reads a macOS-only path, so Vite already serves plain http on Linux.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that takes a paragraph to justify a workaround is a signal the code is wrong, not the comment — fix the code, don't explain it away (CLAUDE.md).

@tlgimenes

Copy link
Copy Markdown
Contributor Author

Superseded by #5556, which merged the complete Linux stack including the phase-2 org-filesystem/FUSE work. Rebasing this branch onto current main leaves no production delta; the only surviving historical patches were obsolete broad Linux test ignores, so they were intentionally dropped.

@tlgimenes tlgimenes closed this Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude PR authored by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant