Skip to content

fix: brain never reaches 'ready' status + console.warn → app.log#150

Merged
four-bytes-robby merged 1 commit into
mainfrom
fix/149-brain-ready-status
Jun 15, 2026
Merged

fix: brain never reaches 'ready' status + console.warn → app.log#150
four-bytes-robby merged 1 commit into
mainfrom
fix/149-brain-ready-status

Conversation

@four-bytes-robby

@four-bytes-robby four-bytes-robby commented Jun 15, 2026

Copy link
Copy Markdown
Member

Closes #149

Changes

1. src/status.ts — Replace console.warn with app.log

  • getBus(): console.warn_client?.app?.log(...) for BusClient connect failures
  • write(): console.warn_client?.app?.log(...) for bus publish failures

2. src/four-opencode-brain.ts — Always call updateStatus("ready") at init end

  • Removed the if (!autoIngest) guard so the plugin always reaches "ready" status
  • Auto-ingest runs in background and handles its own busyready transitions

3. src/status.ts — Test helpers + _sessionId fallback

  • Added resetBusConnection() and setProjectIdForTest() exports for test isolation
  • write() now falls back to _sessionId when no ALS context exists

4. package.json — Patch bump 1.7.6 → 1.7.7

Verification

  • bun run build succeeds
  • bun test — 254 pass, 0 fail

Summary by cubic

Ensures the brain reaches "ready" after init (fixes #149) and routes warnings through app logging. Also hardens status publish logic and adds small test helpers.

  • Bug Fixes

    • Always call updateStatus("ready") after init; auto-ingest manages its own busy/ready.
    • Replace console.warn with app.log for BusClient connect and publish failures.
    • write() falls back to _sessionId when no ALS context is present.
    • Add resetBusConnection() and setProjectIdForTest() for test isolation.
  • Dependencies

    • Patch bump to 1.7.7.

Written for commit 8e0f0ef. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Chores

    • Updated package version to 1.7.7.
  • Bug Fixes

    • Ensured the plugin’s ready status is reported immediately after startup completes, even when auto-ingest is enabled.
    • Improved bus-related failure handling by switching from generic warnings to the app logger, providing clearer diagnostics for connection and status publish issues.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

Recent review info
Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae91ecb9-21b1-4106-861f-10678d78247f

Commits

Reviewing files that changed from the base of the PR and between 4067a9f and 8e0f0ef.

Files selected for processing (3)
  • package.json
  • src/four-opencode-brain.ts
  • src/status.ts
✅ Files skipped from review due to trivial changes (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/four-opencode-brain.ts

Walkthrough

Walkthrough

The plugin's startup sequence is fixed so updateStatus("ready") is always called after initialization, regardless of the autoIngest flag. Bus error logging in status.ts switches from console.warn to the plugin client logger. The package version is bumped to 1.7.7.

Changes

Status and bus logging fixes

Layer / File(s) Summary
Unconditional ready status on init
src/four-opencode-brain.ts
Removes the !autoIngest condition guarding updateStatus("ready"), so the plugin always transitions to ready after init; auto-ingest independently cycles through busy and ready on its own.
Bus logging via plugin client logger
src/status.ts
Replaces console.warn with _client?.app?.log(...) in getBus() connect-failure and write() publish-failure error handlers.

Package version bump

Layer / File(s) Summary
Version 1.7.7
package.json
Version field bumped from 1.7.6 to 1.7.7.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: fixing the brain's 'ready' status and replacing console.warn with app.log logging.
Description check ✅ Passed The description covers the four changes (status.ts logging, four-opencode-brain.ts ready status, test helpers, version bump) with verification details, matching the template requirements.
Linked Issues check ✅ Passed The PR successfully implements all fixes required by issue #149: unconditionally calling updateStatus('ready') [four-opencode-brain.ts] and replacing both console.warn calls with app.log [status.ts lines 53 and 113].
Out of Scope Changes check ✅ Passed All changes are in-scope with issue #149: logging replacement, status initialization fix, test helpers for isolation, and version bump. No unrelated modifications detected.

Tip: You can configure your own custom pre-merge checks in the settings.

Finishing Touches
Generate docstrings
  • Create stacked PR
  • Commit on current branch
Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/149-brain-ready-status
Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/149-brain-ready-status

Comment @coderabbitai help to get the list of available commands and usage tips.

@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 3 files

Re-trigger cubic

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.

fix: brain never reaches 'ready' status + console.warn → app.log

1 participant