Repository navigation
fix(daemon): keep running when detaching from the console fails - #304
Merged
Merged
Conversation
sergej-koscejev
marked this pull request as ready for review
November 19, 2026 20:27
sergej-koscejev
enabled auto-merge
November 19, 2026 20:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #299
Summary
When the native call that detaches the daemon cannot be set up, the daemon now writes a warning to stderr (
daemon.log) and keeps running without detaching, as it did before #13. Other detach failures still stop the daemon.The warning, for the failure in #299:
Refs, notFixes: the reporter's daemon should now start, but why JNA does not loadjnidispatch.dllon their machine is still unknown.skills/mops-daemon/SKILL.mdnow says that such a daemon keeps running attached and where the warning goes.Sibling paths: only the daemon detaches (
DaemonProcess.detachis called only fromMopsDaemonCommand.runand fromDaemonControlIntegrationTest).Evidence
Before:
DaemonProcessTest(committest(daemon): …): 2 of 3 tests fail. A detacher that throwsUnsatisfiedLinkErrororIllegalCallerExceptionendsdetachwith that error.After: all 3 pass. Those two write a warning naming the API and the error, and
detachreturns. A detacher that throwsIllegalStateException(Could not detach daemon session: errno 1) still fails and writes nothing.:daemon:test, andDaemonStartupIntegrationTest+DaemonControlIntegrationTeston MPS 2024.1.6 (JBR 17, JNA path) and 2026.1.1 (FFM path): all pass (:daemon:test489 tests; 5 integration tests per version).Where to look
DaemonProcess.detach(warnings, apiDescription, detachNatively): which exceptions count as "cannot be set up". For the Foreign Function API I left outIllegalArgumentException(SymbolLookup.libraryLookupcannot loadkernel32) andNoSuchElementException(symbol not found), because catching them around the whole call could also hide bugs, andkernel32/libc always exist.refactor(daemon): …adds the seam withwarningsandapi(laterapiDescription) unused, so the test commit compiles and fails on behavior.Merge Danger
Blast Radius: daemon startup. Where JNA cannot load, the daemon now stays attached to its launching console or process group instead of exiting, so it can be stopped together with them.