Repository navigation
Support injecting property values into entry point command. - #262
Conversation
|
I'm thinking of making this a breaking change so entrypoint_cmd is a list |
allada
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 5 files reviewed, 3 unresolved discussions (waiting on @chrisstaite-menlo)
a discussion (no related file):
I think we should do this by injecting them in as environmental variables.
To prevent it from being a conflict, lets have the user specify the environmental variable they'd like to assign the properties too in the config.
I'm leaning towards a map, where the user specifies each environ what platform property to assign to it, as it would make it much easier to use.
cas/worker/running_actions_manager.rs line 559 at r1 (raw file):
fn inject_property<'a>(&'a self, argument: &'a str) -> &'a str { if argument.starts_with('{') && argument.ends_with('}') {
nit: I'd rewrite this:
if !argument.starts_with('{') || !argument.ends_with('}') {
return argument;
}
let property_name = &argument[1..argument.len() - 1];
match self.action_info.platform_properties.properties.get(property_name) {
Some(PlatformPropertyValue::Exact(value)) => value.as_str(),
// TODO: Support injecting minimum.
Some(PlatformPropertyValue::Minimum(_)) => argument,
Some(PlatformPropertyValue::Priority(value)) => value.as_str(),
Some(PlatformPropertyValue::Unknown(value)) => value.as_str(),
None => argument,
}cas/worker/running_actions_manager.rs line 560 at r1 (raw file):
fn inject_property<'a>(&'a self, argument: &'a str) -> &'a str { if argument.starts_with('{') && argument.ends_with('}') { // Inject property
nit: needless comment.
abb8cb7 to
efc7012
Compare
chrisstaite-menlo
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @allada)
a discussion (no related file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
I think we should do this by injecting them in as environmental variables.
To prevent it from being a conflict, lets have the user specify the environmental variable they'd like to assign the properties too in the config.
I'm leaning towards a map, where the user specifies each environ what platform property to assign to it, as it would make it much easier to use.
Done.
65667d8 to
b365a32
Compare
allada
left a comment
There was a problem hiding this comment.
Reviewed 1 of 5 files at r1, 2 of 5 files at r2, all commit messages.
Reviewable status: 3 of 7 files reviewed, 1 unresolved discussion (waiting on @chrisstaite-menlo)
config/cas_server.rs line 325 at r2 (raw file):
/// the job with the value of the environment variable being the value of /// the property of the action being executed of that name. pub property_environments: Option<HashMap<String, String>>,
I think this logic is nearly identical to also supporting: #237
Can we do a few minor tweaks to this so we can pass in raw (static) values as well as dynamic values like platform properties?
Introducing a new enum is probably best and have the key be the source type of the string (ie: Raw(String) or PlatformPropertyValue(String)). This might be useful for other weird use cases in the future for metadata injection.
b365a32 to
63c416e
Compare
chrisstaite-menlo
left a comment
There was a problem hiding this comment.
Reviewable status: 1 of 7 files reviewed, 1 unresolved discussion (waiting on @allada)
config/cas_server.rs line 325 at r2 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
I think this logic is nearly identical to also supporting: #237
Can we do a few minor tweaks to this so we can pass in raw (static) values as well as dynamic values like platform properties?
Introducing a new enum is probably best and have the key be the source type of the string (ie:
Raw(String)orPlatformPropertyValue(String)). This might be useful for other weird use cases in the future for metadata injection.
I also have a use for this with the reclient stuff.
allada
left a comment
There was a problem hiding this comment.
Reviewed 1 of 5 files at r1, 5 of 5 files at r3, all commit messages.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @chrisstaite-menlo)
cas/worker/running_actions_manager.rs line 606 at r3 (raw file):
let value = match source { EnvironmentSource::Property(property) => { match self.action_info.platform_properties.properties.get(property) {
nit: Can we implement ToString for PlatformPropertyValue then just call .to_string() here?
cas/worker/running_actions_manager.rs line 607 at r3 (raw file):
EnvironmentSource::Property(property) => { match self.action_info.platform_properties.properties.get(property) { // Only set in Unknown in the worker -
This doesn't seem very future proof. I think we should pass all of them even though we only support Unknown here. This way if we ever "fix" the properties to be known it won't silently break here.
cas/worker/running_actions_manager.rs line 1079 at r3 (raw file):
#[derive(Default)] pub struct ExecutionConfiguration {
nit: I try to ensure all public structs and properties (that are pub as well) are documented.
Can we add a few doc comments here of what this is and it's use?
cas/worker/tests/running_actions_manager_test.rs line 141 at r3 (raw file):
mod running_actions_manager_tests { use super::*; use config::cas_server::EnvironmentSource;
nit, please put this in the top use section.
cas/worker/tests/running_actions_manager_test.rs line 1219 at r3 (raw file):
let test_wrapper_script = OsString::from(test_wrapper_dir + "\\test_wrapper_script.bat"); let mut test_wrapper_script_handle = fs::create_file(&test_wrapper_script).await?; test_wrapper_script_handle
It turns out we need to .flush() here before we drop the file.
config/cas_server.rs line 254 at r3 (raw file):
/// The name of the property in the action to get the value from. Property(String), /// The value to set.
nit: The raw value to set.
config/cas_server.rs line 328 at r3 (raw file):
pub precondition_script: Option<String>, /// An optional mapping of environment names to set for the execution
This comment looks to be related specifically to platform properties. Can we amend it to be generic, then put the platform property specific stuff in the EnvironmentSource::Property comment?
chrisstaite-menlo
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @allada)
cas/worker/running_actions_manager.rs line 606 at r3 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
nit: Can we implement
ToStringforPlatformPropertyValuethen just call.to_string()here?
That would make a needless copy though as we only need a &str.
cas/worker/running_actions_manager.rs line 607 at r3 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
This doesn't seem very future proof. I think we should pass all of them even though we only support
Unknownhere. This way if we ever "fix" the properties to be known it won't silently break here.
I'm not sure how we could fix it since it comes from the Protobuf that has no knowledge of the scheduler.
cas/worker/tests/running_actions_manager_test.rs line 141 at r3 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
nit, please put this in the top
usesection.
Editor...
config/cas_server.rs line 328 at r3 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
This comment looks to be related specifically to platform properties. Can we amend it to be generic, then put the platform property specific stuff in the
EnvironmentSource::Propertycomment?
It is generic, I re-worded it specifically for that purpose.
allada
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @chrisstaite-menlo)
cas/worker/running_actions_manager.rs line 606 at r3 (raw file):
Previously, chrisstaite-menlo (Chris Staite) wrote…
That would make a needless copy though as we only need a
&str.
How about .to_str() this would do the same, but without a copy.
cas/worker/running_actions_manager.rs line 607 at r3 (raw file):
Previously, chrisstaite-menlo (Chris Staite) wrote…
I'm not sure how we could fix it since it comes from the Protobuf that has no knowledge of the scheduler.
It's more about ensuring intended behavior. Maybe one example is if we modify the proto messages to encode this information for inter-system communications and this value no longer publishes. This would be a silent failure. Adding the various properties seems feels like it would be trivial to maintain (or if we do it via .to_str() it won't be an issue).
chrisstaite-menlo
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @allada)
cas/worker/running_actions_manager.rs line 606 at r3 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
How about
.to_str()this would do the same, but without a copy.
Can't be implemented for Minimum.
allada
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @chrisstaite-menlo)
cas/worker/running_actions_manager.rs line 606 at r3 (raw file):
Previously, chrisstaite-menlo (Chris Staite) wrote…
Can't be implemented for
Minimum.
Hmmm, Maybe use Cow<'a, str>?
This way only Minimum does an allocation?
chrisstaite-menlo
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @allada)
cas/worker/running_actions_manager.rs line 607 at r3 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
It's more about ensuring intended behavior. Maybe one example is if we modify the proto messages to encode this information for inter-system communications and this value no longer publishes. This would be a silent failure. Adding the various properties seems feels like it would be trivial to maintain (or if we do it via
.to_str()it won't be an issue).
Done.
cas/worker/running_actions_manager.rs line 1079 at r3 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
nit: I try to ensure all public structs and properties (that are pub as well) are documented.
Can we add a few doc comments here of what this is and it's use?
That's missing for Callbacks 😉
cas/worker/tests/running_actions_manager_test.rs line 1219 at r3 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
It turns out we need to
.flush()here before we drop the file.
Done.
63c416e to
b682a40
Compare
allada
left a comment
There was a problem hiding this comment.
Reviewed 8 of 8 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @chrisstaite-menlo)
cas/worker/running_actions_manager.rs line 1079 at r3 (raw file):
Previously, chrisstaite-menlo (Chris Staite) wrote…
That's missing for
Callbacks😉
"try" 😆
cas/worker/running_actions_manager.rs line 606 at r4 (raw file):
let value = match source { EnvironmentSource::Property(property) => { if let Some(property) = self.action_info.platform_properties.properties.get(property) {
fyi this might look better:
self
.action_info
.platform_properties
.properties
.get(property)
.map_or_else(|| Cow::Borrowed(""), |v| v.to_str())
allada
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @chrisstaite-menlo)
b682a40 to
59d703b
Compare
chrisstaite-menlo
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @chrisstaite-menlo)
cas/worker/running_actions_manager.rs line 606 at r4 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
fyi this might look better:
self .action_info .platform_properties .properties .get(property) .map_or_else(|| Cow::Borrowed(""), |v| v.to_str())
Certainly does.
allada
left a comment
There was a problem hiding this comment.
Reviewed 1 of 1 files at r5.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on @chrisstaite-menlo)
allada
left a comment
There was a problem hiding this comment.
Reviewed all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @chrisstaite-menlo)
…a#262) During the 2026-05-05 RSS-leak investigation a Bazel fetch-storm drove RSS to a 27 GB plateau. Six info! log sites dominated the burst-time output (cumulatively ~2300 events / 30 s) and compounded with mimalloc page retention. Each is leftover diagnostic from TraceMachina#212/TraceMachina#218/TraceMachina#252 chunked-streaming work. Same shape as TraceMachina#255 / TraceMachina#186 / TraceMachina#253. Demoted sites: - bytestream_server.rs:385 "ByteStream::read: CAS read completed" 525 events / 30 s. Just bumped to info! today via e59b776 (LoggingReadStream consolidation). The 17 lines/sec sustained rate is too high for info! even though it carries throughput/duration — the CLAUDE.md rule "info! for transfer completions with throughput" was written for whole-RPC summaries, not per-stream-chunk reads. - bytestream_server.rs:1007 "ByteStream::inner_read entry" 525 events / 30 s. Per-call entry log; debug! is the right level. - bytestream_server.rs:1369 "inner_read get_part_fut resolved (still awaiting consume)" 520 events / 30 s. Per-event branch trace. Sibling at :1332 (`after consume_err`) left at info! — fires only on the rarer error path. - bytestream_server.rs:2010 "ByteStream::write: skipped, blob already exists" 377 events / 30 s. The WorkerProxyStore::has() write-skip optimization log; TraceMachina#133 already filed to demote it. - streaming_blob.rs:325 "streaming blob writer sent eof, notify_waiters firing" 293 events / 30 s. Per-blob lifecycle event; the wakeup propagates to readers without needing a separate log. - existence_cache_store.rs:147,154,156 eviction-callback trio (~258 events / 30 s each). Per-eviction mechanical follow-ups. Wedge-digest gates at :150 left at info! — they're explicitly filtered to a single digest under investigation. - fast_slow_store.rs:1939 "populate sending streaming_writer.send_error after head failure" 241 events / 30 s. Per-failed-RPC mechanical follow-up. The summary line at :1927 ("populate head_result Err") left at info! — one line per failure is the right cadence. streaming_blob.rs's `info` import removed (now unused). All four files already had `debug` in scope. Behavior-only change: no flow-control, concurrency, or storage semantics modified. Build verified --release --features quic,pprof,chunked_fast_slow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…romote 1 to warn! `fast_slow_store` was the dominant log source in today's 10-min anomaly sweep (14,486 lines / 10 min, ~24/sec — single-handedly larger than every other crate combined). Each `populate run_producer` invocation emitted 12+ per-call breadcrumbs at info! level (head_result Ok/Err, data_stream entry/Ok/Err, slow_store.get entry/Ok/Err, fast_store.update entry/Ok/Err, join3 returned, send_eof/send_error, run_producer exit Ok/Err). With ~1,440 populate calls per 10 min in steady state, this alone accounted for ~17K lines of the volume — dwarfing the 6 sites TraceMachina#262 already demoted in the same file. Same shape as TraceMachina#262: per-call info! breadcrumbs from TraceMachina#147-trace work that are no longer load-bearing in steady-state and compound under burst. Same risk profile: log volume × mimalloc retention contributes to RSS growth (TraceMachina#255). Demote (a) — happy-path per-call breadcrumbs that fire once per populate: - line 1921 populate head_result Ok (info → debug) - line 1927 populate head_result Err (info → debug; NotFound is normal) - line 1980 populate data_stream branch entry (info → debug) - line 2039 populate data_stream branch Ok (info → debug) - line 2047 populate data_stream branch Err (info → debug) - line 2075 populate slow_store.get branch entry (info → debug) - line 2082 populate slow_store.get branch Ok (info → debug) - line 2087 populate slow_store.get branch Err (info → debug) - line 2101 populate fast_store.update branch entry (info → debug) - line 2111 populate fast_store.update branch Ok (info → debug) - line 2116 populate fast_store.update branch Err (info → debug) - line 2130 populate join3 returned (info → debug) - line 2175 populate calling streaming_writer.send_eof (info → debug) - line 2188 populate calling streaming_writer.send_error (info → debug) - line 2199 populate run_producer exit Ok (info → debug) - line 3508 update_oneshot: background slow write spawned (info → debug) - line 3590 update_oneshot: background slow write complete (info → debug) Promote (c) — populate failure summary, anomalous condition, replaces the 5 intermediate per-step Err lines so operators get exactly ONE warn! per failed populate (not 5): - line 2204 populate run_producer exit failed — slow-store populate did not deliver the blob to the fast tier (info → warn!) Keep (b) — state transitions and once-per-major-event lines stay info!: - line 834 chunked admission complete (transfer with throughput) - line 1187 shutdown flush enumerated - line 1313 shutdown flush completed (transfer with throughput) - lines 1488/1497 chunked-read cascade ENABLED/DISABLED (kill-switch state) Anomaly observability is preserved by: - the Err-summary warn! at line 2204 (covers ALL populate failures) - the existing PHANTOM BLOB warn! at line 2159 (has-then-NotFound race) - the existing background-slow-write watchdog warn! at line 3542 - the existing background-slow-write FAILED error! at line 3604 - all pre-existing warn!/error! sites untouched No tests assert on any of the touched log strings (verified with `grep -rn logs_contain nativelink-store/tests/`); no test breakage. The file_gets_cleans_up_on_cache_eviction test in filesystem_store_test.rs hangs on origin/main without these changes — pre-existing flakiness, not caused by this diff. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…aceMachina#334 bundle fixup TraceMachina#5) Code-reviewer MA-6: the Fix C eviction extension's success-path `info!` ("backpressure-driven eviction freed unpinned entries to admit incoming write") at `memory_store.rs:284-291` fires on every eviction- driven admission. In production at line rate that's hundreds of events per second per FastSlowStore — same shape as TraceMachina#262 burst-info demote class. Demoted to `debug!`. The distinct "eviction freed nothing → genuinely full" case is already signaled via the `Err(...)` arm below, where the debug-level message ("every byte is pinned") carries the operationally important info. No information is lost; only production log noise. Removed unused `use tracing::info;` import. All 3 `memory_store_backpressure_eviction_test` regression tests pass after the demote (the tests assert on behavior, not log content). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Resolves #261
This change is