Skip to content

chore: add timeout for log following of an unresponsive run#197

Open
socksy wants to merge 1 commit intodevelopfrom
add-timeout-to-log-following
Open

chore: add timeout for log following of an unresponsive run#197
socksy wants to merge 1 commit intodevelopfrom
add-timeout-to-log-following

Conversation

@socksy
Copy link
Contributor

@socksy socksy commented Feb 9, 2026

This kept hanging when running the tests with a broken runner, and IMO timing out with an explicit error is better than hanging forever.

Summary by CodeRabbit

  • Bug Fixes
    • Improved run start handling with a 30-second timeout limit. The application will no longer hang indefinitely while waiting for a run to start. If a runner fails to respond within the timeout window, a clear error message is displayed indicating potential runner unavailability.

@socksy socksy changed the base branch from main to develop February 9, 2026 17:23
@tower tower deleted a comment from github-actions bot Feb 9, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

The changes introduce a 30-second timeout mechanism for waiting for a run to start across multiple modules. When the timeout expires, the system either logs an error and aborts the wait or returns a new RunStartTimeout error variant, replacing unbounded polling with bounded, time-limited waiting.

Changes

Cohort / File(s) Summary
Timeout error variant
crates/tower-cmd/src/error.rs
Added RunStartTimeout variant to the public Error enum with a message indicating timeout while waiting for run to start and potential runner unavailability.
Timeout implementation
crates/tower-cmd/src/run.rs, crates/tower-cmd/src/apps.rs
Introduced RUN_START_TIMEOUT constant (30 seconds) and wrapped polling loops with timeout guards; on timeout, either returns RunStartTimeout error or logs error and aborts wait; preserves early return on successful start detection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

A rabbit with a stopwatch bright, 🐰⏱️
Counts thirty seconds, left and right,
No endless waits forevermore,
The runner's ready, that's what's for!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a timeout mechanism for log following when a run becomes unresponsive.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-timeout-to-log-following

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
crates/tower-cmd/src/apps.rs (1)

270-273: Keep timeout messaging consistent with the shared error variant.

Reusing Error::RunStartTimeout avoids message drift between run and apps logs flows.

♻️ Suggested tweak for consistent messaging
-use crate::{api, output};
+use crate::{api, output, Error};
@@
-                    output::error("Timed out waiting for run to start. The runner may be unavailable.");
+                    output::error(&Error::RunStartTimeout.to_string());

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants