Skip to content

Skip mirror hydration when the agent reports the sticky disk commit will be denied - #54

Closed
piob-io wants to merge 4 commits into
mainfrom
devin/1788904852-skip-hydration-when-commit-denied
Closed

Skip mirror hydration when the agent reports the sticky disk commit will be denied#54
piob-io wants to merge 4 commits into
mainfrom
devin/1788904852-skip-hydration-when-commit-denied

Conversation

@piob-io

@piob-io piob-io commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The agent's GetStickyDiskResponse carries commit_early_deny / commit_early_deny_reason when it already knows at expose time that this job's disk commit will be elided (sticky disk branch protection: pull_request, issue_comment, non-default-branch jobs). The action ignored it, so on installations with branch protection the first job to win the hydration race did the full clone --mirror inline, the agent then elided the commit, the backend purged the entry, and the next job repeated the clone — repositories whose jobs are mostly pull requests re-hydrated on every job and never got a usable mirror.

Action-side only; no agent or backend change:

setupCache(): CacheInfo += { commitDenied, commitDeniedReason }   // from response.commitEarlyDeny*

getSource():
  if shouldSkipHydration(cacheInfo)        // commitDenied && !mirrorExists(mirrorPath)
    warn, cacheInfo = null                 // direct clone from GitHub, same path as "hydration in progress"
  else
    ensureMirror(...)                      // existing mirror is still used read-only
    deep  (fetch-depth 0): sync as before (checkout correctness needs it)
    shallow: defer post-step sync only if !commitDenied

POST (main.ts cleanup):
  commitDenied  -> shouldCommit=false, skipReason from the agent
  mirrorPath passed to cleanup() only when shouldCommit  // no GC/commit-graph work for a disk that won't be committed

The denied job still exposes/mounts the disk (needed to know whether a mirror already exists) and releases it with shouldCommit=false, vmHydratedGitMirror=false; the backend keeps the entry unhydrated for the next job that is allowed to commit.

Also: the post-step log after commitStickyDisk no longer says "Successfully committed" unconditionally (the agent may elide the request).

Bumps @buf/blacksmith_vm-agent.* to a version that includes the new fields.

Tests: __test__/blacksmith-cache-commit-denied.test.tssetupCache maps the response fields; shouldSkipHydration on denied+missing / denied+existing / allowed.

Link to Devin session: https://app.devin.ai/sessions/a3b42ef15226438faf3f9cdde9662918
Open in Devin Desktop: https://app.devin.ai/desktop/session/a3b42ef15226438faf3f9cdde9662918?variant=devin
Requested by: @piob-io


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


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

…ill be denied

The agent's GetStickyDisk response carries commitEarlyDeny when it already
knows at expose time that this job's disk commit will be discarded (sticky
disk branch protection). Until now the action ignored it: the first job to
win the hydration race did the full clone --mirror, the agent then elided
the commit, the backend purged the entry, and the next job repeated the
clone. Any repository whose jobs are mostly pull requests re-hydrated on
every job.

Now, when the commit is denied and the mirror does not exist yet, the
action skips hydration and clones directly from the remote; a job that is
allowed to commit hydrates. An existing mirror is still used read-only,
but the deferred post-step sync, GC and commit request are skipped since
nothing would persist.

Bumps the generated vm-agent packages to a version that includes the
commit_early_deny fields.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

piob-io and others added 2 commits September 8, 2026 22:07
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
While the disk is held the backend treats this job as the hydrator and
turns other jobs away, including ones that could commit. Releasing at
setup instead of in the post step keeps that window to seconds.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 382ce42. Configure here.

Comment thread src/git-source-provider.ts Outdated
@piob-io piob-io closed this Sep 8, 2026
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