• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 24411696792

14 Apr 2026 04:49PM UTC coverage: 92.91% (-0.004%) from 92.914%
24411696792

push

github

web-flow
fix: preserve workunit log level in local cache metadata update (#23251)

## 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 to `Info`**,
regardless of its original level. Since `ExecuteProcess` workunits
intentionally start at `Debug` (to avoid rendering until execution
actually begins), this promotion causes duplicate INFO-level output:

```
23:22:27.30 [INFO] Starting: Generate lockfile for pytest
23:22:53.66 [INFO] Completed: Generate lockfile for pytest (26.4s)
23:22:53.66 [INFO] Completed: Scheduling: Generate lockfile for pytest (26.4s)
```

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_metadata` call needed to
attach `local_command` and `local_action` digests, but the closure also
hardcoded `Level::Info` as 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 set `local_command` and `local_action` — it has no
reason to change the log level.

## Result

Default (INFO-level) output is now clean:

```
23:22:27.30 [INFO] Starting: Generate lockfile for pytest
23:22:53.66 [INFO] Completed: Generate lockfile for pytest
```

The "Scheduling:" message remains visible at `-ldebug` for 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::Info` override in #22212, and wrote the one-line fix.
I reviewed the d... (continued)

91623 of 98615 relevant lines covered (92.91%)

4.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.46
/src/python/pants/engine/internals/engine_test.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc