Commit Graph

22 Commits

Author SHA1 Message Date
YeonGyu-Kim 44ef5dec1d fix(runtime-events): honor OpenCode progress shapes 2026-05-19 13:48:45 +09:00
YeonGyu-Kim 4da48555ee fix(plugin): normalize event session ids
Handle OpenCode session events that carry the session ID under properties.info.id or properties.info.sessionID so background tasks and continuation hooks do not miss idle/error/delete events.

Add regression coverage for nested session.idle events completing background tasks and waking continuation hooks.
2026-05-12 12:32:26 +09:00
YeonGyu-Kim 49ff4b5f8d fix(compaction): ignore compaction agent updates
Fixes #3819
2026-05-11 13:25:29 +09:00
YeonGyu-Kim eb722aa977 perf(compaction): reuse message update parts for no-text tails
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-28 17:59:50 +09:00
YeonGyu-Kim 1aebf39d23 refactor(hooks): split preemptive-compaction.ts to comply with 200 LOC module rule
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-18 01:50:41 +09:00
YeonGyu-Kim 1ea0ee4319 fix(preemptive-compaction): notify user on failure and reduce timeout
Reports from david_66 on Discord: sessions get perceived as 'stuck' when
context usage crosses the 78% threshold. Investigation confirmed two
issues in the preemptive compaction hook:

1. PREEMPTIVE_COMPACTION_TIMEOUT_MS was 120s. While the summarize
   request is in flight, tool.execute.after short-circuits via the
   compactionInProgress guard. A hung summarize blocked the session
   for two full minutes before giving up, which users reasonably
   experience as a hang.

2. On failure (timeout or exception) only a log line was emitted. The
   user had no visibility into why their session was unresponsive or
   why auto-compaction never ran, so a transient upstream error could
   silently leave them well above the threshold with no signal.

Fix:

- Reduce timeout 120s -> 60s. Still gives the upstream a generous
  window, but caps the worst-case perceived hang at one minute.
- Show a warning toast via ctx.client.tui.showToast whenever the
  catch block fires, including the underlying error string so users
  can act (retry, manual /compact, or adjust provider).
- Include providerID/modelID in the Compaction failed log entry so
  wild failures are easier to correlate to a specific target model.

Two existing failure-path assertions were updated to match the new
log shape and a new test covers the toast notification contract.

Discord report: https://discord.com/channels/1452487457085063218/1490536332961906829/1491345441399505037
2026-04-08 20:10:25 +09:00
YeonGyu-Kim 041770ff42 fix(#2736): prevent infinite compaction loop by setting cooldown before try
lastCompactionTime was only set on successful compaction. When compaction
failed (rate limit, timeout, etc.), no cooldown was recorded, causing
immediate retries in an infinite loop.

Fix: set lastCompactionTime before the try block so both success and
failure respect the cooldown window.

- test: add failed-compaction cooldown enforcement test
- test: fix timeout retry test to advance past cooldown
2026-03-27 14:25:38 +09:00
YeonGyu-Kim 670d8ab175 fix(#2852): forward model overrides from categories/agent config to subagents
- fix(switcher): use lastIndexOf for multi-slash model IDs (e.g. aws/anthropic/claude-sonnet-4)
- fix(model-resolution): same lastIndexOf fix in doctor parseProviderModel
- fix(call-omo-agent): resolve model from agent config and forward to both
  background and sync executors via DelegatedModelConfig
- fix(subagent-resolver): inherit category model/variant when agent uses
  category reference without explicit model override
- test: add model override forwarding tests for call-omo-agent
- test: add multi-slash model ID test for switcher
2026-03-27 13:59:06 +09:00
MoerAI a3db64b931 fix: address cubic review — SDK compatibility and race condition fixes 2026-03-18 17:42:17 +09:00
MoerAI b8f3186d65 fix(session): detect post-compaction no-text degradation and trigger recovery (fixes #2232) 2026-03-18 16:13:23 +09:00
YeonGyu-Kim 11df83713e refactor(preemptive-compaction): use shared context-limit resolver to eliminate duplicated logic 2026-03-13 12:36:07 +09:00
YeonGyu-Kim 26091b2f48 fix: skip preemptive compaction when model context limit is unknown (#2356) 2026-03-12 01:24:16 +09:00
YeonGyu-Kim 1c2caa09df fix(preemptive-compaction): allow re-compaction after context grows and use model-specific limits
compactedSessions permanently blocked re-compaction after first success,
causing unbounded context growth (e.g. 500k on Kimi K2.5 with 256k limit).

- Clear compactedSessions flag on new message.updated so compaction can
  re-trigger when context exceeds threshold again
- Use modelContextLimitsCache for model-specific context limits instead
  of always falling back to 200k for non-Anthropic providers
2026-03-02 23:07:39 +09:00
YeonGyu-Kim fab820e919 fix(compaction): add timeout and ensure cleanup to prevent indefinite hangs on rate limit
Closes #2062
2026-02-26 20:58:01 +09:00
YeonGyu-Kim 2d069ce4cc feat(preemptive-compaction): apply compaction model override from agent config 2026-02-22 17:19:39 +09:00
YeonGyu-Kim d786691260 fix: read anthropic 1m flag from live model cache state 2026-02-17 10:51:01 +09:00
YeonGyu-Kim b444899153 fix: use model cache context flag for runtime context limits 2026-02-17 10:51:01 +09:00
YeonGyu-Kim d672eb1c12 fix: recognize google-vertex-anthropic as Claude provider (#1700) 2026-02-17 01:28:27 +09:00
YeonGyu-Kim 6a90182503 fix: prevent duplicate compaction race and log preemptive failures 2026-02-16 14:58:59 +09:00
popododo0720 eb56701996 fix: reduce session.messages() calls with event-based caching to prevent memory leaks
- Replace session.messages() fetch in context-window-monitor with message.updated event cache
- Replace session.messages() fetch in preemptive-compaction with message.updated event cache
- Add per-session transcript cache (5min TTL) to avoid full rebuild per tool call
- Remove session.messages() from background-agent polling (use event-based progress)
- Add TTL pruning to todo-continuation-enforcer session state Map
- Add setInterval.unref() to tool-input-cache cleanup timer

Fixes #1222
2026-02-12 11:38:11 +09:00
YeonGyu-Kim 60bbeb7304 fix(compaction): remove hardcoded Claude model from compaction hooks 2026-02-06 18:58:48 +09:00
YeonGyu-Kim 62e1687474 feat: add agent fallback and preemptive-compaction restoration
- Add agent visibility fallback for first-run scenarios
- Restore preemptive-compaction hook
- Update migration and schema for preemptive-compaction restoration
2026-02-02 22:40:59 +09:00