Skip to content

perf(cli): Cut the shared import cost of a CLI start - #5890

Merged
dan-petty merged 7 commits into
mainfrom
perf/3550-cut-the-cpu-time-of-the
Nov 16, 2026
Merged

dan-petty merged 7 commits into
mainfrom
perf/3550-cut-the-cpu-time-of-the

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

The startup-imports row of devops ci (#3550) spends 57 to 71 s of child CPU time over its fresh interpreters, over the 38 s goal that #2369 set, and it reports the cost without cutting it. A start pays the dry-run models, the version record and the message and error catalogs before it runs a command. The change loads those on first use, so the fixed cost of a probe falls, and the row prints the CPU time of each probe so the cost split is visible.

Closes #3550

Change: openspec/changes/archive/2026-11-15-3550-cut-the-cpu-time-of-the/

@devops-cli-service
devops-cli-service Bot force-pushed the perf/3550-cut-the-cpu-time-of-the branch 2 times, most recently from c4bd280 to 2fef3da Compare November 15, 2026 21:12
@devops-cli-service devops-cli-service Bot added type/infra Type infra: the build, CI, images or cluster scope/cli Core CLI framework, Typer subcommands, options, and tables labels Nov 15, 2026
@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The steps of the job:

Stopped at scoped checks.

Failure class: ci_infra.
Action taken: none.
Action left: retry: run the item again.

Step Status Attempts Tokens in/out Last failing command
group 1 done 1 2608729/12021 pytest on base: tests/dry_run/test_dry_run_state.py
group 2 done 1 1469435/9026 pytest on base: tests/config/test_metadata.py, tests/roadmap/stores/test_listing_snapshot.py
group 3 done 1 2357623/13811 pytest on base: tests/lang/test_language_catalogs.py
group 4 done 1 1836134/22893 -
group 5 done 1 550495/3695 -
scoped checks stopped 1 0/0 -

Reason:

SecurityError: Prohibited dangerous environment variable override: 'PYTEST_ADDOPTS'

Last message of the agent (a claim that no check verified): none.

The item is Blocked, and the job will not run it. Fix the cause. Then comment implement: retry. The Service clears the stop on its own when a new runner image rolls out, but only if a retry can fix the class of the stop and the limits of roadmap.implement.digest_clears_per_class and roadmap.implement.digest_clears_per_item allow it.

The job kept the commits that passed on the branch perf/3550-cut-the-cpu-time-of-the on origin. The last is 2bb5c0453f0640c6ef4b1a8a62d0493d3df25031. The pull request stays a draft. The next run continues from it, runs no group that is ticked, and runs the scoped checks again.

Step Status Attempts Tokens in/out Last failing command
group 1 done 1 2608729/12021 pytest on base: tests/dry_run/test_dry_run_state.py
group 2 done 1 1469435/9026 pytest on base: tests/config/test_metadata.py, tests/roadmap/stores/test_listing_snapshot.py
group 3 done 1 2357623/13811 pytest on base: tests/lang/test_language_catalogs.py
group 4 done 1 1836134/22893 -
group 5 done 1 550495/3695 -
  • scoped check pre-push: passed, 9 s
  • scoped check static: passed, 29 s
  • scoped check tests: passed, 32 s
  • scoped check tests: the changed files select more than 30 test modules, so only the changed test modules ran. The required checks of CI run the others
  • fail-to-pass of group 1: fails on the base commit. Tests that fail on the base commit: tests.dry_run.test_dry_run_state::test_a_start_that_imports_the_dry_run_state_loads_no_pydantic.
  • fail-to-pass of group 2: fails on the base commit. Tests that fail on the base commit: tests.config.test_metadata::test_a_start_that_reads_the_version_loads_no_pydantic.
  • fail-to-pass of group 3: fails on the base commit. Tests that fail on the base commit: tests.lang.test_language_catalogs::test_a_start_that_imports_the_cli_main_loads_the_help_catalog_alone.
  • verify of group 4: uv run devops ci test tests/commands/test_cli_startup_imports.py exits 0.
================================================================================================================== test session starts ===================================================================================================================
platform linux -- Python 3.14.10, pytest-9.2.0, pluggy-1.7.0
rootdir: /home/devops/.data/agent/worktrees/w-3550
configfile: pyproject.toml
plugins: xdist-3.8.0, cov-7.1.0, asyncio-1.4.1.post1, hypothesis-6.170.15, syrupy-7.0.0, time-machine-3.6.0, mock-3.17.0, anyio-4.16.0, platformdirs-4.14.5, timeout-2.4.0
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
timeout: 600.0s
timeout method: signal
timeout func_only: False
collected 15 items

tests/commands/test_cli_startup_imports.py ...............                                                                                                                                                                                         [100%]

=================================================================================================================== 15 passed in 0.55s ===================================================================================================================
Bytecode compiled 23327 files in 536ms
Bytecode compiled 23327 files in 585ms
/home/devops/.data/agent/worktrees/w-3550/.venv/lib/python3.14/site-packages/pytest_asyncio/plugin.py:300: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the "fixture" caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to "function" scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
  • verify of group 5: uv run devops ci docs exits 0.
\u2139 Quality gate root: /home/devops/.data/agent/worktrees/w-3550
\u2713 All documentation files are up to date.
Bytecode compiled 23327 files in 596ms
Bytecode compiled 23327 files in 570ms

@dan-petty
dan-petty force-pushed the perf/3550-cut-the-cpu-time-of-the branch from 2bb5c04 to 4164fc7 Compare November 16, 2026 00:28
@dan-petty
dan-petty marked this pull request as ready for review November 16, 2026 00:37
@dan-petty
dan-petty self-requested a review as a code owner November 16, 2026 00:37
@dan-petty
dan-petty merged commit 836cec5 into main Nov 16, 2026
24 checks passed
@dan-petty
dan-petty deleted the perf/3550-cut-the-cpu-time-of-the branch November 16, 2026 00:40
dan-petty pushed a commit that referenced this pull request Nov 16, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.160.0](v0.159.0...v0.160.0)
(2026-11-16)


