Skip to content

fix(desktop): keep JVM warnings off the native messaging host's stdout - #435

Merged
linroid merged 1 commit into
mainfrom
fix/native-host-stdout
Oct 8, 2026
Merged

linroid merged 1 commit into
mainfrom
fix/native-host-stdout

Conversation

@linroid

@linroid linroid commented Oct 8, 2026

Copy link
Copy Markdown
Owner

The browser extension can no longer reach the desktop app (0.3.0). Chrome reads the native messaging host's stdout as length-prefixed messages, and since the class data sharing archive (#421) the JVM writes a CDS warning there before main runs:

[0.005s][warning][cds] Required classpath entry does not exist: /Users/runner/work/Ketch/…/Ketch.app/Contents/app/desktop.jar

Chrome takes the first four bytes, [0.0, as an ~800 MB length and drops the connection, so the extension reports the app as unreachable. The host's own reply follows the warning and is correct.

Change

  • The launcher passes -Xlog:all=off:stdout -Xlog:all=warning:stderr, so the JVM's warnings go to stderr and stdout carries only the reply.
  • These come after JAVA_TOOL_OPTIONS, so diagnostic -Xlog given there now only shows when it writes to a file. The CDS check in docs/development/testing.md now uses -Xlog:class+load,cds:file=….
  • AGENTS.md notes that nothing else may write to the host's stdout.

Testing

On macOS arm64, I built the image with createDistributable, copied it elsewhere and renamed the build output away, as on a user's machine, then sent the copy's --native-messaging-host a Chrome-style connect message:

  • Before: stdout began with the CDS warning, followed by the reply.
  • After: stdout held only the JSON reply, and the warning went to stderr.

Diagnostic -Xlog set in JAVA_TOOL_OPTIONS still writes to a file; stdout and stderr outputs from there no longer show.

Not fixed here

The warning means installed apps reject ketch.jsa entirely: 0 classes come from the archive in the 0.3.0 release in /Applications. JDK 21 checks each jar at its dump-time path, which only exists on the machine that built the image, and also compares each jar's mtime. That is left for a separate change.

The browser extension could no longer reach the desktop app. Chrome
reads the native messaging host's stdout as length-prefixed messages,
and since the class data sharing archive (#421) the JVM writes a CDS
warning there before main runs:

  [0.005s][warning][cds] Required classpath entry does not exist: ...

Chrome takes "[0.0" as an 800 MB length and drops the connection, so
the extension reports the app as unreachable.

The launcher now passes -Xlog:all=off:stdout -Xlog:all=warning:stderr,
keeping the JVM's own warnings on stderr. Diagnostic -Xlog given in
JAVA_TOOL_OPTIONS still works when it writes to a file; the CDS check in
the testing docs now does.

The warning itself means the archive is rejected in installed apps: JDK
21 checks each jar at its dump-time path, which exists only on the
machine that built the image. That is left for a separate change.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Test Results

 1 406 files  ±0   1 433 suites  ±0   10m 32s ⏱️ -8s
 9 260 tests ±0   9 031 ✅ ±0  229 💤 ±0  0 ❌ ±0 
10 657 runs  ±0  10 428 ✅ ±0  229 💤 ±0  0 ❌ ±0 

Results for commit e35a8f4. ± Comparison against base commit 55ed265.

@linroid
linroid merged commit b8f6f31 into main Oct 8, 2026
12 checks passed
@linroid
linroid deleted the fix/native-host-stdout branch October 8, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant