feat(opencode-plugin): make auto-compaction configurable via WORKFLOW_AUTO_COMPACT - #261
Conversation
…_AUTO_COMPACT Add WORKFLOW_AUTO_COMPACT env var to control whether session compaction is triggered on phase transition. Defaults to enabled; set to 'false' to disable. Adds a corresponding e2e test case.
There was a problem hiding this comment.
Pull request overview
Adds an opt-out switch for the opencode-plugin’s automatic “compaction” (session summarize) that runs after successful phase transitions, controlled via WORKFLOW_AUTO_COMPACT.
Changes:
- Gate
client.session.summarize()inproceed_to_phasebehindWORKFLOW_AUTO_COMPACT(default remains enabled). - Emit a debug log when compaction is skipped due to
WORKFLOW_AUTO_COMPACT=false. - Add an E2E test verifying compaction is not triggered when the env var opt-out is set.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/opencode-plugin/src/tool-handlers/proceed-to-phase.ts | Adds env-var gating around post-transition compaction and logs skip behavior. |
| packages/opencode-plugin/test/e2e/plugin.test.ts | Adds E2E coverage for opt-out behavior (WORKFLOW_AUTO_COMPACT=false). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Normalize env var with trim/toLowerCase before comparison - Restore original env var value in test finally block instead of unconditional delete
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add sessionID to skip-compaction debug log for easier troubleshooting - Ensure WORKFLOW_AUTO_COMPACT is cleared in global beforeEach alongside WORKFLOW_AGENTS so compaction tests are deterministic in any environment - Assert proceed_to_phase result contains 'plan' in opt-out test to confirm the transition succeeded (not just that summarize was skipped due to an error)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
WORKFLOW_AUTO_COMPACTenv varWORKFLOW_AUTO_COMPACT=false, compaction is skipped and a debug log is emitted insteadTest plan
triggers compaction after a successful phase transitionstill passes (default on)does not trigger compaction when WORKFLOW_AUTO_COMPACT=falseverifies opt-outdoes not trigger compaction when transition failsunaffected