Skip to content

fix(runtime-fallback,prompt-gate): recognize all OpenCode progress event shapes and boolean/completed finish markers#4197

Merged
code-yeongyu merged 2 commits into
devfrom
fix/prompt-gate-event-shapes-and-finish-marker
May 20, 2026
Merged

fix(runtime-fallback,prompt-gate): recognize all OpenCode progress event shapes and boolean/completed finish markers#4197
code-yeongyu merged 2 commits into
devfrom
fix/prompt-gate-event-shapes-and-finish-marker

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes two prompt dispatch regressions that can surface as duplicate assistant responses or stuck internal wake/retry dispatches. The runtime fallback watchdog now treats all documented OpenCode streaming part shapes as progress, and the shared prompt gate now treats boolean finish markers plus completed timestamps as terminal assistant turns.

Changes

  • BUG-C: runtime fallback first-prompt watchdog now resolves message event session IDs through the existing event-session-id helper and recognizes nested properties.part.sessionID plus message.part.delta { sessionID, field: "text", delta } progress.
  • BUG-D: prompt gate finish detection now accepts finish === true and treats info.time.completed as terminal so later internal prompts are not blocked indefinitely.
  • Added failing-first regression tests for both event-shape blind spots and both finish-marker blind spots.

Evidence

  • Nested part session evidence: src/hooks/session-notification.test.ts:378-410
  • Delta event evidence: src/hooks/background-notification/hook.test.ts:29
  • Existing session ID resolver precedent: src/shared/event-session-id.ts:16-23
  • Boolean/completed terminal precedent: src/hooks/session-recovery/hook.ts:62-74

Testing

  • bun test src/hooks/runtime-fallback/first-prompt-watchdog.test.ts src/hooks/shared/prompt-async-gate.test.ts ✅ red first: exactly 4 failures before fix, green after fix
  • bun test src/hooks/runtime-fallback/
  • bun test src/hooks/shared/
  • bun test src/hooks/shared/prompt-async-gate.test.ts src/shared/prompt-async-route-audit.test.ts
  • bun test src/hooks/session-recovery/
  • bun test src/features/background-agent/
  • bun test src/features/team-mode/
  • bun run typecheck
  • HOME=/tmp-clean XDG_DATA_HOME=/tmp-clean-data XDG_CACHE_HOME=/tmp-clean-cache bun test
  • bun run build

Note: plain local bun test on this maintainer machine is contaminated by pre-existing user-level ~/.omo/rules state in src/hooks/rules-injector/injector.test.ts; the clean-HOME full suite above matches CI expectations without touching wave-4 test isolation territory.


Summary by cubic

Fixes regressions that caused duplicate assistant responses and stuck internal prompts. The watchdog now recognizes all documented OpenCode progress events, and the prompt gate correctly detects terminal assistant turns.

  • Bug Fixes
    • Runtime fallback watchdog: treats message.part.updated with nested properties.part.sessionID and message.part.delta with text deltas as progress, resetting the silence timer.
    • Prompt gate: considers finish === true and info.time.completed as terminal assistant turns, so internal prompts are not blocked.

Written for commit f8f4b57. Summary will update on new commits. Review in cubic

code-yeongyu and others added 2 commits May 20, 2026 13:12
… finish-marker blind spots (BUG-C+D)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ent shapes and boolean/completed finish markers

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: The user requires 100% certainty of no regressions, which cannot be guaranteed for any logic change even with thorough testing.

Re-trigger cubic

@code-yeongyu code-yeongyu merged commit 4c7d7e8 into dev May 20, 2026
9 of 11 checks passed
@code-yeongyu code-yeongyu deleted the fix/prompt-gate-event-shapes-and-finish-marker branch May 20, 2026 04:19
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