Repository navigation
feat: Stream Connect's startup logs to stderr while waiting for it to start - #72
Merged
Merged
Conversation
This was referenced Oct 23, 2026
nealrichardson
commented
Oct 23, 2026
nealrichardson
left a comment
Collaborator
Author
There was a problem hiding this comment.
Seems to make sense, just need to rebase and resolve conflicts
… start While waiting for the HTTP server to start, print each new line of the container log to stderr as it appears, so CI runs don't look hung. Streaming stops once Connect is up. --quiet suppresses the stream, and failure paths print only the log lines that haven't been shown yet. Fixes #13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nealrichardson
force-pushed
the
stream-startup-logs
branch
from
October 23, 2026 18:40
a58d768 to
2408fc2
Compare
Collaborator
Author
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.
Fixes #13.
What it does
While with-connect waits for Connect's HTTP server to start, it prints each new line of the container log to stderr as it appears. In CI you can see Connect working instead of a silent step that looks hung. Streaming stops as soon as Connect is up, so a
-- COMMAND's output isn't mixed with Connect's logs. Nothing new goes to stdout, which in start-only mode carries only theCONNECT_API_KEY=/CONNECT_SERVER=/CONTAINER_ID=lines that callersevalor append to$GITHUB_OUTPUT.Design choices
logs(stream=True, follow=True).wait_for_http_server()already pollscontainer.logs()every 2 seconds. A newContainerLogshelper remembers how many bytes it has printed and prints only the new tail on each poll. A follow stream blocks, so it would need a thread or non-blocking reads, plus cleanup when startup finishes or fails. Polling reuses the existing loop and adds no concurrency. The cost is that lines show up in batches of up to 2 seconds, which is fine for "is it doing anything?".container.logs()(port never opened, HTTP server never started, invalid license, bootstrap failure) callContainerLogs.dump(), which prints only the lines that haven't been shown yet. If nothing was streamed (for example with--quiet), it prints the full log underContainer logs:as before. If some lines were already streamed, it prints the rest underContainer logs (continued):, or nothing if there is nothing left.--quietalso suppresses the stream. People who pass--quietwant less noise, and failures still print the full log. The help text, the action'squietinput, and the README describe it as "Suppress image pull progress and the Connect logs shown while Connect starts".Running Posit Connect v...line still comes from the full log on each poll, so it works the same way.wait_for_http_server()andget_api_key()take an optionalstartup_logsargument. Without one, they don't stream and they dump the full log on failure, which is the existing behavior.Verification
Ran against
ghcr.io/posit-dev/connect:latestusingREADME.mdas a stand-in license, so Connect starts and with-connect then fails at "Unable to obtain a valid license":--quiet: Connect's log lines appeared on stderr in batches as each poll came in, followed byRunning Posit Connect v2026.10.0and the license error. NoContainer logs:dump, and no line was printed twice (Starting HTTP serverappeared once;sort | uniq -dfound nothing).--quiet: no stream. On failure, the full log printed once underContainer logs:, as before.2>/dev/null: nothing was printed (stdout was empty).The success path (a valid license) couldn't be run here; unit tests cover it.
Tests
New tests next to
test_valid_license_http_server_starts, all registered in the__main__block:--quiet-styleContainerLogsstreams nothingdump()prints only unseen lines with a(continued)header, and prints nothing when everything was shownuv run test_main.pyanduv run --with pytest pytest -q(45 passed) both pass.Conflicts with open PRs
fix-command-errors) and fix: Report Docker and installed-command errors as a short message #70 (clean-errors): merge cleanly.fast-stop): one conflict inwait_for_http_server()'s invalid-license branch, where this PR replaces the twoprintlines withstartup_logs.dump()and fix: Stop Connect containers promptly by signaling Connect directly #71 deletes thecontainer.stop()line after them. To resolve, keepstartup_logs.dump()and dropcontainer.stop(). The test changes merge cleanly.🤖 Generated with Claude Code