Skip to content

refactor(auto-reply): keep model-selection fixtures in tests - #140069

Merged
steipete merged 2 commits into
mainfrom
codex/130706-fast-model-final-20260906
Sep 6, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/130706-fast-model-final-20260906

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

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 d7d56619f1c299e8b0dbad85a48b3ff4733416b1 and tree 020bd04d440c03e2f8560e8a36b60a5b4f27df9f; 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.

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.
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete steipete self-assigned this Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 11:22
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 7:28 AM ET / 11:28 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: d7d56619f1c299e8b0dbad85a48b3ff4733416b1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused simplification with retained behavioral assertions, useful reported validation, and no blocking source finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a MEMBER-authored internal cleanup, so the external-contributor proof gate does not apply; reported tests exercise reply preparation and directives, and no material production authority change requires additional final-effect proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a MEMBER-authored internal cleanup, so the external-contributor proof gate does not apply; reported tests exercise reply preparation and directives, and no material production authority change requires additional final-effect proof.
Evidence reviewed 8 items Canonical reply path retained: The introduced diff removes the marked-test early return; replies proceed through resolveReplyDirectives. Model selection now calls the existing production owner with the same arguments previously used outside the shortcut.
Removed behavior is test-gated: Fast runtime selection requires both a detected test runtime and process-local marked configuration. The deleted fixture is replaced by test-support imports only; the search found no remaining references to the deleted helpers. This changes OpenClaw test routing, without changing the Codex runtime or protocol contract.
Cleanup remains absent from main: Fetched main still exports the synthetic fast-test model-state factory. The central production files are unchanged between the pinned merge base and fetched main, so the proposed cleanup remains distinct.
Findings None None.
Security None None.

How this fits together

Auto-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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -257, Tests +117, Other 0. Total -140 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 4 28 285 -257
Tests 8 215 98 +117
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 13 244 384 -140

Review metrics

Metric Value Why it matters
Production versus test footprint Production −257 lines; tests and test support +117 lines The growth is confined to fixtures and retained boundary coverage while duplicate production execution paths are removed.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is internal test-path cleanup with no demonstrated change to normal user-facing reply behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a MEMBER-authored internal cleanup, so the external-contributor proof gate does not apply; reported tests exercise reply preparation and directives, and no material production authority change requires additional final-effect proof.

Label justifications:

  • P3: This is internal test-path cleanup with no demonstrated change to normal user-facing reply behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a MEMBER-authored internal cleanup, so the external-contributor proof gate does not apply; reported tests exercise reply preparation and directives, and no material production authority change requires additional final-effect proof.

Evidence

What I checked:

  • Canonical reply path retained: The introduced diff removes the marked-test early return; replies proceed through resolveReplyDirectives. Model selection now calls the existing production owner with the same arguments previously used outside the shortcut. (src/auto-reply/reply/get-reply.ts:900, d7d56619f1c2)
  • Removed behavior is test-gated: Fast runtime selection requires both a detected test runtime and process-local marked configuration. The deleted fixture is replaced by test-support imports only; the search found no remaining references to the deleted helpers. This changes OpenClaw test routing, without changing the Codex runtime or protocol contract. (src/auto-reply/reply/get-reply-fast-path.ts:96, d7d56619f1c2)
  • Cleanup remains absent from main: Fetched main still exports the synthetic fast-test model-state factory. The central production files are unchanged between the pinned merge base and fetched main, so the proposed cleanup remains distinct. (src/auto-reply/reply/model-selection.ts:102, ffc1f5a6af99)
  • Latest-release comparison: The supplied latest release, v2026.9.2, also contains the production test-state factory; this cleanup is not already present in that release. (src/auto-reply/reply/model-selection.ts:102, 3928bad9badf)
  • Retained directive coverage: Alias tests supply prepared catalog and thinking-policy facts to the real selection owner, reject ambient policy discovery, and retain unauthorized-input, command-disablement, skill-opacity, and caption-delivery assertions. (src/auto-reply/reply/get-reply-directive-aliases.test.ts:157, d7d56619f1c2)
  • Validation and related-work context: The captured PR body reports 560 passing cases across 18 files on both baseline and candidate, 21 trigger E2E cases on unchanged production source, and a passing changed-file gate. These are contributor-reported results, not locally executed checks. The linked fix: prevent Gateway stalls with multiple workspaces #130706 remains open and addresses broader Gateway metadata and polling work, rather than establishing a merged replacement. (d7d56619f1c2)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Ready for native preparation at d7d56619f1c299e8b0dbad85a48b3ff4733416b1 (tree 020bd04d440c03e2f8560e8a36b60a5b4f27df9f). The canonical model-selection owner is unchanged; duplicate test execution paths and the production fixture factory are removed. Production −257 lines, tests/support +117; no config, schema or protocol change.

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.ts

Separate 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.json

Final 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.

@steipete
steipete merged commit 286d21d into main Sep 6, 2026
265 checks passed
@steipete
steipete deleted the codex/130706-fast-model-final-20260906 branch September 6, 2026 11:40
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc pushed a commit to gaoanze888/openclaw that referenced this pull request Sep 6, 2026
* 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)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant