Skip to content

[codex] Fix compaction stop and detach cleanup#89

Open
eeelvn-bot wants to merge 1 commit into
pwrdrvr:mainfrom
eeelvn-bot:codex/compaction-stop-detach-cleanup
Open

[codex] Fix compaction stop and detach cleanup#89
eeelvn-bot wants to merge 1 commit into
pwrdrvr:mainfrom
eeelvn-bot:codex/compaction-stop-detach-cleanup

Conversation

@eeelvn-bot
Copy link
Copy Markdown

Summary

This PR fixes a generic compaction lifecycle bug in the Codex app server plugin.

It does not add Feishu-specific behavior. The change applies to any channel that exposes the status card controls, including Telegram, Discord, and Feishu/Lark.

What Changed

  • track active compaction work separately from active turn runs
  • allow compactThread() to be aborted via AbortSignal
  • stop compaction keepalive messages when users trigger Stop
  • stop compaction keepalive messages when users trigger Detach
  • add regression tests covering both stop and detach cleanup

Root Cause

Compact started its own keepalive timer, but that timer was not registered in activeRuns and had no dedicated cancellation path.

As a result, Stop and Detach could interrupt normal turn runs, but they could not clear an in-flight compaction keepalive loop. If compaction stalled or never settled, the plugin could continue emitting Codex is still compacting. messages indefinitely.

Why This Is Separate

This is a host/plugin lifecycle fix, not a Feishu support change. It is split out so the Feishu/Lark support PR stays minimal and reviewable.

Validation

  • pnpm typecheck
  • pnpm test
  • targeted regression coverage for compaction stop/detach cleanup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant