Skip to content

Conversation

@stevenvo
Copy link
Contributor

Summary

Fixes build errors introduced in #2709 by correcting the StreamCancelFn type definition.

Build Errors

pkg/wshrpc/wshclient/wshclientutil.go:66:24: cannot use func(ctx context.Context) error 
as func() value in assignment

pkg/web/web.go:255:59: cannot use rpcOpts.StreamCancelFn (variable of type func()) 
as func(context.Context) error value in argument

Root Cause

StreamCancelFn was defined as func() in wshrpctypes.go:376, but is actually used throughout the codebase as func(context.Context) error:

  • In web.go:276: streamCancelFn(ctx) - called with context parameter
  • In wshclientutil.go:67: Returns error from reqHandler.SendCancel(ctx)

Fix

Correct the type definition to match actual usage:

// Before:
StreamCancelFn func() `json:"-"`

// After:
StreamCancelFn func(context.Context) error `json:"-"`

Files Changed

  • pkg/wshrpc/wshrpctypes.go - Corrected type definition

Testing

Build now succeeds without type errors.

Related

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 25, 2025

Warning

Rate limit exceeded

@stevenvo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 90011a7 and 10f740d.

📒 Files selected for processing (1)
  • pkg/wshrpc/wshrpctypes.go

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

StreamCancelFn was incorrectly defined as func() but is actually used as func(context.Context) error throughout the codebase.

Evidence of actual usage:

- web.go:276: streamCancelFn(ctx) - called with context

- wshclientutil.go:67: return reqHandler.SendCancel(ctx) - returns error

This caused build failures:

- wshclientutil.go:66: cannot use func(ctx context.Context) error as func() value

- web.go:255: cannot use func() as func(context.Context) error value

Fix: Correct the type definition in wshrpctypes.go:376

Fixes wavetermdev#2709
@stevenvo stevenvo force-pushed the fix/rpc-stream-cancel-type-mismatch branch from d8f3b32 to 10f740d Compare December 25, 2025 17:00
stevenvo added a commit to stevenvo/waveterm that referenced this pull request Dec 26, 2025
Fixes issue where TUI applications (vim, htop, opencode, etc.) would lose terminal state when switching between workspaces. This caused inability to scroll and display corruption.

Root cause: Workspace switching was destroying all tab views including terminals, then recreating them from cache. This destroyed xterm.js instances and lost their state.

Solution: Cache tab views across workspace switches instead of destroying them. Tab views are positioned off-screen but kept alive, preserving:

- Terminal buffer state (normal and alternate screen modes)

- Scrollback history and scrolling capability

- Running processes and their output

- Cursor position and all terminal modes

Memory management: Cached views kept alive until tab closed or window closed.

Note: This PR includes the StreamCancelFn type fix from wavetermdev#2716 to ensure the branch builds correctly.
stevenvo added a commit to stevenvo/waveterm that referenced this pull request Dec 26, 2025
Fixes issue where TUI applications (vim, htop, opencode, etc.) would lose terminal state when switching between workspaces. This caused inability to scroll and display corruption.

Root cause: Workspace switching was destroying all tab views including terminals, then recreating them from cache. This destroyed xterm.js instances and lost their state.

Solution: Cache tab views across workspace switches instead of destroying them. Tab views are positioned off-screen but kept alive, preserving:

- Terminal buffer state (normal and alternate screen modes)

- Scrollback history and scrolling capability

- Running processes and their output

- Cursor position and all terminal modes

Memory management: Cached views kept alive until tab closed or window closed.

Note: This PR includes the StreamCancelFn type fix from wavetermdev#2716 to ensure the branch builds correctly.
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