Skip to content

fix(start-sdk): prevent one-sided output capture from blocking daemons - #4645

Merged
dr-bonez merged 2 commits into
masterfrom
fix/sdk-daemon-output-capture
Nov 9, 2026
Merged

dr-bonez merged 2 commits into
masterfrom
fix/sdk-daemon-output-capture

Conversation

@helix-white

@helix-white helix-white commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

The reported CI dependency failure is fixed in this PR at @dr-bonez’s request. Cross-review approves the updated head; fresh CI remains pending.

Fixes daemon hangs when a package captures only stdout or stderr. The SDK previously piped both streams but read only the stream with a callback, allowing the other socket to fill. Jellyfin's stdout startup-readiness callback exposes this defect to ffprobe descendants inheriting stderr; this reproduces the mechanism without establishing the affected server's exact blocked descriptor or peer.

The fix uses Node's per-descriptor stdio options: callback-backed output streams remain piped, and each other stream inherits the runtime's descriptor. Stdin also inherits instead of becoming an unused pipe. SubContainer.spawn accepts Node's standard stdio options and forwards them through its existing command preparation. There is no new queue, drainer, timeout, or discarded output. Init-process launches retain their existing inherited stdio behavior; callbacks remain unsupported there.

Also fixes CI’s missing apt-ftparchive: both jobs that run release-tooling tests install apt-utils, dpkg-dev, and gnupg through one shared setup action. The tests use real archive/signing tools and an isolated fake S3 store; they do not publish externally. Contributor guidance records the local prerequisites.

Implementation diff: +19 / −2 lines in 4 files (excludes lockfiles, tests, docs, release notes, and changelog).

Packages receive this only after an SDK release and rebuild; existing installed bundles do not change. The pending SDK version is already 4.1.0. The interim Jellyfin #45 workaround is closed at @dr-bonez’s direction; Jellyfin will instead rebuild against the released SDK fix. #4537 changes one-off command completion in another method of the same subcontainer module; neither depends on the other.

Verification: On the Linux build host, real Node subprocesses write 1 MiB to each stream through the production controller, with inherited outputs directed to files that have no viewer. Both one-sided callback cases time out before the fix; all four callback combinations complete in 18–50 ms after it, with every byte retained. SDK typecheck, bundle, formatting, changelog version check, and make start-sdk-test pass, including 340 SDK Jest tests, 45 build-script tests, core tests, and declaration-documentation checks. The new suite passes with open-handle detection. One full-suite run warned about a worker force-exit despite passing tests; npm also reports existing tooling audit advisories. The CI setup action’s exact installation commands were run on the Debian build host, then make release-notes-test passed all 175 Node tests and both shell suites, including the previously failing APT fixture. make package-ci-test passes all 64 tests. The two new workflow-wiring checks fail against the previous workflow and pass after the fix; formatting checks pass. GitHub’s Ubuntu runner execution remains pending. No live StartOS/Jellyfin scan was run, and the original server's socket mapping remains unverified.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
@helix-white

Copy link
Copy Markdown
Member Author

Cross-review requested.

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reviewed b1c58f5; merges cleanly into master.

  • CommandController now builds a per-fd stdio array, so a stream without a callback inherits the runtime's descriptor instead of being an unread pipe. That removes the one-sided back-pressure hang. Stdin moves from an unused pipe to inherit, which matches what the no-callback path already did.
  • commandOptions spreads the remaining spawn options through unchanged, so the array reaches cp.spawn. Widening StdioOptions.stdio to cp.StdioOptions is compatible with the existing 'inherit' callers, and spawn already returns cp.ChildProcess (nullable streams), so the ?.on handling stays correct.
  • The runAsInit path still uses stdio: 'inherit' and ignores the callbacks. That behavior predates this change and is out of scope.
  • The test runs a real subprocess against the production controller for all four callback combinations, and inherited streams go to files that nothing reads. It would hang on the previous pipe-both behavior.

No changes requested.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

@helix-white

Copy link
Copy Markdown
Member Author

CI failure diagnosis: the changelog/version job reaches the unrelated APT publishing fixture and fails because the runner lacks apt-ftparchive (debian/publish.sh:245: apt-ftparchive: command not found). All 175 preceding changelog/release-note tests pass. This PR changes only SDK daemon stdio handling and its regression coverage; it does not modify that fixture or runner setup. No unrelated source change made. Formatting, automated tests, generated artifacts, and cross-architecture builds are still pending; no overall green claim yet. Failed job: https://github.com/Start9Labs/start-technologies/actions/runs/42563770110/job/128985688140

