Skip to content

fix: align compaction and stale busy recovery with current OpenCode - #11

Merged
ByBrawe merged 9 commits into
mainfrom
fix/v0.5.24-native-compaction-status
Aug 8, 2026
Merged

fix: align compaction and stale busy recovery with current OpenCode#11
ByBrawe merged 9 commits into
mainfrom
fix/v0.5.24-native-compaction-status

Conversation

@ByBrawe

@ByBrawe ByBrawe commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

This v0.5.24 candidate follows current OpenCode 1.18.15 source behavior rather than guessing from status alone.

  • cross-check stale busy/retry against the latest chronological assistant message and require time.completed before early recovery;
  • keep the old timeout-only fallback only when message history is unavailable, never when history explicitly shows a running assistant;
  • track loop-initiated compaction via experimental.session.compacting and the native session.compacted event;
  • serialize --compact-every so compaction finishes before the actual loop action begins;
  • fix current headless/server session.summarize fallback by supplying the required provider/model payload;
  • add deterministic regressions for completed vs running assistant tails, native compaction completion, no-overlap compact-before-run behavior, and summarize payload compatibility;
  • bump to 0.5.24.

A temporary PR workflow applies the focused large-file patch and requires npm CI/check/test, Bun import, and npm pack dry-run before committing the verified candidate.

Copilot AI lite review requested due to automatic review settings August 8, 2026 17:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns opencode-loop’s compaction and stale busy/retry recovery behavior with current OpenCode (1.18.15), including native compaction lifecycle tracking and a corrected headless session.summarize fallback payload.

Changes:

  • Add message-history-based stale busy recovery that requires a truly completed assistant tail (time.completed) before early finalization.
  • Track and serialize loop-initiated compaction using experimental.session.compacting + session.compacted, and prevent --compact-every overlap with the subsequent action.
  • Add comprehensive deterministic regressions; bump version to 0.5.24 and document the release.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/index.js Implements message-tail validation for stale recovery, compaction lifecycle tracking, and headless summarize payload fixes.
scripts/comprehensive-test.mjs Adds regression coverage for compaction lifecycle, compact/action serialization, and completed-vs-running tail handling.
README.md Updates “Current status” to describe v0.5.24 behavior.
package.json Bumps package version to 0.5.24.
package-lock.json Updates lockfile version metadata to 0.5.24.
CHANGELOG.md Adds v0.5.24 changelog entry summarizing the behavioral changes and test additions.
.github/workflows/apply-v0524-pr.yml Adds a PR workflow to apply/verify/commit the v0.5.24 candidate patch.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/index.js
Comment on lines +567 to +575
const tail = orderedSessionMessages(messages).at(-1)
const info = tail?.info || tail
if (!info || info.role !== "assistant") return "incomplete"
const completed = Number(info?.time?.completed || 0)
const created = Number(info?.time?.created || 0)
if (!Number.isFinite(completed) || completed <= 0) return "incomplete"
const startedAt = Number(active?.startedAt || 0)
if (startedAt > 0 && completed < startedAt && (!Number.isFinite(created) || created < startedAt)) return "incomplete"
return "completed"
Comment thread src/index.js Outdated
clearActiveRun(sessionID)
sessionStatuses.delete(sessionID)
sessionStatusSeenAt.delete(sessionID)
await appendLoopLog(directory, "compact-finished", { sessionID, job: pending.jobId, resumeAfter: true })
@ByBrawe
ByBrawe merged commit 97f2332 into main Aug 8, 2026
4 checks passed
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.

2 participants