Repository navigation
fix: report native session model facts to context engines - #146801
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 3:53 AM ET / 07:53 UTC (Revision 3). ClawSweeper reviewWhat this changesReport the native session’s actual provider and model to context-engine plugins after a turn, omit unattested host limits, and extend regression coverage. Merge readiness✅ Ready for maintainer review This remains a useful, focused correction absent from the inspected main revision. No actionable correctness or security defect was found, and the maintainer-authored, protected PR should remain open for normal landing. Priority: P2 Review scores
Verification
How this fits togetherAgent harnesses execute model turns and pass accepted-turn facts to OpenClaw’s durable context-engine pipeline. Context-engine plugins use those facts when recording completed turns and managing conversation context. flowchart TD
A[Prepared session] --> B[Agent harness executes turn]
B --> C[Completed turn and model facts]
C --> D{Native runtime and model tuple?}
D -->|Yes| E[Native provider and model]
D -->|No| F[Host model and limits]
E --> G[Accepted-turn outbox]
F --> G
G --> H[Context-engine plugin]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +7, Tests +44. Total +51 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep model attribution with the prepared native session and report limits only when their applicability is established. Do we have a high-confidence way to reproduce the issue? Yes, from source: a prepared native session can return a different model tuple while current main reports the outer host tuple and limits. The added callback regressions cover that mechanism; no runtime reproduction was executed here. Is this the best way to solve the issue? Yes. The patch corrects the existing producer, preserves ordinary host-budget reporting, and uses already-optional metadata without adding a competing model-selection path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 65c8b06f2e42. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
1bd5cd4 to
fc90736
Compare
fc90736 to
c003695
Compare
|
Merged via squash.
|
…ssion-list-roster-batch-20260913 * commit 'f513c0f345f7f2514c49ccfbc00adc3f78b9a755': (46 commits) chore(i18n): refresh native locales (#146924) perf(secrets): limit expiry metadata to transient credentials (#146882) fix(ui): preserve queued refreshes during session discovery (#146535) test(ui): wait for quiet scrolling and close named file tabs (#146836) fix(ui): prevent Usage hour filters from freezing during DST (#146919) test(ui): share browser page cleanup across layout fixtures (#146805) ci: balance complete PR runtime test groups (#146916) improve(infra): reduce scheduling work for session notice bursts (#146818) improve: prepare Gateway skill commands asynchronously (#146812) improve(agents): skip unused assistant delivery parsing (#146858) improve(ui): reuse date formatters across timestamp lists (#146789) fix(tests): isolate installer and Docker shell snippets (#146897) test(heartbeat): share explicit channel configuration fixtures (#146853) fix: retain conversation reply claims through write admission (#146866) perf(sessions): bound history reads and stabilize cursor paging (#146770) fix(ui): let slow dashboard downloads finish before recovery (#146881) fix: share Doctor lifecycle coordination with SQLite workers (#146714) fix: retain native session model provenance (#146801) fix: settle embedded transcript repairs before session cleanup (#146842) feat(macos): improve agent navigation and chat layout (#146531) ...
Related: #130741
What Problem This Solves
Fixes an issue where a context-engine plugin could receive the wrong model and unverified context limits after a turn in a native-owned session. A resumed native session can select a different model from the surrounding OpenClaw configuration.
Why This Change Was Made
Use the model/provider tuple reported by the prepared native session for accepted-turn context. A native model tuple does not establish that the host context window or token budget applies, so those values are omitted for that result. Other turns retain their existing model and budget fields.
User Impact
Context-engine plugins receive model facts from the owner of the completed native turn. Native model selection, credentials, configured limits, transcript authority, and durable outbox processing keep their existing contracts.
Evidence
The new cases failed on the original code for the intended model-attribution and unsupported-budget errors. After the repair, all 219 selection, ownership, backend and durable context-engine tests passed. Six existing synthetic Codex app-server boundary cases also passed. All tests used Node 24.21 with one worker; the assertions and timeouts stayed unchanged. Independent P1 review found no actionable defects.
The native files are unchanged after refreshing onto current main, so their focused tests, canonical checks and P1 review remain valid. The eight terminal-context cases also passed on the prior integration. The fresh-main comparison confirmed that all 34 audited native ownership, protocol, focused-test, support, manifest and Vitest-routing inputs are unchanged. The upstream sidebar and test-inventory CI fixes are inherited from main; this PR carries only the native two-file delta.
This is focused correctness evidence; native live and integrated Swarm responsiveness proof remain part of the parent campaign.