Repository navigation
refactor(auto-reply): keep model-selection fixtures in tests - #140069
Conversation
Remove the marked-test directive and model-selection branches from reply execution and delete their fake command context and model-state helpers. Keep the canonical runtime owners intact and supply scoped test fixtures, prepared thinking-policy facts, and synthetic channel registrations where those dependencies are outside each test subject. Release-note context: internal test-path cleanup; normal reply model selection, directive authorization, native status, and persistence flows remain unchanged.
Use the existing expectDefined helper for prepared reply parameters while preserving the required object-presence assertion and the file size limit.
|
🦞👀 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 6, 2026, 7:28 AM ET / 11:28 UTC. ClawSweeper reviewWhat this changesThe PR removes test-only reply shortcuts from production code and moves synthetic model-selection state into test fixtures while exercising normal directive handling. Merge readiness✅ Ready for maintainer review Keep open: this maintainer-requested cleanup remains useful on current main, and no actionable introduced defect was found. Priority: P3 Review scores
Verification
How this fits togetherAuto-reply turns incoming messages, configuration, and session state into command replies or prepared agent runs. Its directive and model-selection stages determine the selected model and reply settings before execution. flowchart TD
A[Incoming message] --> B[Reply preparation]
C[Configuration and session state] --> B
B --> D[Directive handling]
E[Prepared model catalog] --> F[Model selection]
D --> F
F --> G[Command reply or agent run]
H[Test fixtures] --> D
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -257, Tests +117, Other 0. Total -140 across 13 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep directive and model-selection behavior in their canonical production owners, with synthetic state confined to tests that exercise other responsibilities. Do we have a high-confidence way to reproduce the issue? Not applicable: this is test-path cleanup, and source inspection confirms the alternate branches it removes; no user-facing defect reproduction is claimed. Is this the best way to solve the issue? Yes: removing synthetic production branches and supplying fixtures at test boundaries is a narrow solution that preserves the existing runtime owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ffc1f5a6af99. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Ready for native preparation at Both baseline and candidate passed the same 560-case/18-file cohort. The final assertion-helper consolidation passed its 26-case owner suite and fresh P2 review. The original full-gate failure was one counted test line over the limit; the existing presence helper removed the duplication without weakening assertions. The complete final gate passed: node scripts/check-changed.mjs \
--base 53600f309e69ccb4ec711a255ec7231c6ad98a32 \
--timed -- \
config/assertion-safety-baseline.txt \
src/auto-reply/reply.block-streaming.test.ts \
src/auto-reply/reply/directive-handling.model.test.ts \
src/auto-reply/reply/get-reply-directive-aliases.test.ts \
src/auto-reply/reply/get-reply-directives-apply.test.ts \
src/auto-reply/reply/get-reply-directives.target-session.test.ts \
src/auto-reply/reply/get-reply-directives.ts \
src/auto-reply/reply/get-reply-fast-path.ts \
src/auto-reply/reply/get-reply.fast-path.runtime.test.ts \
src/auto-reply/reply/get-reply.fast-path.test.ts \
src/auto-reply/reply/get-reply.ts \
src/auto-reply/reply/model-selection.test-support.ts \
src/auto-reply/reply/model-selection.tsSeparate Linux Gateway E2Es passed trigger handling 21/21, visible-turn/held-heartbeat 1/1, and automation RPC/CLI 2/2. The last two bind to the final head; all production and E2E bytes are unchanged from the trigger head. The actual marker commands were: node scripts/run-vitest.mjs src/auto-reply/reply.triggers.trigger-handling.e2e.test.ts --reporter=verbose --reporter=json --outputFile=.artifacts/fast-model-final-markers/trigger.json
node scripts/run-vitest.mjs test/pr126853-heartbeat-visible-lane-proof.e2e.test.ts --reporter=verbose --reporter=json --outputFile=.artifacts/fast-model-final-markers/heartbeat.json
node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/gateway-rpc-automation.e2e.test.ts --reporter=verbose --reporter=json --outputFile=.artifacts/fast-model-final-markers/automation.jsonFinal Testbox run; native JSON inventories and all 13 source hashes verified, all leases stopped. These Gateway tests use synthetic fixtures. Exact-head CI 34030056097 succeeded. Fresh managed P2 and the current ClawSweeper review have no accepted findings or rank-up actions. Native review artifacts validate as ready. |
|
Merged via squash.
|
* commit '3ed964c8ca6206d26ecc0b6567ccd1389d9948fc': (36 commits) refactor(plugins): unify install config snapshot preparation (openclaw#140081) fix: cloud provisioning stays failed after temporary storage recovers (openclaw#140021) fix(ci): preflight job outputs exceed 1 MiB on full-plan pull requests (openclaw#140018) refactor: consolidate command and provider helpers (openclaw#140072) fix(doctor): replace unavailable TUI cleanup advice (openclaw#140074) fix(plugins): avoid scoped pack failures and missing runtime entries (openclaw#140016) fix: clarify background command timeouts (openclaw#140022) fix(workboard): refresh board navigation while retaining drafts (openclaw#139952) fix: preserve newer chat drafts when rewind completes (openclaw#140066) feat(transcripts): browse and export saved meeting archives (openclaw#139875) fix(cron): complete timeout test observation phase (openclaw#140076) fix(macos): show the full automation count (openclaw#139692) fix: native worker turns fail to load WebSocket transport (openclaw#140071) fix(cli): complete quoted Bash option values (openclaw#140034) fix(chat): show command instructions while pending (openclaw#140041) refactor(cli): use canonical resume result schema (openclaw#140056) fix: restore package acceptance across install runtimes (openclaw#140062) refactor(auto-reply): keep model-selection fixtures in tests (openclaw#140069) fix(plugins): remove owned aliases before uninstalling files (openclaw#140065) fix: completed replies hang when context-engine cleanup stalls (openclaw#140023) ...
…w#140069) * refactor(auto-reply): keep model-selection fixtures in tests Remove the marked-test directive and model-selection branches from reply execution and delete their fake command context and model-state helpers. Keep the canonical runtime owners intact and supply scoped test fixtures, prepared thinking-policy facts, and synthetic channel registrations where those dependencies are outside each test subject. Release-note context: internal test-path cleanup; normal reply model selection, directive authorization, native status, and persistence flows remain unchanged. * test(auto-reply): reuse prepared-reply presence assertion Use the existing expectDefined helper for prepared reply parameters while preserving the required object-presence assertion and the file size limit.
Related: #130706
What Problem This Solves
Marked reply tests could bypass normal directive handling and model selection through alternate branches in production code. Those branches constructed a synthetic command context and model state, so passing tests could miss regressions in the owners used by real replies.
Why This Change Was Made
Remove both alternate selection paths, their unused command helpers, and the production test-state factory. Tests outside model selection use a narrow fixture in test support. Model and directive tests exercise the real selection owner with prepared catalog, plugin metadata, and thinking-policy facts; routing tests supply synthetic transport plugins to the normal directive and inline-action flow.
User Impact
This maintainer-requested cleanup improves regression coverage without changing normal reply or native-status behavior. Production code decreases by 257 lines; tests and test support grow by 117 lines. The assertion-safety ratchet records one removed assertion.
Evidence
The current-main baseline and candidate both pass all 560 cases across the same 18-file cohort. The normal model-selection function is unchanged, and retained alias cases reject accidental ambient provider-policy discovery. Independent P2 review is scoped-clean for the production change and final test-only helper consolidation.
Separate Linux Testbox runs pass trigger handling (21/21), a visible turn while an independent heartbeat is held (1/1), and cron/task CRUD, heartbeat wake and cancellation through both Gateway RPC and CLI (2/2). The final two runs bind to
d7d56619f1c299e8b0dbad85a48b3ff4733416b1and tree020bd04d440c03e2f8560e8a36b60a5b4f27df9f; the trigger run used the preceding commit with byte-identical production and E2E inputs. Final Linux Testbox run. All native report inventories and source hashes were checked, and the leases are stopped.The first full changed-file gate stopped on a one-line test-file size excess. Reusing the existing presence-assertion helper fixed it without removing assertions; the final file passed 26/26 cases and focused lint. The complete final gate passed production/test types, lint, formatting, dead-export checks and architecture/storage guards. Exact-head CI 34030056097 passed.
ClawSweeper's exact-head review has no findings or before-merge actions. The native maintainer review is validated ready. Timing comparisons are omitted because local runs include cache effects.