Skip to content

refactor(auto-reply): drop dead /reset branches in fast-path session init - #80414

Closed
gllbrn wants to merge 2 commits into
openclaw:mainfrom
gllbrn:fix-reset-clears-session-overrides
Closed

gllbrn wants to merge 2 commits into
openclaw:mainfrom
gllbrn:fix-reset-clears-session-overrides

Conversation

@gllbrn

@gllbrn gllbrn commented May 10, 2026 •

Copy link
Copy Markdown

Summary

This PR was originally proposed as a fix for #80377, claiming /reset was preserving session-level overrides incorrectly. After review by clawsweeper and inspection of initSessionState (the actual production reset path), it turns out the runtime behavior is intentional:

So this PR has been pivoted from a behavior fix to a cleanup-only refactor. The original commit (1a1685a) and the regression tests it added have been reverted in 1d70235. The only remaining net change versus origin/main is replacing nine trivial resetTriggered ? existingEntry?.X : existingEntry?.X ternaries in initFastReplySessionState with the simple existingEntry?.X expression.

Net effect: zero semantic change vs origin/main. The dead resetTriggered branches no longer mislead readers into thinking the fast-path bootstrap has reset-specific logic that the runtime doesn't actually have.

Issue #80377 should be closed as wontfix / by-design (the bundle pattern that was reported is a copy-paste artifact in this fast-path init, not a production runtime bug). This PR does not fix #80377; it only references it.

Files touched

  • src/auto-reply/reply/get-reply-fast-path.ts — simplify 9 no-op ternaries (no semantic change)

Behavior proof (no-op refactor)

This is a semantic no-op cleanup; the proof is the diff itself. Before/after, every assignment evaluates to the same value:

// Before (one of nine identical patterns)
thinkingLevel: resetTriggered ? existingEntry?.thinkingLevel : existingEntry?.thinkingLevel,
// After
thinkingLevel: existingEntry?.thinkingLevel,

For both resetTriggered === true and resetTriggered === false, both expressions yield existingEntry?.thinkingLevel. The resetTriggered semantics still flow through the ...(!resetTriggered ? existingEntry : undefined) spread on line 245 (unchanged), so reset still drops responseUsage and sessionStartedAt correctly. The full pre-existing test suite for get-reply.fast-path.test.ts (12 tests) continues to pass:

Test Files  1 passed (1)
     Tests  12 passed (12)

Test plan

  • pnpm test src/auto-reply/reply/get-reply.fast-path.test.ts → 12/12 (pre-existing tests, unchanged)
  • pnpm tsgo:core → green
  • pnpm tsgo:core:test → green (with GOMEMLIMIT=2GiB on a memory-constrained dev box)

🤖 Generated with Claude Code

`writeSessionEntry`'s reset path used trivial ternaries of the form
`resetTriggered ? existingEntry?.X : existingEntry?.X` for nine fields:
`thinkingLevel`, `verboseLevel`, `reasoningLevel`, `ttsAuto`,
`modelOverride`, `providerOverride`, `authProfileOverride`,
`authProfileOverrideSource`, and `authProfileOverrideCompactionCount`.

Both branches were identical, so the session-level value was preserved
across `/reset`, which prevented `agentCfg?.thinkingDefault` and the
sibling agent-level fallbacks from ever being consulted again once a
user had set an explicit value. The neighbouring `responseUsage` field
already used the intended `resetTriggered ? undefined : existingEntry?.X`
shape, which is now applied to the nine fields above.

Adds two regression tests: one asserts the fields are cleared on
`/reset`, the other asserts they are preserved on a normal turn so that
the non-reset path is not regressed.

Refs openclaw#80377

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 10, 2026
@clawsweeper

clawsweeper Bot commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 11:46 PM ET / 03:46 UTC.

Summary
The PR simplifies fast-path auto-reply session initialization by replacing redundant reset-trigger ternaries with direct existingEntry optional reads.

PR surface: Source -8. Total -8 across 1 file.

Reproducibility: not applicable. This PR no longer claims a user-visible bug fix. Source inspection shows the edited expressions are equivalent for the cleanup scope, while the reset-contract behavior remains tracked separately.

Review metrics: none identified.

Root-cause cluster
Relationship: partial_overlap
Canonical: #80377
Summary: This PR overlaps the reset-contract discussion but is cleanup-only and explicitly does not fix the remaining behavior request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted after-patch terminal/live output, copied output, logs, or a linked artifact from a real OpenClaw run; redact tokens, phone numbers, IPs, private endpoints, and other private data.
  • Refresh the branch against current main and preserve current fast-reset responseUsage behavior.
  • Update the PR body after proof is added; if a fresh review does not run, ask a maintainer to comment @clawsweeper re-review.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body provides source-equivalence reasoning plus test/typecheck output, but no redacted after-patch OpenClaw runtime output, logs, or linked live artifact; update the PR body after adding proof so ClawSweeper can re-review.

Risk before merge

Maintainer options:

  1. Decide the mitigation before merge
    Refresh the branch if maintainers still want the cleanup, preserve current fast-reset responseUsage behavior, add real behavior proof, and leave the reset-contract decision to /reset preserves session-level thinkingLevel/etc — trivial ternaries in get-reply break agent default settings #80377.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Human handling is needed because the remaining actions are contributor proof, branch refresh against current main, and maintainer choice on whether this cleanup-only PR is worth landing.

Security
Cleared: The diff only simplifies TypeScript session-entry assignments and does not touch dependencies, workflows, permissions, secrets, package metadata, or code-execution surfaces.

Review details

Best possible solution:

Refresh the branch if maintainers still want the cleanup, preserve current fast-reset responseUsage behavior, add real behavior proof, and leave the reset-contract decision to #80377.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR no longer claims a user-visible bug fix. Source inspection shows the edited expressions are equivalent for the cleanup scope, while the reset-contract behavior remains tracked separately.

Is this the best way to solve the issue?

Yes for the cleanup scope: direct optional reads are the narrowest maintainable replacement for identical ternary branches. No for the linked behavior request; changing /reset semantics would require a separate maintainer decision across production session paths.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9d68f877ac3e.

Label changes

Label justifications:

  • P3: This is a small cleanup-only PR with no intended user-facing behavior change and limited maintainer urgency.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides source-equivalence reasoning plus test/typecheck output, but no redacted after-patch OpenClaw runtime output, logs, or linked live artifact; update the PR body after adding proof so ClawSweeper can re-review.
Evidence reviewed

PR surface:

Source -8. Total -8 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 9 17 -8
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 9 17 -8

What I checked:

  • Repository policy read: Root AGENTS.md was read fully and its session-state, proof, and read-beyond-diff PR review guidance applies; no scoped AGENTS.md owns src/auto-reply/reply. (AGENTS.md:1, 9d68f877ac3e)
  • Current main still has the cleanup target: initFastReplySessionState still contains redundant resetTriggered ? existingEntry?.X : existingEntry?.X branches for thinking, verbose, reasoning, TTS, model, provider, and auth override fields. (src/auto-reply/reply/get-reply-fast-path.ts:258, 9d68f877ac3e)
  • Live PR diff is cleanup-only after the pivot: The live PR diff shows the first behavior-changing commit was reverted and the remaining patch only replaces the redundant ternaries with direct optional reads in initFastReplySessionState. (src/auto-reply/reply/get-reply-fast-path.ts:258, 1d702356460a)
  • Fast-path owner boundary checked: getReplyFromConfig calls initFastReplySessionState only through the fast test bootstrap path; the normal runtime path calls initSessionState. (src/auto-reply/reply/get-reply.ts:472, 9d68f877ac3e)
  • Native slash fast-path caller checked: maybeResolveNativeSlashCommandFastReply also uses initFastReplySessionState, but excludes /new and /reset native command fast handling before that call. (src/auto-reply/reply/get-reply-native-slash-fast-path.ts:69, 9d68f877ac3e)
  • Production reset semantics are separate: Production session initialization deliberately carries behavior overrides and responseUsage into new sessions, while model/auth selection flows through reset-preservation logic. (src/auto-reply/reply/session.ts:630, 9d68f877ac3e)

Likely related people:

  • steipete: Commit 9f09001014f8b6dcb11606cd65d4d1bb800f60e7 added active fast-path session-state preservation in get-reply-fast-path.ts, including the redundant ternary pattern this PR cleans up. (role: introduced fast-path preservation pattern; confidence: high; commits: 9f09001014f8; files: src/auto-reply/reply/get-reply-fast-path.ts, src/auto-reply/reply/get-reply.ts)
  • litang9: Commit 17aa9d9967ad14e6ba47f89f7b240ef7e9e8dc95 changed the nearby fast-path responseUsage reset behavior and added the current regression test that a branch refresh must preserve. (role: recent adjacent contributor; confidence: high; commits: 17aa9d9967ad; files: src/auto-reply/reply/get-reply-fast-path.ts, src/auto-reply/reply/get-reply.fast-path.test.ts, src/auto-reply/reply/session.ts)
  • mcaxtr: Merged pull request fix(session): preserve verbose/thinking/tts overrides across /new and /reset #10881 established production behavior-override preservation across /new and /reset, which explains the current reset invariant. (role: behavior-preservation contributor; confidence: high; commits: 585c9a726520; files: src/auto-reply/reply/session.ts, src/auto-reply/reply/session-resets.test.ts)
  • sk7n4k3d: Merged pull request session: clear auto-sourced model/auth overrides on /new and /reset #69419 contributed the auto-vs-user model/auth reset-selection boundary referenced by this PR. (role: reset-selection boundary contributor; confidence: medium; commits: 5bc9d9cc5c1c; files: src/config/sessions/reset-preserved-selection.ts, src/auto-reply/reply/session.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

The clawsweeper review on this PR established that production `/reset`
semantics live in `initSessionState` (src/auto-reply/reply/session.ts),
not in `initFastReplySessionState`. The fast-path is only executed
under `OPENCLAW_TEST_FAST=1` and the production runtime intentionally
preserves user-set behavior overrides across `/reset` (per openclaw#69301).

Revert the behavior change and the regression tests, and instead replace
the nine trivial `resetTriggered ? existingEntry?.X : existingEntry?.X`
ternaries with the simple `existingEntry?.X` expression. Net effect:
no semantic change vs origin/main; the dead `resetTriggered` branches
are removed so the code no longer suggests intent that the runtime does
not match.

Refs openclaw#80377

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@gllbrn gllbrn changed the title fix(auto-reply): clear session overrides on /reset refactor(auto-reply): drop dead /reset branches in fast-path session init May 11, 2026
@gllbrn

gllbrn commented May 11, 2026

Copy link
Copy Markdown
Author

Updated the PR body to match the cleanup-only scope after this morning's review:

This should address the "PR body and proof are stale" and "behavior proof" findings.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 26, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 27, 2026
@RomneyDa

Copy link
Copy Markdown
Member

Heads up: this PR needs to be updated against current main before the new required Dependency Guard check can pass.

@clawsweeper

clawsweeper Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@gllbrn thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

@clawsweeper

clawsweeper Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@gllbrn thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@gllbrn thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 28, 2026
@steipete

Copy link
Copy Markdown
Contributor

Closing per ClawSweeper review verdict low_signal_unmergeable_pr (decision packet 2026-06-30T10:35:03.310Z). This item was part of the audited close backlog (openclaw/clawsweeper#920) stranded by an apply-lane defect, drained manually after re-verification. If this is wrong, reopen and ClawSweeper will re-review.

@steipete steipete closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/reset preserves session-level thinkingLevel/etc — trivial ternaries in get-reply break agent default settings

3 participants