Repository navigation
Reuse trusted workflow content during source waits - #1525
Conversation
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on f0085ec293c21045e996fe4aa63a368e30149e31, 55.2s: approve (0 critical, 0 important, 3 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| monkeypatch.setattr(cli, "_sleep", lambda _: None) | ||
| code, out, err = run(capsys, "ready", "--wait") | ||
|
|
||
| assert sum(call[0] == "show" and call[-1].endswith(":workflow.toml") for call in git_calls) == 1 |
There was a problem hiding this comment.
suggestion: Inline workflow-read count duplicates existing assert_git_cost helper
The new assertion reimplements the show ... :workflow.toml counting predicate already defined in assert_git_cost (tests/test_cli.py:306-308). If the predicate ever changes (for example, the blob read moves to cat-file), the two copies will drift apart. Factor the predicate into a small shared helper that both call sites use, or use assert_git_cost(git_calls, <total>, 1). Pinning the total would also lock in the claimed reduction from 41 to 30 Git commands, which the current test does not check.
|
|
||
|
|
||
| def _remote_workflow(worktree: Path, branch: str) -> tuple[Config, str]: | ||
| def _has_replacement_refs(common_dir: Path) -> bool: |
There was a problem hiding this comment.
suggestion: Replacement-ref guard and cache-miss paths have no automated coverage
_has_replacement_refs is a new hand-written probe of Git's on-disk layout: the loose refs/replace directory, reftable, and packed-refs. The only evidence for it is the manual check described in the task. No test runs the loose or packed replacement case, a ref move between polls, or the two-branch setup where origin/HEAD differs from repo.base. If this guard regresses, the waiter could quietly keep using a stale parsed policy, and nothing would catch it. Two cheap tests would close the gap: one that writes a refs/replace/<sha> line to packed-refs, and one that moves origin/<base> between polls, each asserting that the workflow blob is read again. Those tests would add lines, which conflicts with the no-net-test-lines goal, so this is non-blocking.
| ) | ||
| branch = ref.removeprefix(prefix) | ||
| policy, revision = _remote_workflow(worktree, branch) | ||
| policy, revision = _remote_workflow(worktree, branch, previous) |
There was a problem hiding this comment.
suggestion: Split default/base configuration still rereads the default branch workflow every poll
previous holds the policy from the base branch. When origin/HEAD points at a different branch than repo.base, the first _remote_workflow(worktree, branch, previous) call fails previous.base_branch == branch, so it runs git show and parses the default branch's workflow on every poll. That is correct, just not cached. In this setup the wait still makes one blob read per poll instead of one in total. If that setup matters, the cache would need to key on the default branch's revision as well. Otherwise, note in ARCHITECTURE.md that reuse only covers the base workflow.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Reuse trusted workflow content during source waits
Context and goal
Closes #1491
Acceptance
Validation evidence
The 12-observation fixture went from 41 Git commands and 12 workflow blob reads to 30 Git commands and one workflow blob read. Across 15 interleaved runs, median handler time fell from 103.72 ms to 85.71 ms. Focused wait tests passed with zero net test lines, and manual loose and packed replacement-ref cases still loaded the effective workflow.
Base
Base: a68ef3b
Validation
Recorded for
f0085ec293c2uv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review