Skip to content

fix(opencode): polish CAS insights UX, timeouts, and auth messaging - #12

Merged
Alter-Igor merged 1 commit into
devfrom
cas-insights-polish
Aug 2, 2026
Merged

fix(opencode): polish CAS insights UX, timeouts, and auth messaging#12
Alter-Igor merged 1 commit into
devfrom
cas-insights-polish

Conversation

@Alter-Igor

@Alter-Igor Alter-Igor commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

P0/P1 polish after post-merge review of CAS/Synapse insights (PR #11).

Fixes

  • Auth UX: shared notConnectedMessage() (OAuth-first); oauth-expired source; older tools no longer claim CAS_MCP_TOKEN-only
  • Timeouts: fetchWithTimeout on MCP (20s), REST (20s), health (5s), probe (15s)
  • Trace UX: formatted cas_safe_run_trace is no longer untrusted-fenced (our formatter, not agent prose)
  • Degraded prompt: still offers cas_pipeline_status + synapse_probe without CAS OAuth
  • Probe cost: cost note; live=false free health; do not use SYNAPSE_MCP_BEARER_TOKEN for chat
  • get_run: insights summary + tip toward cas_safe_run_insights

Testing (observed)

bun test test/plugin/cas-bridge/cas-bridge-routing.test.ts — formatter/routing/polish cases pass (23 explicit pass). One unnamed hang after suite is a pre-existing package resolve noise (zod via tool registry), not this diff.

Sibling safety

Worked only in worktree opencode---cas-insights-polish. Did not touch primary dirty package.json/bun.lock or sibling fix-slow-startup.

Deploy

Fork-local .opencode/ only — merge to dev + restart OpenCode. No Coolify/ACA.

Summary by CodeRabbit

  • New Features

    • Added a free Synapse health-check mode that reports service status without making a paid request.
    • Clarified CAS and Synapse authentication states, including expired credentials and available OAuth options.
    • Added clearer guidance for accessing pipeline status and probing services without CAS OAuth.
    • Added cost notices for live Synapse probes.
  • Bug Fixes

    • Added bounded request timeouts to improve reliability.
    • Improved run details and trace output formatting.
    • Enhanced error handling to prevent credentials from appearing in returned messages.

P0/P1 follow-up after insights review:
- OAuth-first notConnectedMessage; oauth-expired auth source
- fetchWithTimeout on MCP/REST/health/probe calls
- Do not untrusted-fence formatted run-trace summaries
- Degraded routing prompt still offers pipeline_status + synapse_probe
- synapse_probe cost note, live=false free health, no MCP-bearer for chat
- cas_safe_get_run prefers insights summary and points to cas_safe_run_insights

Tests: cas-bridge unit suite (formatter + routing + polish cases).
Sibling worktrees untouched (fix-slow-startup left intact).
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bfe4b32e-e573-4ce4-b411-b84d9f388e7d

📥 Commits

Reviewing files that changed from the base of the PR and between 650565e and b6d3981.

📒 Files selected for processing (15)
  • .opencode/plugin/cas-bridge-routing.ts
  • .opencode/tool/cas-auth-status.ts
  • .opencode/tool/cas-bridge-lib.ts
  • .opencode/tool/cas-pipeline-status.ts
  • .opencode/tool/cas-safe-cancel-run.ts
  • .opencode/tool/cas-safe-delegate.ts
  • .opencode/tool/cas-safe-get-run.ts
  • .opencode/tool/cas-safe-list-agents.ts
  • .opencode/tool/cas-safe-list-runs.ts
  • .opencode/tool/cas-safe-run-insights.ts
  • .opencode/tool/cas-safe-run-trace.ts
  • .opencode/tool/cas-select-agent.ts
  • .opencode/tool/synapse-probe.ts
  • docs/implementation/current/FEAT-CAS-OPENCODE-BRIDGE/status.md
  • packages/opencode/test/plugin/cas-bridge/cas-bridge-routing.test.ts

📝 Walkthrough

Walkthrough

The CAS bridge now distinguishes authentication states, applies timeouts to outbound requests, standardizes tool error handling, and supports free Synapse health checks. Routing prompts, tool descriptions, tests, and implementation status documentation reflect these changes.

Changes

CAS bridge authentication and probing

Layer / File(s) Summary
Authentication and bounded transport
.opencode/tool/cas-bridge-lib.ts, .opencode/tool/cas-auth-status.ts, .opencode/tool/cas-pipeline-status.ts
CAS authentication now reports active, expired, environment, or missing credentials. MCP, REST, health, and probe requests use configured timeouts. Synapse MCP bearer tokens are excluded from inference-key detection.
Standardized CAS tool responses
.opencode/tool/cas-safe-*.ts
CAS tools use shared connection messages and secret redaction. Run retrieval returns formatted insights with wrapped raw JSON. Trace output is returned directly.
Synapse health and live probing
.opencode/tool/synapse-probe.ts, packages/opencode/test/plugin/cas-bridge/cas-bridge-routing.test.ts
synapse_probe supports free health-only checks with live=false. Live probes remain paid and report inference credential requirements.
Routing guidance and validation
.opencode/plugin/cas-bridge-routing.ts, packages/opencode/test/plugin/cas-bridge/cas-bridge-routing.test.ts, docs/implementation/current/FEAT-CAS-OPENCODE-BRIDGE/status.md
Degraded routing guidance lists pipeline health and Synapse probing. Tests cover authentication messaging, key sources, probe output, and invalid run payloads. Documentation records the updates.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant synapse_probe
  participant SynapseHealth
  participant SynapseChat
  Caller->>synapse_probe: invoke with live=false
  synapse_probe->>SynapseHealth: fetch health metadata
  SynapseHealth-->>synapse_probe: return status and endpoint metadata
  Caller->>synapse_probe: invoke with live=true
  synapse_probe->>SynapseChat: submit bounded chat probe
  SynapseChat-->>synapse_probe: return probe response and cost notice
Loading

Possibly related PRs

✨ 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 cas-insights-polish

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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

@Alter-Igor
Alter-Igor merged commit 735674e into dev Aug 2, 2026
3 of 11 checks passed
@Alter-Igor
Alter-Igor deleted the cas-insights-polish branch August 2, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant