Skip to content

skills(running-tend): fix the statusline cache-check recipe for Linux - #3825

Merged
max-sixty merged 2 commits into
mainfrom
nightly/clean-31931356439
Aug 17, 2026
Merged

max-sixty merged 2 commits into
mainfrom
nightly/clean-31931356439

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

The running-tend skill's weekly statusline cache-check recipe can't run as written: its sed -i '' is BSD syntax, and the weekly job runs on ubuntu-24.04. GNU sed reads the '' as the script and the substitution expression as a filename, so the step exits 2 and the input file keeps its REPLACE_WITH_CWD placeholder — a session that pushed past the error would then profile a statusline render against a nonexistent working directory. Building the JSON with jq -n --arg drops the placeholder dance entirely and can't be corrupted by a path containing a quote.

The same block also invoked wt list statusline --claude-code, which has been deprecated in favour of --format=claude-code since #2436 and warns on every use.

Verification

GNU sed 4.9 on this runner, reproducing the failure:

$ sed -i '' "s|REPLACE_WITH_CWD|/home/x|" sedtest.txt
sed: can't read s|REPLACE_WITH_CWD|/home/x|: No such file or directory
exit=2

The corrected recipe, run end to end against a debug build of this checkout:

$ jq -n --arg cwd "$PWD" '{hook_event_name:"Status", workspace:{current_dir:$cwd}, model:{display_name:"Opus"}, context_window:{used_percentage:42.0}}' > /tmp/statusline-input.json
$ wt -vv list statusline --format=claude-code < /tmp/statusline-input.json > /dev/null
exit=0
$ wt config state logs profile --format=json | jq .cache
{"same_context_duplicates": [...], "same_context_extra_calls": 2, ...}

The field names match what StatuslineInput reads — /workspace/current_dir, /model/display_name, /context_window/used_percentage in src/commands/statusline.rs.

Deprecation warning on the old flag:

$ wt list statusline --claude-code < /tmp/statusline-input.json
▲ --claude-code is deprecated; use --format=claude-code instead

No regression test: the change is to a skill markdown file, which has no test harness in this repo. The recipe itself was run end to end instead, as above.

Found by the nightly survey (.claude/skills/ is not on the rotation, but the statusline recipe surfaced while checking wt list statusline doc accuracy in skills/worktrunk/reference/claude-code.md).

sed -i '' is BSD syntax; the weekly job runs on ubuntu-24.04, where GNU sed
reads the '' as the script and errors out, leaving REPLACE_WITH_CWD in the
input. Build the JSON with jq -n --arg instead, and use the canonical
--format=claude-code rather than the deprecated --claude-code flag.
@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Aug 16, 2026

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The substance holds up: --claude-code does warn and map to --format=claude-code (src/main.rs, the "--claude-code is deprecated; use --format=claude-code instead" arm), the four JSON fields match the pointers StatuslineInput::parse reads (/workspace/current_dir, /model/display_name, /context_window/used_percentage), jq preserves 42.0 as a float rather than normalizing it to 42, and tend-weekly.yaml is indeed runs-on: ubuntu-24.04. No other --claude-code occurrence survives in docs or skills, so the swap is complete.

One thing the fix leaves standing: the recipe still won't realistically complete on the weekly job, and the sed failing early is what has been hiding that. Nothing in .github/actions/claude-setup installs worktrunk, and its Swatinem/rust-cache step is save-if: false restoring a cache no workflow populates with release artifacts — there is no cargo build --release anywhere under .github/workflows/. So cargo run --release there is a cold release build of the entire dependency graph before the first render.

