fix: preserve workunit log level in local cache metadata update#23251
Merged
benjyw merged 1 commit intopantsbuild:mainfrom Apr 14, 2026
Merged
Conversation
5583c82 to
e890606
Compare
…logs The local cache runner was promoting the ExecuteProcess (Scheduling:) workunit from Debug to Info when setting cache metadata. This caused "Completed: Scheduling: ..." to appear at INFO alongside the child "Completed: ..." message, producing duplicate log noise. Keep the scheduling workunit at Debug so only the actual process execution workunit logs at INFO. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d8ca2-81aa-7538-a6ef-7f44d71da184
e890606 to
846356d
Compare
benjyw
approved these changes
Apr 14, 2026
Contributor
benjyw
left a comment
There was a problem hiding this comment.
Good find!
If you used an LLM for this can you update the PR with the disclosure? Thanks
Contributor
Author
Done. Let me know if that's not what you meant. |
Contributor
Yep, that was perfect, in line with our relatively new disclosure policy (which hasn't been published to the docs yet for some reason, will look into that). Thanks. |
jasonwbarnett
pushed a commit
to altana-ai/pants
that referenced
this pull request
Apr 15, 2026
…root cause PR pantsbuild#23251 fixed the "Scheduling:" workunit being promoted to INFO, so the log_duration mechanism to suppress duplicate durations is no longer needed. Duration is now shown unconditionally for completed and canceled workunits. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
When a process runs (e.g.
generate-lockfiles), the local cache runner updates the "Scheduling:" workunit metadata to attach cache digests. As a side effect, it overrides the workunit log level toInfo, regardless of its original level. SinceExecuteProcessworkunits intentionally start atDebug(to avoid rendering until execution actually begins), this promotion causes duplicate INFO-level output:The third line is redundant — the scheduling workunit is a wrapper whose duration mirrors its child.
Root Cause
This was inadvertently introduced in #22212, which added Action/Command digest metadata to workunits. The
update_metadatacall needed to attachlocal_commandandlocal_actiondigests, but the closure also hardcodedLevel::Infoas the new level — discarding the original. The PR was focused on metadata, not log levels, and the level override was not discussed in review.Solution
Preserve the workunit's original log level when updating cache metadata, instead of unconditionally overriding it to
Level::Info. The metadata update only needs to setlocal_commandandlocal_action— it has no reason to change the log level.Result
Default (INFO-level) output is now clean:
The "Scheduling:" message remains visible at
-ldebugfor debugging purposes.LLM Disclosure
This PR was written with Amp (Claude). The LLM diagnosed the root cause by tracing the workunit level flow through the codebase, identified the accidental
Level::Infooverride in #22212, and wrote the one-line fix. I reviewed the diagnosis and fix, validated it by running Pants from sources against our monorepo, and confirmed the duplicate log line no longer appears.Related: #22992