GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix/batch-changes: ignore per-job env vars in cache key by taras-yemets · Pull Request #1326 · sourcegraph/src-cli

Conversation

@taras-yemets

@taras-yemets taras-yemets commented May 29, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

With sourcegraph/sourcegraph#12503, Sourcegraph desugars v3 codingAgent steps server-side and declares per-job env-var forwards on step.Env. Their resolved values change every dequeue, so including them in cache-key inputs would invalidate the cache on every run.

Strip them before hashing:

  • SRC_EXECUTOR_JOB_TOKEN — per-job bearer token
  • SRC_EXECUTOR_JOB_ID — numeric job ID
  • SRC_EXECUTOR_NAME — dequeueing executor's hostname

The bare-string declarations still influence the key via the serialized step.Env, so spec-change invalidation still works. The list is mirrored in sourcegraph/sourcegraph; a comment on each side points at the other.

End-to-end test plan: see sourcegraph/sourcegraph#12503.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@taras-yemets
taras-yemets force-pushed the ty/batch-changes-codingagent-cache-parity branch from f6a51e6 to 2a38987 Compare May 29, 2026 10:48
@taras-yemets
fix/batch-changes: ignore per-job env vars in cache key
f9ae28e
The two SRC_BATCHES_* env vars declared by codingAgent steps
(see sourcegraph/sourcegraph#12503) resolve to different values on
every dequeue. Strip them from cache-key inputs so the key stays
stable across runs.
@taras-yemets
taras-yemets force-pushed the ty/batch-changes-codingagent-cache-parity branch from 2a38987 to f9ae28e Compare May 29, 2026 10:54
taras-yemets added 2 commits May 29, 2026 15:51
@taras-yemets
fix/batch-changes: rename per-job env vars to SRC_EXECUTOR_* and stri…
1257e39
…p SRC_EXECUTOR_NAME

The per-job env vars declared by codingAgent steps were renamed in
sourcegraph/sourcegraph#12503 (review feedback) from SRC_BATCHES_* to
SRC_EXECUTOR_*, and a third var SRC_EXECUTOR_NAME was added so the
in-sandbox coding-agent CLI can pass X-Sourcegraph-Executor-Name to
the model-provider proxy (lets the server reuse jobAuthMiddleware
instead of a bespoke auth path).

Mirror those changes in src-cli's cache-key stripping list so cached
runs aren't invalidated by the per-dequeue token/ID/executor-name
values that get injected onto step.Env.
@taras-yemets
fix/batch-changes: rename perJobEnvVars to perRunEnvVars
ee8d198
One of the three stripped env vars (SRC_EXECUTOR_NAME) is per-executor,
not per-job, so the perJob name is technically wrong. Renaming to
perRunEnvVars accurately captures that all three change on every
dequeue (job-token + job-ID per job, executor-name per executor).
bobheadxi
bobheadxi approved these changes May 29, 2026
View reviewed changes
Comment thread lib/batches/execution/cache/cache.go
Comment on lines +50 to +53
// perRunEnvVars resolve to per-job or per-executor values that change on
// every dequeue and must be stripped from cache keys. Mirrored in
// sourcegraph/sourcegraph/lib/batches/execution/cache/cache.go.
var perRunEnvVars = []string{

@bobheadxi bobheadxi May 29, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thank you for docstring!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

taras-yemets reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bobheadxi

bobheadxi commented May 29, 2026

Copy link
Copy Markdown
Member

Linking for ref: could also tidy up https://github.com/sourcegraph/sourcegraph/pull/12640 to resolve

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bobheadxi

bobheadxi commented May 29, 2026

Copy link
Copy Markdown
Member

@taras-yemets how do we pull this into the src-cli version used by executor? Do we need a release?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@taras-yemets

taras-yemets commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

@taras-yemets how do we pull this into the src-cli version used by executor? Do we need a release?

I think we need a release first, then set the minimum expected src-cli version in the Sourcegraph repo.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@taras-yemets
taras-yemets marked this pull request as ready for review May 29, 2026 17:57
@taras-yemets
taras-yemets merged commit e3e7712 into main May 29, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@taras-yemets
taras-yemets deleted the ty/batch-changes-codingagent-cache-parity branch May 29, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bobheadxi bobheadxi bobheadxi approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@taras-yemets @bobheadxi
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.