Skip to content

remote-worker: the startup sweep keeps a plain file named as a key, as the janitor does (follow-up to #954) - #979

Merged
webchang merged 1 commit into
rossoctl:mainfrom
webchang:pr/i338-sweep-skip-files
Nov 23, 2026
Merged

webchang merged 1 commit into
rossoctl:mainfrom
webchang:pr/i338-sweep-skip-files

Conversation

@webchang

Copy link
Copy Markdown
Member

Follow-up to #954's review note (the startup sweep, part of #338).

newestWorkspaceMtime judged a plain file by its own mtime, so an old plain file whose name checkKey accepts was detached and removed at a worker's start. The host janitor (deploy/sbx/janitor.sh) leaves every non-directory alone, and no workspace is ever a plain file, so the sweep now keeps it. A symlink named as a key is still removed as the link itself, never followed, as #954 documents.

  • remote-worker/internal/vmpool/startup_sweep.go: a plain file returns "keep" from newestWorkspaceMtime; the comment says so.
  • startup_sweep_test.go: TestStartupSweepKeepsAnOldPlainFileNamedAsAKey fails before the change (the file is removed) and passes after; go vet ./... and go test ./... in remote-worker pass.

Assisted-By: Claude Code

…the janitor does

newestWorkspaceMtime judged a plain file by its own mtime, so an old file whose name
checkKey accepts was detached and removed at startup. The host janitor leaves every
non-directory alone, and no workspace is ever a plain file: the sweep now keeps it. A
symlink named as a key is still removed as the link, as documented. Follow-up to rossoctl#954's
review note.

Signed-off-by: Rong Chang <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>

@clawgenti clawgenti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

The change is right and the new test pins it. newestWorkspaceMtime now returns ok=false for a non-symlink, non-directory entry, and the only caller (startupSweep, startup_sweep.go:62) already treats !ok as "keep", so a plain file is left alone however old. I checked the janitor parity the PR claims: deploy/sbx/janitor.sh's sweep_root skips [[ -L "$path" || ! -d "$path" ]] with "not a directory (symlink or file); left alone", so the two now agree on plain files (the symlink case remains the documented #954 divergence).

Verified at 848db1f:

  • go test ./internal/vmpool/ -run TestStartupSweep — 6/6 pass, the new TestStartupSweepKeepsAnOldPlainFileNamedAsAKey among them.
  • Mutation check: with startup_sweep.go reverted to main's version (the new test kept), it fails — an old plain file named as a key was removed: ... no such file or directory — and passes with the change, as the body says.
  • go vet ./internal/vmpool/... clean. The one go test ./internal/vmpool failure here, TestRestoreFoldsCloudHypervisorsOwnLogIntoTimeoutError, fails identically on main in this sandbox (fork/exec .../fake-virtiofsd.py: permission denied); unrelated to this PR.

No findings.

Author: webchang (MEMBER — maintainer)
Areas reviewed: Go (remote-worker/internal/vmpool sweep and its test)
Agent/IDE config (.claude/.vscode): none
Commits: 1, all signed off: yes
CI status: passing (k8s-kind-e2e, lint, microvm-gates, proto, shellcheck, trivy-scan)

All checks pass. Ready for human review.

Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review — startup sweep keeps plain files

Approving. newestWorkspaceMtime now returns ok=false for a plain file, and the sweep's if !ok || now.Sub(newest) < idle { continue } keeps it unconditionally — the same posture as the host janitor, which leaves every non-directory alone. The symlink branch still runs first, so an old symlink named as a key is judged by the link's own mtime and removed as the link, never followed.

Verified the test is real: New() calls startupSweep() synchronously, so on main the old plain file is detached before the assertion; the new test fails there and passes with the change. CI 17/17; DCO signed; MEMBER author; no .claude//.vscode/ changes; no injection content.

@webchang
webchang merged commit 3f21b33 into rossoctl:main Nov 23, 2026
23 of 24 checks passed
webchang added a commit to webchang/moca that referenced this pull request Nov 23, 2026
Upstream rossoctl#972, rossoctl#977, rossoctl#978, rossoctl#979, rossoctl#981, rossoctl#983, rossoctl#985, rossoctl#988 and rossoctl#990 (44 commits past 49cce28). No conflict.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants