BuildBuddy Invocation Compare
Overview
Compare two invocations end-to-end to isolate the earliest shared action-cache miss and pinpoint why actions are rebuilt or produce divergent outputs.
Workflow
0) Preflight: auth + inputs
- •Extract invocation IDs from the URLs.
- •Confirm API base URL and API key presence without printing the key.
- •Create a temp working directory and cache API responses there.
- •Use the request templates in
references/requests.md.
1) Diff canonical flags
- •Call
GetInvocationfor both IDs. - •Extract the canonical command line (
structuredCommandLine.commandLineLabelmatchingcanonical). - •Sort flags and diff; highlight any differences in startup or command options.
- •If canonical is missing, fall back to the only structured command line and note the limitation.
- •Some entries may have
commandLineLabel=null; filter them out to avoid jq errors.
2) Find the first shared AC miss
- •Call
GetCacheScoreCardfor both invocations filtered to:- •
cache_type=AC,request_type=READ,response_type=NOT_FOUND - •ordered by
start_timeascending
- •
- •Use
scripts/find_first_shared_ac_miss.pyto identify the earliest shared{target, mnemonic}with AC misses on both sides. - •Record
target_id,action_mnemonic, andaction_idfrom each side for the next step.
3) Locate the rerun action(s)
- •Call
GetExecutionwithinline_execute_response=truefor each invocation. - •Filter executions by target label, mnemonic, and primary output path (if known) to disambiguate actions.
- •Capture:
- •
action_digest(Action proto in CAS) - •
action_result_digestorexecute_response.result(ActionResult) - •
execute_response.result(stdout/stderr/output digests) - •
primary_output_pathto ensure you are comparing the correct action
- •
4) Diff Action and ActionResult
Fetch protos via bazel run //tools/cas and compare with diff -u or jq.
Focus on these common divergence points:
- •Input root tree: Compare
Action.input_root_digest; if it differs, fetch both trees and identify differing file paths/digests. If only a few files differ, download and diff them. - •Command args / outputs: Compare
Command.arguments,Command.output_files, andCommand.output_directories. Expect platform or toolchain mismatches to surface here. - •Env / platform properties: Compare
Command.environment_variablesandAction.platform.properties. Treat differences as evidence of non-strict env or platform drift. - •Output digests: Compare
ActionResult.output_filesandoutput_directories; if digests differ with identical inputs/commands, suspect non-determinism.
Prefer bb explain when input roots differ and compact execution logs are available to pinpoint exact input changes.
5) Compact execution logs (optional)
- •If
execution_log.binpb.zstappears in the build tool logs, download both logs and diff withbb explain. - •Alternatively, pass invocation IDs directly to
bb explainwhen the logs are available in BES.
Response requirements
- •Summarize the root cause clearly and tie it to the earliest shared AC miss.
- •Call out which of the divergence categories applies (inputs, command/outputs, env/platform, output digest).
- •Include a pointer to the compare UI sources:
app/compare/compare_actions.tsxorapp/compare/compare_invocations.tsxfor deeper inspection.
Resources
- •
references/requests.mdfor API + jq templates. - •
scripts/find_first_shared_ac_miss.pyto identify the earliest shared AC miss.