Skip to content

fix: keep EQ FluidSynth alive without a server - #1365

Merged
ChrisTitusTech merged 2 commits into
mainfrom
agent/eq-midi-local-lifecycle
Aug 4, 2026
Merged

fix: keep EQ FluidSynth alive without a server#1365
ChrisTitusTech merged 2 commits into
mainfrom
agent/eq-midi-local-lifecycle

Conversation

@ChrisTitusTech

Copy link
Copy Markdown
Owner

Follow-up to #1364 after live Fedora 44 validation exposed a FluidSynth lifecycle issue.

What changed

  • Keep FluidSynth's local shell loop alive through a private mode-0600 FIFO instead of --server.
  • Remove the FIFO alongside PID cleanup and reject unsafe runtime paths.
  • Add mkfifo to installer and catalog prerequisites.

Root cause

FluidSynth 2.5.4 exits normally when --no-shell is used without server mode. Server mode keeps it alive but opens TCP port 9800 on all interfaces. The private FIFO preserves the process without a network listener.

Validation

  • Live Fedora 44 installation against EverQuest Legends in native Lutris.
  • Verified the ALSA EQ-Legends client and port while running.
  • Verified no FluidSynth TCP listener.
  • Verified watcher-driven shutdown at 65 seconds removed the process, PID file, FIFO, and launch tokens.
  • sh -n, ShellCheck, checkbashisms, and shfmt pass for all three scripts.
  • cargo fmt --all --check, cargo test --no-fail-fast --package linutil_core, cargo clippy -- -Dwarnings, cargo xtask docgen, and git diff --check pass.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when starting and stopping the EverQuest Legends MIDI fix.
    • Added safer cleanup of temporary runtime resources during failures, recovery, and shutdown.
    • Added validation to prevent cleanup of invalid or unsafe paths.
    • The feature now checks that required system support is available before running.

Walkthrough

The EQ Legends MIDI hooks now use a secure runtime FIFO for FluidSynth standard input. Startup and stop paths remove the FIFO during normal shutdown and failure recovery. Requirement checks now require mkfifo.

Changes

EQ Legends MIDI FIFO lifecycle

Layer / File(s) Summary
FIFO prerequisite checks
core/tabs/gaming/eq-legends-midi.sh, core/tabs/gaming/tab_data.toml, core/tabs/gaming/eq-legends-midi-start.sh
The lifecycle checks and command precondition now require mkfifo.
Startup FIFO management
core/tabs/gaming/eq-legends-midi-start.sh
The startup hook creates a mode-0600 FIFO, connects FluidSynth standard input to it, and removes it during recovery and readiness failures.
Stop-hook FIFO cleanup
core/tabs/gaming/eq-legends-midi-stop.sh
The stop hook rejects symlinks and non-FIFO paths, then removes the FIFO across missing, invalid, stale, unrelated, and successful shutdown states.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StartHook
  participant RuntimeFIFO
  participant FluidSynth
  participant MIDIReady
  StartHook->>RuntimeFIFO: Create and open FIFO
  StartHook->>FluidSynth: Launch with FIFO as standard input
  FluidSynth->>MIDIReady: Expose MIDI port
  StartHook->>RuntimeFIFO: Remove FIFO on failure or timeout
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: keeping EQ FluidSynth alive without using server mode.
Description check ✅ Passed The description directly explains the FIFO lifecycle change, safety cleanup, prerequisites, root cause, and validation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/eq-midi-local-lifecycle

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Owner Author

@codex review

@github-actions github-actions Bot added the script label Aug 4, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 9b95cb93c9

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ChrisTitusTech
ChrisTitusTech marked this pull request as ready for review August 4, 2026 03:38

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
core/tabs/gaming/eq-legends-midi-start.sh (1)

172-172: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use command_exists for executable checks.

Line 172 uses command -v instead of the shared helper used by core/tabs/gaming/eq-legends-midi.sh Line 79.

Proposed change
-command -v mkfifo >/dev/null 2>&1 || fail "mkfifo is not installed"
+command_exists mkfifo || fail "mkfifo is not installed"

As per coding guidelines, use command_exists for executable checks.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@core/tabs/gaming/eq-legends-midi-start.sh` at line 172, Replace the direct
command -v check in the mkfifo validation with the shared command_exists helper,
preserving the existing fail message and behavior when mkfifo is unavailable.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@core/tabs/gaming/eq-legends-midi-start.sh`:
- Line 172: Replace the direct command -v check in the mkfifo validation with
the shared command_exists helper, preserving the existing fail message and
behavior when mkfifo is unavailable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f971f1f-ec45-4137-a6b2-ba0f4a7de028

📥 Commits

Reviewing files that changed from the base of the PR and between 27b6683 and 42650c9.

📒 Files selected for processing (4)
  • core/tabs/gaming/eq-legends-midi-start.sh
  • core/tabs/gaming/eq-legends-midi-stop.sh
  • core/tabs/gaming/eq-legends-midi.sh
  • core/tabs/gaming/tab_data.toml

Copy link
Copy Markdown
Owner Author

Reviewed the CodeRabbit nitpick on command_exists: eq-legends-midi-start.sh is a standalone extracted Lutris lifecycle hook and intentionally does not source common-script.sh. Its hook-local dependency checks consistently use command -v; replacing only the mkfifo check would call an undefined helper at runtime. No change is needed for that approved nitpick.

@ChrisTitusTech
ChrisTitusTech merged commit cc96abb into main Aug 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant