Skip to content

Conversation

sjf
Copy link
Contributor

@sjf sjf commented Jul 26, 2025

Javascript cannot represent the full range of int64. So, when the protos are deserialized from JSON the int64's are converted to strings for safety. However, typescript code is expecting a number and not a string, and this is causing problems.

This was not noticed before now because in the Vscode ProtoBus and HostBridge, the proto messages are not serialized and deserialized, they are just passed around as JS objects.

However, in the external HostBridge the protos are serialized when they are sent through the ProtoBus. When the response messages contain an int64, it is deserialized to a string instead of a number for safety. This is causing parts of Cline to fail, e.g. the task history view won't load because Task.getTotalTasksSize() returns a string when the caller is expecting a number.

Update the proto code generation scripts so they are all run from the main build-proto.mjs script.

Don't show the full warning output unless the script is run with -v because there are currently too many warnings.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • ♻️ Refactor Changes
  • 💅 Cosmetic Changes
  • 📚 Documentation update
  • 🏃 Workflow Changes

Pre-flight Checklist

  • Changes are limited to a single feature, bugfix or chore (split larger changes into separate PRs)
  • Tests are passing (npm test) and code is formatted and linted (npm run format && npm run lint)
  • I have created a changeset using npm run changeset (required for user-facing changes)
  • I have reviewed contributor guidelines

Screenshots

Additional Notes


Important

Adds int64 type check in proto scripts, consolidates script execution, and modifies warning verbosity.

  • Behavior:
    • Adds checkProtos() in build-proto.mjs to warn about int64 types in proto files, logging warnings for fields using 64-bit integers.
    • Updates build-proto.mjs to run generate-protobus-setup.mjs and generate-host-bridge-client.mjs from main().
    • Limits warning verbosity unless -v flag is used.
  • Scripts:
    • Exports main() in generate-host-bridge-client.mjs and generate-protobus-setup.mjs for external invocation.
    • Modifies package.json to run all proto scripts from build-proto.mjs.
  • Misc:
    • Adds loadProtoDescriptorSet() in proto-utils.mjs for loading proto descriptor sets.

This description was created by Ellipsis for a04beca. You can customize this summary. It will automatically update as commits are pushed.

Copy link

changeset-bot bot commented Jul 26, 2025

⚠️ No Changeset found

Latest commit: a04beca

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Jul 26, 2025

Coverage Report

Extension Coverage

Base branch: 46%

PR branch: 47%

✅ Coverage increased or remained the same

Webview Coverage

Base branch: 17%

PR branch: 17%

✅ Coverage increased or remained the same

Overall Assessment

Test coverage has been maintained or improved

Last updated: 2025-07-28T02:02:12.479181

@sjf sjf requested review from canvrno and removed request for dcbartlett, ocasta181, saoudrizwan, saito-sv, pashpashpash and NightTrek July 26, 2025 06:36
sjf and others added 7 commits July 27, 2025 21:26
Javascript cannot represent the full range of int64. So, when the protos are deserialized from JSON int64's are converted to strings. The typescript code is expecting a number and not a string, and this causes errors.

This was noticed before now because in the vscode protobus and hostbridge, the proto messages are not serialized and deserialized, they are just passed around as JS objects.

However, in IntelliJ the protos are serialized when they are sent through the ProtoBus. When the response messages contains and int64, it is deserialized to a string instead of a number for safety. This is causes parts of Cline to fail in IntelliJ, e.g. the task history view won't load because `Task.getTotalTasksSize()` returns a string when it is expecting a number.
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@sjf sjf force-pushed the sjf-jl26-asdf branch from 6c46d52 to db83625 Compare July 28, 2025 01:26
@sjf sjf requested a review from canvrno July 28, 2025 01:27
@sjf sjf merged commit 56e388c into main Jul 28, 2025
13 checks passed
@sjf sjf deleted the sjf-jl26-asdf branch July 28, 2025 02:02
sjf added a commit that referenced this pull request Jul 28, 2025
…t32.

As described [here](#5174), int64 cannot be deserialized directly into numbers in Typescript.

Switch these timeout and line limit fields to int32 because the range of values should fit in int32.

Replace the Int64Request and response in the RPC `updateTerminalConnectionTimeout` with request and response messages for this RPC. It is the best practise to have unique request/response messages for each RPC because it means you can update the request or response easily because the messages are not shared with other RPCs. The fields can also have self-documenting names instead of the generic `value` field name.
sjf added a commit that referenced this pull request Jul 28, 2025
…t32.

As described [here](#5174), int64 cannot be deserialized directly into numbers in Typescript.

Switch these timeout and line limit fields to int32 because the range of values should fit in int32.

Replace the Int64Request and response in the RPC `updateTerminalConnectionTimeout` with request and response messages for this RPC. It is the best practise to have unique request/response messages for each RPC because it means you can update the request or response easily because the messages are not shared with other RPCs. The fields can also have self-documenting names instead of the generic `value` field name.
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.

3 participants