Skip to content

🤖 tests: replay and fallback coverage for the toolInstructions record - #7330

Merged
ThomasK33 merged 2 commits into
mainfrom
tk/f31-tool-instructions-tests
Oct 23, 2026
Merged

ThomasK33 merged 2 commits into
mainfrom
tk/f31-tool-instructions-tests

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

Tests for three gaps in the Tool: section freeze from #7323, as its Merge Advisor asked. No production code changes. The tests found no bug.

Implementation

  • Replay test (replayVerify.test.ts): three turns with the Tool: bash text "Use rg.", then "Use fd.", then "Use fd." again. replayVerifySession must rebuild each recorded request through readToolInstructionsRecord and buildReplayRequest. Turn 2 must carry the <tool-instructions tool="bash"> row while its tool descriptions keep "Use rg.", so the test cannot pass vacuously.
  • Fixture mode (replayFixture.ts): before this PR the fixture built every recorded request through the replay path itself (replay compared with itself), on Sonnet 4.5, which never sends rows. The new liveToolInstructions option records the request with the live assemblePromptPayload on Opus 5.5 over the direct route, and writes the records on the assistant row.
  • Fallbacks (turnContextAssembler.test.ts): a tool description rewritten after getToolsForModel sends as before, with no record and no row. A corrupt frozen record keeps the live description and does not crash.

Validation

Each test fails when the path it covers is broken:

  • The replay test fails with the toolInstructions read in replayVerify.ts removed, and with the pass-through in replayRequestBuilder.ts removed.
  • The rewritten-description case fails with the endsWith guard in locateToolInstructions disabled.
  • The corrupt-record case crashes with the frozen == null guard removed.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $593.65

- replayVerify: a Tool: section change mid-segment, recorded the way a
  live turn builds it (frozen descriptions plus a <tool-instructions>
  row), replays through readToolInstructionsRecord and buildReplayRequest
  to the same prompt. The fixture gets a liveToolInstructions mode that
  records the request with assemblePromptPayload and writes its
  system-section records on the assistant row.
- turnContextAssembler: a description rewritten after getToolsForModel
  sends as before with no record and no row; a corrupt frozen record
  keeps the live description and sends the live text in a row.

---
_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T11:05:53.843502Z 04a486f Manual request
🔒 Security Review ✅ Completed 2026-10-23T11:06:32.169467Z 04a486f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 8dd31622d6

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8dd31622d6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

27 agent steps · 7 replayed from cache · 32 model calls · 230.5k tokens (75% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 2 steps · 4 calls 27.1s
🟢 a chat survives a restart of the server 2 steps · 4 calls 27.1s
🟢 compaction.e2e.ts · 1 passed 3 steps · 8 calls 43.1s
🟢 /compact replaces the old chat with a summary 3 steps · 8 calls 43.1s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 13.6s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 13.6s
🟢 settingsRoundTrip.e2e.ts · 1 passed 3 steps · 5 calls 28.6s
🟢 a chat survives trips through Settings 3 steps · 5 calls 28.6s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 4.6s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 4.6s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 3.6s
🟢 the agent opens the playground workspace 2 steps · 1 call 3.6s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 6.9s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 6.9s
🟢 todoNudge.e2e.ts · 1 passed 2 steps · 4 calls 23.6s
🟢 the agent finishes open TODO items after the turn-end nudge 2 steps · 4 calls 23.6s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 23.3s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 4.5s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 4.6s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 5.2s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.2s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 3.1s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 2.6s

e2e 0.20.0 · 2m 58s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 8.0k tokens (32% cached)
Spend: $0.01 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 6.9s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 6.9s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 5.9s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 5.9s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 4.8s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 4.8s

e2e 0.20.0 · 19.7s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 5.3s · 2 targets (web, phone) · run artifacts

… turns

The liveToolInstructions fixture path built its request without the
volatile tail split and other request-time inputs the envelope logs, and
with recordDevtools: false it skipped the assembly, so the assistant row
lost the records production writes. The fixture now builds the request
on every turn with the same inputs and history preparation as replay,
logs the sent system content in the envelope as production does, and
gates only the DevTools entries on recordDevtools.

Addresses Codex PRRT_kwDOPxxmWM6vksx- and PRRT_kwDOPxxmWM6vksyK.

---
_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 04a486fad7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 04a486fad7

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 7edb825 Oct 23, 2026
37 of 38 checks passed
@ThomasK33
ThomasK33 deleted the tk/f31-tool-instructions-tests branch October 23, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant