Skip to content

run-testbox: make the idle-activity loop portable so a macOS testbox is not shut down after its first command - #18

Draft
aayushshah15 wants to merge 1 commit into
mainfrom
devin/1792857892-macos-portable-idle-loop
Draft

aayushshah15 wants to merge 1 commit into
mainfrom
devin/1792857892-macos-portable-idle-loop

Conversation

@aayushshah15

@aayushshah15 aayushshah15 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bug fix — the idle-timeout loop used ss -tnp and GNU stat -c %Y, neither of which exists on macOS. Under the step's bash -e, stat: illegal option -- c exits the loop as soon as ~/.testbox-last-activity exists, i.e. right after the first blacksmith testbox run, ending the job and the testbox.

The loop now goes through two small helpers:

has_ssh_connection()  # ss -tn when available, otherwise netstat -an -p tcp | grep ESTABLISHED
file_mtime()          # stat -c %Y (GNU) || stat -f %m (BSD) || 0

ss -tn drops the -p flag: process names were never used, and -p needs root to resolve other users' sockets.

Risks

Linux runners take the same ss/GNU stat paths as before. The v2 tag is not moved by this PR.

Link to Devin session: https://app.devin.ai/sessions/1dab8a9eae1a4a8bbe2f9f0a79065a67
Open in Devin Desktop: https://app.devin.ai/desktop/session/1dab8a9eae1a4a8bbe2f9f0a79065a67?variant=devin
Requested by: @aayushshah15


View with [code]smith Generate Proof with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


View with [code]smith Generate Proof with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. (Staging)

ss(8) and GNU stat -c do not exist on macOS. Under bash -e the BSD stat
failure exited the loop (and the testbox) right after the first command.
Fall back to netstat and stat -f %m when the GNU tools are unavailable.

Co-Authored-By: aayush@blacksmith.sh <aayush.shah15@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

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.

1 participant