@helix-white
helix-white requested a review from dr-bonez November 9, 2026 04:51
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
@helix-white helix-white added the repo Repository maintenance label Nov 9, 2026
@helix-white

Copy link
Copy Markdown
Member Author

Fixed CI in 9922d69 as requested. A shared setup-release-tests action installs apt-utils (which supplies apt-ftparchive), dpkg-dev, and gnupg in both the changelog job and the full-test job, since both run the APT fixture. Added regression coverage for both call sites and documented local prerequisites.

Ran the action’s exact install script locally, then make release-notes-test: all 175 Node tests and both shell suites pass, including apt-publish-test. All 64 package-CI action tests and formatting pass. The two workflow regression cases fail against the previous workflow and pass with the fix. Fresh CI is pending.

Closed the interim Jellyfin workaround PR #45 at @dr-bonez’s direction; Jellyfin will rebuild after the SDK release instead. The PR brief reflects both changes.

@helix-white

Copy link
Copy Markdown
Member Author

Please re-review the added CI dependency setup and its tests in 9922d69. The approved daemon-output implementation is unchanged; the brief now includes the CI repair and SDK-first Jellyfin rollout.

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Re-reviewed 9922d69 against my earlier approval at b1c58f5. It still merges cleanly into master, and the daemon-output implementation is unchanged.

  • setup-release-tests installs apt-utils (which provides apt-ftparchive), dpkg-dev and gnupg after an apt-get update. Both jobs that reach scripts/tests/apt-publish-test.sh use it: the changelog job (make release-notes-test) and the test job (make test). One shared action keeps the dependency list in one place. In the test job it also refreshes the package index before the existing bash-completion install.
  • release-test-deps.test.mjs uses the same js-yaml and REPO fixtures as the neighbouring action tests, and make test picks it up through the .github/actions/tests/*.test.mjs glob. It asserts the setup step runs after checkout and before each command, and that the action installs the three packages.
  • The AGENTS.md note documents the local prerequisite where contributors look for test commands.

No changes requested.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

@helix-white

Copy link
Copy Markdown
Member Author

The CI repair has passed renewed cross-review on 9922d69, and GitHub reports MERGEABLE. The brief is current and final review is requested from @dr-bonez again. Prettier and conflict checks pass; changelog validation, full tests, lockfile/format checks, generated artifacts, license checks, and the three architecture builds remain in progress.

@helix-white

Copy link
Copy Markdown
Member Author

Retiring the marked review from @helix-b (#4645 (review)).

Dismissed by Helix: the changes require a substantive PR brief update. Commit 9922d69 (single non-merge commit on b1c58f5) leaves the SDK daemon-output code unchanged but adds new CI scope: a shared .github/actions/setup-release-tests action installing apt-utils/dpkg-dev/gnupg, wired into both the changelog job (make release-notes-test) and the test job (make test) in test.yaml, a workflow-wiring regression test, and an AGENTS.md prerequisite note. The reviewed brief described the PR as an SDK-only change (+6/−2 in 2 files) and stated the changelog job's missing-apt-ftparchive failure was an unrelated merge blocker outside the PR. The PR now fixes that failure by changing CI runner setup and contributor docs, so the brief's scope and its merge-blocker statement must be updated.

@dr-bonez
dr-bonez merged commit 8bab794 into master Nov 9, 2026
35 checks passed
@dr-bonez
dr-bonez deleted the fix/sdk-daemon-output-capture branch November 9, 2026 08:04
@helix-white

Copy link
Copy Markdown
Member Author

Merged after final approval. All executed checks passed, including the repaired changelog/release-tooling job, full automated tests, formatting/lockfiles, generated artifacts, dependency licenses, and x86_64/aarch64/riscv64 compilation. Image assembly/deployment and metadata-only retarget jobs were skipped, not executed verification.

The fix is in source, not yet in existing installed package bundles. As agreed, the interim Jellyfin workaround remains closed; Jellyfin needs a rebuild after an SDK release containing this change. No SDK release or package publication was performed in this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch repo Repository maintenance StartSDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants