For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox syntax for tracking.
Goal: Prepare the user-selected next iPad experiment with the MIDI send worker disabled and its enqueue path discarding messages.
Architecture: Add an immutable launch option to MidiSender. Default behavior remains enabled; SMARTGRID_MIDI_SEND_THREAD=0 skips thread creation and drops messages before touching its queue. Low-rate diagnostics expose the chosen mode, successful entry to run, queue depth and discard count.
Tech Stack: Existing C++17/JUCE8.0.15 iOS diagnostic worktree, signed Xcode Release build, authenticated Wi-Fi device tools and K-Mix3/4 external capture.
The user explicitly selected disabling the MIDI send thread and discarding enqueue requests as the next experiment. This intervention removes both worker wakeups and the traffic sent by that worker; a changed outcome cannot distinguish those two effects by itself. Direct WB LED/SysEx sends from the audio path remain active. Normal DSP/UI, the I/O worker, tracing, inputs0/outputs4 and the permanent48k/512 baseline remain in place. Existing authorization permits building/deploying experiments; no reconfirmation is needed for this selected change.
The current SonoBus hour must finish and its archive be preserved before deploying or launching another app. Prepare source now; defer heavy build/device activity until capture completion. Preserve the old signed package for rollback. Development stays in the existing diagnostics worktree; no main changes, commits, landing or cleanup of unrelated artifacts.
Files:
Interface and code contract:
Add these public members to MidiSender near existing state:
const bool m_sendThreadEnabled = juce::SystemStats::getEnvironmentVariable("SMARTGRID_MIDI_SEND_THREAD", "1") != "0";
std::atomic<bool> m_workerRunning{false};
std::atomic<size_t> m_discardedMessages{0};
After route initialization, before realtime options, return from the constructor when disabled and log the mode once. In enabled mode preserve the existing realtime options, capture startRealtimeThread’s bool result and log it truthfully; add no fallback or scheduling adjustment. Set m_workerRunning true on entry to run and false on exit using relaxed atomics.
At the beginning of SendMessage:
if (!m_sendThreadEnabled)
{
m_discardedMessages.fetch_add(1, std::memory_order_relaxed);
return;
}
Add a const LogDiagnostics method emitting one aggregate line with enabled, m_workerRunning, m_queue.Size and m_discardedMessages. Call it just after the cached platform-state stores in the existing one-second timer branch. Do not add a separate timer. Preserve route allocation, ProcessMessagesOut buffer clearing, all direct sends and shutdown behavior.
This prototype can be prepared without claiming it fixes audio. Source review and build are not a substitute for observing that the worker is absent and queue depth stays zero. A clean trial implicates the disabled path only if the control worker actually ran; continued periodic damage is still a failure of that symptom even if sporadic gaps disappear. Preserve the previous SonoBus outcome and unverified settings as distinct evidence. Do not reclassify any partial trial as a clean hour.