Skip to content

fix(devin): correct token usage and generate protobuf bindings - #184

Merged
caigee-cmd merged 2 commits into
caigee-cmd:mainfrom
AtkinsChang:fix/devin/token-proto
Sep 17, 2026
Merged

caigee-cmd merged 2 commits into
caigee-cmd:mainfrom
AtkinsChang:fix/devin/token-proto

Conversation

@AtkinsChang

Copy link
Copy Markdown
Contributor

Summary

  • Include cache reads and writes in token usage for streaming and non-streaming responses.
  • Replace handwritten protobuf encoding/decoding with generated bindings for chat and account status.
  • Add a manual download → descriptor extraction → Go generation command. Builds and CI use committed bindings.
  • Preserve tool-call identity when aggregating streamed deltas.

Extracted descriptors are not an official proto source distribution.

Validation

  • Go tests, vet, and server build passed.
  • Verified generation against release 3.10.31.
  • No live upstream validation.

Devin reported cache reads and writes separately from its input tokens, so
non-stream results understated context consumption and stream callers could
not observe the cache accounting.

Carry both cache fields through the provider and executor, include them in the
OpenAI-compatible stream usage, and add them to the upstream input total. This
keeps cache reads available as cached prompt-token detail while making prompt
and total token counts represent all upstream input work.
The hand-maintained wire subset duplicated Devin's evolving schema and could
misrepresent field types, presence, and tool-call identity.

Provide a manual command that downloads a stable release, extracts its
embedded descriptors, selects the required message dependencies, and generates
Go bindings with pinned protobuf tools. Record the source version and checksums
in the bindings and keep intermediate downloads and descriptors temporary.
Builds and CI consume committed Go files without running the update pipeline.

Keep Connect framing and public API translation inside the existing adapter.
Use the standard Google Timestamp package and associate tool deltas by their
actual IDs, with anonymous interleaving limited by the upstream contract.

The extracted schema is not an official proto source distribution and
does not establish that every CLI release uses an identical schema.
@caigee-cmd
caigee-cmd merged commit a95f29f into caigee-cmd:main Sep 17, 2026
6 checks passed
@AtkinsChang
AtkinsChang deleted the fix/devin/token-proto branch September 17, 2026 08:44
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.

2 participants