Skip to content

Count workspace uploads in progress as runner work - #57

Merged
lydakis merged 2 commits into
mainfrom
claude/errand-upload-busy
Oct 6, 2026
Merged

lydakis merged 2 commits into
mainfrom
claude/errand-upload-busy

Conversation

@lydakis

@lydakis lydakis commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Before: the cloud peer's idle check counted only staging, starting, running and queued jobs from /v0/info. A workspace being created or pushed to a leased machine (errand workspaces create --on <lease>, errand push --on <lease>), or a push being applied, was invisible to it, so a lease could be released in the middle of an upload that took longer than idle_timeout. errand setup could likewise restart a runner in the middle of one.

After: a workspace creation, push upload or push apply in progress counts as work. /v0/info reports it as transfers, the cloud peer's idle check treats it like a job, and setup's quiesce refuses to restart a runner while one is in progress; while setup holds the runner, a new transfer is refused as a job submission is (503). max_lifetime still ends the lease whatever is in progress. errand ps, errand df and placement load are unchanged: they are about jobs and storage, and an upload does not take a job slot.

How: the daemon wraps the three workspace transfer handlers (POST /v0/workspaces/{id}, .../push, .../push/{transfer}/apply) so each counts itself in Daemon.transfers for as long as the handler runs, under the daemon lock that /v0/info already takes. occupancyLocked carries the count, so reading it is O(1) with no extra I/O. proto.Info gets one field, Transfers. The broker's busy adds it to the job counts. The setup quiesce check refuses with "runner has N workspace transfers in progress" after its job check, and the wrapper refuses a transfer while an unexpired setup hold is in place, checked under the same lock that counts it. Negotiation and checkpoint reads (.../snapshot/diff, .../push/diff, .../push/base) are short reads and are not counted.

Tests: TestInfoCountsWorkspaceUploadInProgress holds a push upload open mid-body and checks that /v0/info counts it, that setup quiesce is refused meanwhile, and that the count drops once the upload ends. TestSetupQuiesceRefusesWorkspaceTransfers checks that create, push and apply are refused while setup holds the runner. TestUploadInProgressKeepsLease checks that a lease whose runner reports an upload is not released at its idle deadline, and is released at the next one after the upload ends.

Closes the #33 item "Uploads do not count as busy".

🤖 Generated with Claude Code

https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6


Generated by Claude Code

A workspace creation, push upload or push apply in progress is now
counted by the runner and reported in /v0/info as transfers. The cloud
peer's idle check counts it as work, so a lease is not released under an
upload that outlasts idle_timeout, and setup refuses to restart a runner
in the middle of one.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T08:05:25.963630Z f1e35d3 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

lydakis commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

github-advanced-security fails on GitHub's side on every PR in this repo (Copilot code scanning: unsupported model / monthly quota), not because of this change; a re-run returns 403. The repo's own checks (tests on Linux, macOS and Windows, CodeQL, GitGuardian) decide this PR.


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d669af62a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/daemon/server.go Resolved
A transfer now starts only if no setup hold is in place, checked under the
lock that counts it, and is refused as a job submission is meanwhile, so
a transfer cannot begin after setup found the runner idle and then be cut
off by the restart.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

lydakis commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex security review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: f1e35d3cce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

lydakis commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex security review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: f1e35d3cce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

lydakis commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex security review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: f1e35d3cce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

lydakis commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex security review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: f1e35d3cce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lydakis
lydakis merged commit 6cec8d8 into main Oct 6, 2026
8 of 9 checks passed
@lydakis
lydakis deleted the claude/errand-upload-busy branch October 6, 2026 21:57
lydakis pushed a commit that referenced this pull request Oct 6, 2026
Keeps both #57's workspace transfers and this branch's unfetched results:
/v0/info reports transfers and the latest admitted/unfetched times, and the
broker counts transfers as work alongside jobs and the lease's own results.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013BQxiCNDXMnjv5pvmgo5E6

lydakis commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

@codex security review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 6cec8d8c23

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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