Worth deciding explicitly rather than discovering it in a weekly run. The triage this section documents is entirely .cache duplicates and the ~29 git subprocesses count, both profile-independent, so dropping --release would make it runnable — and it matches how you verified it (the PR body's transcript is a debug build). If the reason to keep --release is that the profile's timing numbers go noisy in debug, a line saying so would stop a future session from "fixing" it.

The weekly job installs no wt and its rust-cache step never restores, so
--release meant a cold optimized build of the whole dependency graph before
the first render. The duplicates and subprocess count this check triages are
profile-independent.
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Dropped --release in e73b2f5, with a comment in the block saying why so a future session doesn't add it back.

Your read is right, and the cache is worse than "no release artifacts": claude-setup passes prefix-key: ${{ hashFiles('Cargo.lock') }} with no shared-key, while the only workflow that writes a cache (test-setup, via test on main) uses prefix-key: v1-rust + shared-key: shared. Those keys can't collide, so the restore misses for every profile — tend-weekly builds from scratch either way, and the only question is how expensive that build is. Cold debug on this runner was 1m41s, which is affordable once a week; a cold release build of the same graph is not.

Nothing this section triages changes with the profile — the .cache report is duplicate (command, context) pairs and a subprocess count, and the baseline is ~29 git subprocesses, not a duration. I ran the recipe end to end against the debug build to confirm.

The claude-setup cache key mismatch is worth its own look — it's a permanent miss on every tend job, not just this one — but it's a workflow change unrelated to this recipe, so I left it out of this PR.

Verification
$ /usr/bin/time -f "build wall: %e s" cargo build
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 41s
build wall: 109.81 s

$ cargo run -q -- -vv list statusline --format=claude-code < /tmp/statusline-input.json > /dev/null
render exit=0

$ cargo run -q -- config state logs profile --format=json | jq .cache
{
  "same_context_duplicates": [
    { "command": "gh --version", "max_per_context": 2, "extra_calls": 1, ... },
    { "command": "git worktree list --porcelain", "max_per_context": 2, "extra_calls": 1, ... }
  ],
  "same_context_extra_calls": 2,
  "same_context_extra_us": 34334
}

Same two duplicates and the same same_context_extra_calls: 2 the PR body's transcript reported, which is the profile-independence claim in concrete form.

Cache keys: .github/actions/claude-setup/action.yaml (prefix-key: ${{ hashFiles('Cargo.lock') }}, save-if: false, no shared-key) vs .github/actions/test-setup/action.yaml (prefix-key: v1-rust, shared-key: shared, saved only by test on main). grep -rn -- "--release" .github/ returns nothing, so no workflow populates release artifacts regardless.

@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Ran this week's cache-check with the recipe as it stands in this PR (--format=claude-code, debug build) — both fixes are right, and the section works end to end on ubuntu-24.04. One thing worth folding in while you're here: the .cache report will always show one duplicate that isn't a render cache miss.

-vv collects the diagnostic bundle in the same process it profiles, and that collection runs its own git worktree list --porcelain for the report's worktree snapshot. So it lands in the trace alongside the render's call and gets flagged:

"command": "git worktree list --porcelain",
"max_per_context": 2,
"contexts": [{"context": ".", "count": 2}]

The trace makes the attribution unambiguous — the second call sits between git --version and gh --version, which are bundle-collection probes, not render work:

[a] $ git --version
[a] ✓ git --version  1.421ms
[a] $ git worktree list --porcelain [.]
[a] ✓ git worktree list --porcelain [.]  1.589ms
[a] $ gh --version

With that one discounted, this week's render had no duplicates at all.

The baseline number is also worth a second look. This section says ~29 subprocesses per render with >32 warranting investigation, but a warm run here came in at 15 — a fresh single-worktree checkout does far less work than whatever repo the 29 was measured on. Since the count scales with worktree count, an absolute threshold flags on repo shape rather than on a regression; the duplicate list is the part that actually transfers between environments. Might be worth stating the count as environment-dependent context rather than a trigger.

Also: the first run of a fresh clone isn't the one to read

The cold run reported 33 commands, over the stated threshold, but the excess is all first-invocation bootstrap that never recurs: git ls-remote (the once-per-repo default_branch() fallback), plus gh api / gh pr list for CI status. It also picked up a 5-second az call from the runner's git credential helper. Re-running after the caches warm gives the 15 above. If the threshold survives, the recipe should probably say to profile the second run.

@max-sixty
max-sixty merged commit 350ad76 into main Aug 17, 2026
36 checks passed
@max-sixty
max-sixty deleted the nightly/clean-31931356439 branch August 17, 2026 08:48
worktrunk-bot added a commit that referenced this pull request Aug 23, 2026
The MSRV bump to 1.97 in this PR fails both nightly jobs that pin their own
toolchain: `rustup override set nightly-2026-03-01` resolves to
1.96.0-nightly, and cargo refuses a workspace whose `rust-version` exceeds the
toolchain, so `minimal-versions` and `check-unused-dependencies` both die with
"rustc 1.96.0-nightly is not supported" before running their checks. It would
follow the merge onto main too -- nightly's push trigger lists `**/Cargo.toml`.

The pin was set in #2636 and never moved; 1.96 was the last MSRV it could
satisfy. Move both to nightly-2026-08-01 (1.99.0-nightly), which clears the
new MSRV with two release cycles of headroom instead of landing on it, and
say so on the line so the constraint isn't rediscovered.

Add the pins to the weekly MSRV file table, which listed only the three
manifests -- the reason nothing caught this before the bump landed.

Also fixes two things in the statusline cache-check the previous commit
touched: `command_count` includes the -vv collector's three calls, against a
baseline measured in #2211 before the recipe used -vv (#3825 switched it
without re-measuring), so it reads ~3 high against a threshold only 3 wide;
and `.git/wt/logs/trace.log` is the gitdir-file path shape this same skill
warns about, since the recipe says to run from any worktree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants