fix(tests): pin workspace snapshot in plugin-prompt-sections byte-stability test

test_real_aiagent_builds_section_once_and_keeps_it_out_of_static_prefix
builds the system prompt twice and asserts byte equality, but the prompt
embeds build_coding_workspace_block() — live git status/log output. A git
call failing between the two builds (xdist contention in CI) makes the
Branch/Recent-commits lines differ and fails the test on unrelated PRs
(first seen on #89027's run: diff showed only '- Branch: (detached HEAD)'
and recent-commit lines).

Mechanism reproduced locally: with coding posture on and cwd inside the
checkout, failing git calls on the second build only => first != rebuilt;
with the snapshot pinned, identical git failure => byte-equal. The real
block's byte-stability is coding_context's own contract; this test is
about plugin sections.
This commit is contained in:
Teknium
2026-08-18 02:05:18 -07:00
parent 8a770aae0d
commit 7a0cdbcd79
@@ -42,6 +42,16 @@ def _install_test_section(manager: PluginManager, content) -> None:
def test_real_aiagent_builds_section_once_and_keeps_it_out_of_static_prefix(monkeypatch):
# Pin the workspace snapshot: build_coding_workspace_block shells out to
# live `git status`/`git log` on every build, and a git call failing or
# timing out under xdist contention makes the two builds differ in the
# Branch/Recent-commits lines — a flake unrelated to what this test
# asserts (plugin sections). Byte-stability of the REAL workspace block
# is coding_context's contract, covered by its own tests.
monkeypatch.setattr(
"agent.coding_context.build_coding_workspace_block",
lambda cwd=None: "Workspace (snapshot at session start):\n- Root: /pinned",
)
calls = []
def section(session_info):