fix(#4927): cover the Anthropic tool_use derived push with the persisted fallback
Codex gate: the third derived-push site (Anthropic tool_use content-array branch, ui.js) still read resultsByTid[tid]||'' without the persisted fallback, so Anthropic-format sessions could still cold-reload with an empty tool body. Add the persistedSnippetByTid fallback there too; now all derived result-snippet reads (OpenAI top-level, Anthropic tool_use, partial) chain to the durable persisted snippet. Added a guard test asserting EVERY derived resultSnippet read includes the fallback.
This commit is contained in:
parent
dad0a3554d
commit
0caa57d8b7
2 changed files with 18 additions and 1 deletions
|
|
@ -11935,7 +11935,7 @@ function renderMessages(options){
|
|||
const args=p.input||{};
|
||||
const tid=p.id||'';
|
||||
const patchSnippet=_cliPatchSnippetFromArgs(name,args);
|
||||
const resultSnippet=resultsByTid[tid]||'';
|
||||
const resultSnippet=resultsByTid[tid]||persistedSnippetByTid[tid]||'';
|
||||
const argsSnap=_toolArgsSnapshot(args);
|
||||
derived.push(copyLiveToolMetadata({
|
||||
name,
|
||||
|
|
|
|||
|
|
@ -60,3 +60,20 @@ def test_partial_tool_calls_path_also_falls_back():
|
|||
"the partial-tool-calls derived path must also fall back to the "
|
||||
"persisted snippet (#4927)"
|
||||
)
|
||||
|
||||
|
||||
def test_all_derived_result_snippet_reads_have_fallback():
|
||||
"""Every derived-push result-snippet READ (OpenAI top-level, Anthropic
|
||||
tool_use content-array, and partial) must include the persisted fallback —
|
||||
a missed branch (e.g. the Anthropic content-array push) would still
|
||||
cold-reload with an empty body (#4927 gate)."""
|
||||
region = _slice_derived_rebuild()
|
||||
# Find every `const resultSnippet=resultsByTid[tid]...` read and assert each
|
||||
# one chains to persistedSnippetByTid.
|
||||
reads = re.findall(r"const resultSnippet=resultsByTid\[tid\][^;]*;", region)
|
||||
assert reads, "no resultSnippet reads found in the derived rebuild"
|
||||
for r in reads:
|
||||
assert "persistedSnippetByTid[tid]" in r, (
|
||||
f"derived resultSnippet read missing the persisted fallback (#4927): {r}"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue