feat: fire session reset hooks for daily and idle resets#61675
feat: fire session reset hooks for daily and idle resets#61675salvormallow wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d004142bd1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryWires Confidence Score: 5/5Safe to merge — both new hook blocks are correctly guarded, fire-and-forget semantics match existing patterns, and tests cover all key scenarios including no-double-fire on manual resets. All previously flagged issues are resolved. The missing No files require special attention. Greploops — Automatically fix all review issues by running Reviews (2): Last reviewed commit: "feat: fire session reset hooks for daily..." | Re-trigger Greptile |
d004142 to
86ec2f8
Compare
|
Addressed all three review comments in 86ec2f8: @chatgpt-codex-connector P2 — Internal hooks gated behind hookRunner: @greptile-apps P1 — Missing @greptile-apps P2 — Long line: All 34 tests pass. |
86ec2f8 to
6682f77
Compare
6682f77 to
7e627e9
Compare
|
(Updated after rebase onto latest main — the review fixes from the previous comment are now in 7e627e9. Also resolved merge conflict in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e627e9e55
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
7e627e9 to
fbbf7bb
Compare
|
@chatgpt-codex-connector Fixed in fbbf7bb — now uses the already-resolved |
|
To use Codex here, create a Codex account and connect to github. |
|
CI note: All failures on this PR are pre-existing upstream breakage on
These cascade into the extension shard cancellations. This PR only touches Happy to rebase once main is green again. ready for review whenever you get a chance 🙏 |
|
Amazing work! We need this fix! |
Wire internal hooks and before_reset plugin hook into the lazy staleness path so they fire on daily (4AM) and idle-timeout resets, not just manual /new and /reset commands. Both hooks fire as fire-and-forget to avoid blocking the user's message response (session-memory's LLM slug generation can take up to 15s). commands-core is dynamically imported inside the fire-and-forget block to avoid pulling its heavy dependency tree into session.ts's static imports. Export loadBeforeResetTranscript from commands-core for use by session.ts. Update bundled session-memory hook registration and filter to accept "daily" and "idle" actions. Fixes openclaw#10142, openclaw#31266, openclaw#50891, openclaw#43524 Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
@salvormallow 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 status: review started. I am starting a fresh review of this pull request: feat: fire session reset hooks for daily and idle resets This is item 1/1 in the current shard. Shard 11/22. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Summary
before_resetplugin hook only fire for manual/newand/resetcommands, not for daily (4AM) or idle-timeout session resets. This meanssession-memorynever saves on daily/idle resets.initSessionState(), updatesession-memoryregistration and filterexportadded to existing functionsChange Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
initSessionState()firessession_end/session_startplugin hooks for lazy resets but never firestriggerInternalHookorhookRunner.runBeforeReset. These only fire viaemitResetCommandHooks()incommands-core.ts, which is only called for manual/newand/resetcommands.Regression Test Plan (if applicable)
src/auto-reply/reply/session.stale-hooks.test.ts(new),src/hooks/bundled/session-memory/handler.test.ts(extended)action: "daily"/"idle"when session is stale;before_resetplugin hook fires for lazy resets; no double-fire on manual resettriggerInternalHookandhookRunnerto assert dispatch without side-effectssession-hooks-context.test.tscoverssession_end/session_startbut not internal hooks orbefore_resetUser-visible / Behavior Changes
session-memorynow saves session summaries on daily (4AM) and idle-timeout resets, not just manual/newand/reset. Pluginbefore_resethook now fires for lazy resets, giving plugins pre-archive transcript access.Diagram (if applicable)
Security Impact (required)
Repro + Verification
Environment
Steps
Expected
session-memorysaves a summary of the previous sessionbefore_resetplugin hook fires withreason: "daily"and transcript messagesActual (before this PR)
session-memorydoes not fire — no summary savedbefore_resetplugin hook does not fireEvidence
Human Verification (required)
Review Conversations
Compatibility / Migration
Risks and Mitigations
before_resetreceives the post-archivesessionFilepath (afterrenameSync), not the original path.loadBeforeResetTranscripthandles ENOENT by scanning for the latest.reset.*archived sibling.AI Disclosure
🤖 AI-assisted with Claude Code
cc @vincentkoc (hooks/plugins CODEOWNER)