feat(hooks): emit compaction lifecycle hooks#16788
Open
vincentkoc wants to merge 22 commits intoopenclaw:mainfrom
Open
feat(hooks): emit compaction lifecycle hooks#16788vincentkoc wants to merge 22 commits intoopenclaw:mainfrom
vincentkoc wants to merge 22 commits intoopenclaw:mainfrom
Conversation
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Contributor
Author
|
@greptileai i addressed your one issue on duplicate comment in the docs/readme. The PR should be ready to merge, can you please update your PR score? |
bfc1ccb to
f92900f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Compaction is a critical lifecycle boundary for observability and guardrails, but runtime hook visibility was incomplete. This PR adds explicit compaction lifecycle emissions so operators and plugins can reliably track pre/post compaction state. lobster-biscuit
Split Context
This PR was split from closed umbrella PR #9761: #9761.
Detailed Changes
session:compact:beforesession:compact:afterbefore_compactionafter_compactionRelated Links, Issues and Resolutions
Greptile Summary
Adds internal (
session:compact:before,session:compact:after) and plugin (before_compaction,after_compaction) hook emissions to the compaction flow with count/token metadata. The implementation correctly passes context includingsessionId,agentId,sessionKey,workspaceDir, andmessageProviderto plugin hooks, addressing previous concerns about missingsessionId. The PR also includes a subtle bug fix changingcwd: resolvedWorkspacetocwd: effectiveWorkspaceto properly respect sandbox settings.compactedCountcorrectly measures total reduction from validated transcript through both history limiting and compactionsessionIdin plugin context have been resolvedConfidence Score: 4/5
sessionIdhave been addressed. The change fromresolvedWorkspacetoeffectiveWorkspaceis a legitimate bug fix. Hook payloads intentionally omit full message snapshots per design decisions documented in TODOs. Loses one point only due to the documentation formatting issue already flagged in previous threads (missing blank line before heading).Last reviewed commit: 85d9ced