### Features

* **roadmap:** add toolset comparison to the stage eval
([#5786](#5786))
([27b6d39](27b6d39))
* **roadmap:** fix simple stage gate problems with no model call
([#5902](#5902))
([7d0b38d](7d0b38d))
* **roadmap:** Give each attempt its own strategy
([#5898](#5898))
([a4390b2](a4390b2))
* **roadmap:** name the test module for a changed function
([#5912](#5912))
([7bd61b3](7bd61b3))
* **roadmap:** one watch row for plan and delivery PRs
([#5906](#5906))
([85b15fa](85b15fa)),
closes [#5024](#5024)
* **roadmap:** rebase staged branch onto main before implement
([#5921](#5921))
([42fbc79](42fbc79))


### Bug Fixes

* **k8s:** the config template holds the job limits
([#5913](#5913))
([c1f3259](c1f3259)),
closes [#5583](#5583)
* **roadmap:** each job reads a model setting of its own
([#5909](#5909))
([11390b4](11390b4))
* **roadmap:** Measure and bound the repair return request
([#5883](#5883))
([c5b21a3](c5b21a3))
* **roadmap:** return unbuildable premise items during stage
([#5917](#5917))
([0a7e45c](0a7e45c))
* **tests:** deselect only tests that carry k8s marker
([#5915](#5915))
([e6904f5](e6904f5)),
closes [#5910](#5910)


### Performance Improvements

* **cli:** Cut the shared import cost of a CLI start
([#5890](#5890))
([836cec5](836cec5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/cli Core CLI framework, Typer subcommands, options, and tables type/infra Type infra: the build, CI, images or cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(cli): cut the CPU time of the startup-import row by half

1 participant