fix(compact): add cancellation support for /compact command#66569
fix(compact): add cancellation support for /compact command#66569tentacloos wants to merge 4 commits into
Conversation
…failure Fixes #62496 When Telegram voice notes have undefined paths in allMedia array, the transcription preflight fails because normalizeAttachments filters out entries where both path and url are undefined, causing silent transcription failure. Root cause: allMedia.map((m) => m.path) creates array with undefined values when voice note path is not set, then normalizeAttachments drops all attachments. Changes: - Filter undefined paths with .filter(Boolean) before creating MediaPaths array - Apply fix to both bot-message-context.body.ts and bot-message-context.session.ts - Add test case for handling voice messages with undefined paths gracefully Impact: Telegram voice transcription now works even when some media paths are undefined
Fixes #66549 The --dry-run flag was not being honored in the message send command. The flag only affected progress spinner visibility but the message was still sent to the target channel. Root cause: messageCommand() calls runMessageAction() regardless of dryRun flag value. Changes: - Add conditional logic to skip runMessageAction() when dryRun is true - Return mock result with messageId: 'dry-run' for dry-run mode - Add test case verifying dry-run doesn't call gateway - Preserve existing behavior for non-dry-run executions Impact: --dry-run now safely prevents message delivery as documented
Fixes #66403 The exec approval popup could grow taller than viewport when displaying long commands, pushing action buttons off-screen and making approval unusable without changing browser zoom. Root cause: Desktop .exec-approval-card had no height constraints while mobile version already had max-height: 90dvh and overflow handling. Changes: - Add max-height: 90vh to .exec-approval-card (desktop) - Add flex layout (display: flex, flex-direction: column) - Add max-height: 40vh and overflow-y: auto to .exec-approval-command - Add flex-shrink: 0 to .exec-approval-actions (keep buttons visible) - Command content scrolls when exceeding space, buttons stay accessible Impact: Long command previews scroll instead of pushing buttons off-screen
Fixes #66535 The /compact command was not registrable in ACTIVE_EMBEDDED_RUNS and could not be cancelled via standard paths (chat.abort, abortEmbeddedPiRun, /stop). Root cause: compactEmbeddedPiSession was called without abortSignal and the compaction session was never registered in ACTIVE_EMBEDDED_RUNS. Changes: - Create AbortController for compaction session - Pass abortSignal to compactEmbeddedPiSession call (existing param) - Register compaction in ACTIVE_EMBEDDED_RUNS via setActiveEmbeddedRun - Clean up registration when compaction completes - Add comprehensive test case for cancellation support - Handle interface methods: isStreaming() -> false, isCompacting() -> true Impact: /compact can now be cancelled via any standard cancellation path, preventing user lockout during long compactions
|
Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
Greptile SummaryThis PR adds cancellation support for the Confidence Score: 3/5
|
| queueMessage: async (text: string) => { | ||
| // Compaction doesn't queue messages, but required for interface | ||
| }, |
There was a problem hiding this comment.
Unused parameter may fail lint
The text parameter is declared but never referenced in the body. Oxlint's no-unused-vars rule will flag this. Prefix it with _ to signal intentional non-use:
| queueMessage: async (text: string) => { | |
| // Compaction doesn't queue messages, but required for interface | |
| }, | |
| queueMessage: async (_text: string) => { | |
| // Compaction doesn't queue messages, but required for interface | |
| }, |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/commands-compact.ts
Line: 108-110
Comment:
**Unused parameter may fail lint**
The `text` parameter is declared but never referenced in the body. Oxlint's `no-unused-vars` rule will flag this. Prefix it with `_` to signal intentional non-use:
```suggestion
queueMessage: async (_text: string) => {
// Compaction doesn't queue messages, but required for interface
},
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 454ba36977
ℹ️ 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".
| }); | ||
|
|
||
| // Clean up the active run registration | ||
| clearActiveEmbeddedRun(sessionId, compactionHandle); |
There was a problem hiding this comment.
Always clear active compaction run in a finally block
setActiveEmbeddedRun is registered before awaiting compaction, but clearActiveEmbeddedRun is only reached on the success path; if compactEmbeddedPiSession(...) throws, the session stays stuck in ACTIVE_EMBEDDED_RUNS/session-key mapping as a phantom active run. In that state, later /compact or cancellation flows can repeatedly hit abort/wait behavior against stale state instead of a real run, so the cleanup should be guaranteed in a finally block.
Useful? React with 👍 / 👎.
| if (dryRun) { | ||
| // Dry-run mode: return mock result without actually sending | ||
| result = { | ||
| channel: normalizeOptionalString(opts.channel) || "unknown", | ||
| messageId: "dry-run", |
There was a problem hiding this comment.
Preserve MessageActionRunResult shape for dry-run path
This branch fabricates a custom object instead of using runMessageAction's dry-run result contract, but downstream formatters/JSON builders expect MessageActionRunResult fields like kind, action, handledBy, and payload. As written, dry-run output can lose the dedicated [dry-run] formatting and emit undefined core fields in --json, while also skipping action-level normalization/validation that runMessageAction performs.
Useful? React with 👍 / 👎.
Fixes #66535
The /compact command was not registrable in ACTIVE_EMBEDDED_RUNS and could not be cancelled via standard paths (chat.abort, abortEmbeddedPiRun, /stop).
Root cause: compactEmbeddedPiSession was called without abortSignal and the compaction session was never registered in ACTIVE_EMBEDDED_RUNS.
Changes
Impact
/compact can now be cancelled via any standard cancellation path, preventing user lockout during long compactions, improving UX for automation
Testing
✅ All existing tests pass
✅ Code follows existing patterns for embedded run management