Skip to content

fix(discord): reset custom trigger sessions safely - #77639

Closed
yfge wants to merge 1 commit into
openclaw:mainfrom
yfge:fix/pr-56362-discord-reset-trigger-mainline
Closed

yfge wants to merge 1 commit into
openclaw:mainfrom
yfge:fix/pr-56362-discord-reset-trigger-mainline

Conversation

@yfge

@yfge yfge commented May 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • emit reset hooks for matched custom resetTriggers like !new / !reset instead of only slash commands
  • rotate generated/default reset transcripts to the new session id while preserving only validated explicit sessionFile paths
  • add regressions for Discord bang reset triggers and unsafe outside transcript metadata

Fixes #55474.
Supersedes #56362.

What Problem This Solves

Discord/custom reset trigger aliases such as !fresh could rotate a session without running the expected reset hook fallback path, leaving custom reset sessions inconsistent with the built-in /new and /reset behavior.

Evidence

  • Rebased onto current origin/main and resolved the conflict in src/auto-reply/reply/get-reply.ts by preserving both the current session-prepared callback path and the custom reset-trigger fallback hook mapping.
  • node scripts/run-vitest.mjs run src/auto-reply/reply/get-reply.reset-hooks-fallback.test.ts src/auto-reply/reply/session.test.ts --reporter=verbose passed 123 tests on commit 5fff06e3e642121b7d5d3c95768108f2cb31f8c0.
  • pnpm exec oxfmt --check --threads=1 src/auto-reply/reply/get-reply.reset-hooks-fallback.test.ts src/auto-reply/reply/get-reply.test-fixtures.ts src/auto-reply/reply/get-reply.ts src/auto-reply/reply/session.test.ts src/auto-reply/reply/session.ts passed.
  • git diff --check origin/main...HEAD passed.

Tests

  • pnpm test src/auto-reply/reply/session.test.ts src/auto-reply/reply/get-reply.reset-hooks-fallback.test.ts src/gateway/server.sessions.reset-models.test.ts src/config/sessions/sessions.test.ts
  • pnpm check:changed

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M labels May 5, 2026
@clawsweeper

clawsweeper Bot commented May 5, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open. Current main and v2026.6.11 still have the slash-only fallback hook path, and this PR is the canonical open fix for custom reset-trigger hook emission, but it is not merge-ready without real Discord/gateway behavior proof and PR-body scope cleanup.

Root-cause cluster
Relationship: canonical
Canonical: #77639
Summary: This PR remains the canonical open candidate for the custom reset-trigger fallback-hook gap; transcript rotation and compaction cleanup are related but separate reset-state work.

Members:

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

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

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

Yes at source level: configure a custom reset trigger such as !fresh, let session initialization mark resetTriggered, then current main's fallback hook path returns because the command body is not slash-prefixed. I did not run a live Discord/gateway flow in this read-only review.

Is this the best way to solve the issue?

Yes for the code shape, with caveats: carrying the matched reset trigger from session initialization into fallback hook emission is the narrowest maintainable fix I found. It is not merge-ready until real Discord/gateway proof is supplied and the PR body matches the actual diff.

Security review:

Security review cleared: No concrete security or supply-chain concern was found; the diff is limited to TypeScript reset/session logic and tests with no dependency, workflow, credential, or artifact changes.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-05-05T02:38:05Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is missing and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • chilu18: Authored the merged PR that added native /new fallback hook coverage in get-reply, which this PR extends to custom resetTriggers. (role: introduced fallback hook behavior; confidence: high; commits: a78a3021f5df; files: src/auto-reply/reply/get-reply.ts, src/auto-reply/reply/get-reply.reset-hooks-fallback.test.ts, src/auto-reply/reply/commands-core.ts)
  • steipete: Merged the fallback-hook PR and appears in recent reset-hook file history around commands-reset-hooks and get-reply. (role: merger and adjacent reset-hook contributor; confidence: high; commits: 3f1d79de890e, 3ee5490c6001; files: src/auto-reply/reply/get-reply.ts, src/auto-reply/reply/commands-reset-hooks.ts)
  • jalehman: Recently refactored guarded reply session initialization and authored the merged session_end lifecycle hook work that shares this reset/session boundary. (role: recent session initialization contributor; confidence: medium; commits: 95e37f8e9517, 2b28e758222c; files: src/auto-reply/reply/get-reply.ts, src/auto-reply/reply/session.ts, src/auto-reply/reply/session-hooks.ts)

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

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 6, 2026
@yfge

This comment was marked as spam.

@yfge

This comment was marked as spam.

@yfge

This comment was marked as spam.

@yfge

This comment was marked as spam.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. labels May 17, 2026
@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 Jun 1, 2026
@clawsweeper clawsweeper Bot added the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label Jun 1, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 2, 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. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. labels Jun 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed gateway Gateway runtime size: M labels Jun 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 25, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

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

Labels

merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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.

[Bug]: Discord session.resetTriggers matches !new, but sessionId does not rotate, context keeps accumulating

1 participant