Skip to content

fix(native-chat): give the chat option write its clock (main typecheck) - #28570

Closed
brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/fix-option-intent-clock
Closed

brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/fix-option-intent-clock

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

ELI5

Two recent fixes merged around the same time and don't fit together, so main no longer typechecks. One of them created the code path that saves a chat's option (model, effort or permission mode) when you send a message. The other made the permission-mode save read the current time from that path's context, but the first never put a clock there. This adds the missing clock, one line.

What Changed

Before: main fails pnpm run typecheck:node:

structured-agent-session-message-options.ts(30,67): error TS2741: Property 'now' is missing in type '{ sessionId: string; ... }' but required in type 'Pick<AgentSessionTurnContext, "fence" | "now" | "persistOptions" | "publish" | "sessionId">'.

At runtime, a permission-mode change written through this path calls ctx.now() on a context that has no now, and throws.

After: the context carries now: () => context.now(), the same way the sibling contexts in the same file and in structured-agent-session-mutation-context.ts do.

How it happened: #27826 created writeStructuredAgentSessionOption with a context that had no now. #28268 then made recordStructuredAgentSessionOptionIntent save the permission mode on its own record field, stamped with ctx.now(). Each PR typechecked on its own base.

Why

This is the smallest fix and matches how every other context in this module supplies its clock. The typecheck error itself guards against this happening again, so no new test is added.

Linked Issue

None. Found while rebasing #28540 onto main at b91795a.

Visual Proof

N/A: the fix restores a compile-time contract. No UI changes.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • With main's version of the file, pnpm run typecheck:node fails with the error above. With this change, pnpm tc:node passes.

  • No new test: the typecheck is what pins this.

Notes

No wire, persistence or platform impact. It only supplies a clock that already exists on the context.

#27826 built the option-write context without a clock, and #28268 then made the permission-mode
path read ctx.now(). The two merged independently, so main fails typecheck and a permission pick
written through this path would throw.
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2763e10d-d00a-4731-8390-816f0ce57fae
📥 Commits

Reviewing files that changed from the base of the PR and between 7760a04 and 6130460.

📒 Files selected for processing: 1
  • src/main/native-chat/agent-session-wire/structured-agent-session-message-options.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

📝 Walkthrough

The option-operation context now provides a now callback that returns the mutation context’s current time. The existing publish callback is unchanged.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 61304

The change supplies the missing current-time callback for permission-mode option writes; no actionable merge risk remains in the reviewed diff.

Pre-merge checks: Passed 5
Passed Passed checks: 5 passed
Check name Status Explanation
Title check Passed The title clearly identifies the focused native-chat fix and the missing clock needed for the main typecheck.
Description check Passed The description is detailed and covers the cause, before-and-after behavior, rationale, testing, visual proof, and impact. It does not provide a linked issue and omits several optional template sectio…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

brennanb2025 added a commit that referenced this pull request Oct 14, 2026
…H and headless hosts (#28558)

Picked from PR head fb40193 before merge to main (main's typecheck is broken by #28268 + #27826; fix #28570).
@nwparker

Copy link
Copy Markdown
Contributor

FYI: the same one-line fix landed in #28571 (069bbaa), so this one is now redundant.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: the same one-line fix landed on main in #28571 (069bbaa).

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.

2 participants