Skip to content

apply: stop holding the session a second after the apply file exits - #1191

Merged
cdalar merged 1 commit into
mainfrom
ai/apply-tail-poll-interval
Oct 12, 2026
Merged

cdalar merged 1 commit into
mainfrom
ai/apply-tail-poll-interval

Conversation

@cdalar

@cdalar cdalar commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Problem

applyCommand follows the apply file's log with tail -f --pid=$pid. GNU tail checks that PID once per sleep interval, and the default interval is one second, so every apply file kept its SSH session open for up to a second after it had finished. onctl create -a and onctl ssh -a both wait on that session.

Measured from onctl-runners, where each runner microVM is created with a bootstrap script that takes about 0.2 s: over five creates, the script's log was last written 1.29–1.35 s before onctl create returned.

Change

Pass -s 0.1 to tail.

0.2 s apply file, on a Linux host with GNU coreutils 9.4
before 1.21 s
after 0.31 s

Test plan

  • New TestApplyCommandReturnsWhenScriptExits (skips without GNU tail, like the existing apply test)
  • go test ./internal/tools/, go vet, golangci-lint run clean
  • Old and new command timed side by side on a Linux host (table above)

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01AKmJku7417CUEaGfeQRx8C

applyCommand follows the apply file's log with `tail -f --pid`, and GNU
tail only checks whether that PID is still alive once per sleep
interval, which defaults to a full second. So every apply file, however
short, kept its SSH session -- and the `onctl create` or `onctl ssh -a`
behind it -- open for up to a second after it had finished.

Seen from onctl-runners, where each runner VM is created with a
bootstrap script that takes about 0.2s: across five creates the script
finished in the guest 1.29-1.35s before `onctl create` returned. With
`-s 0.1` a 0.2s script on the same host returns in 0.31s instead of
1.21s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKmJku7417CUEaGfeQRx8C
@cdalar
cdalar enabled auto-merge (squash) October 12, 2026 20:51
@cdalar
cdalar merged commit 3006bdc into main Oct 12, 2026
12 checks passed
@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 39.79%. Comparing base (eeea936) to head (f0a2afa).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1191   +/-   ##
=======================================
  Coverage   39.79%   39.79%           
=======================================
  Files          67       67           
  Lines        7310     7310           
=======================================
  Hits         2909     2909           
  Misses       4401     4401           

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

⌂ 捒网址