Skip to content

feat(usage): count Devin history from its local sessions database - #29631

Closed
piotrnowakowski wants to merge 3 commits into
pingdotgg:mainfrom
piotrnowakowski:feat/devin-usage-history
Closed

piotrnowakowski wants to merge 3 commits into
pingdotgg:mainfrom
piotrnowakowski:feat/devin-usage-history

Conversation

@piotrnowakowski

@piotrnowakowski piotrnowakowski commented Nov 2, 2026 •

Copy link
Copy Markdown

Devin sessions now show up on the Usage page alongside the other providers.

  • New devin usage source on the ACP Registry driver. For each registry Devin instance, it reads the Devin CLI's sessions.db read-only ($DEVIN_SESSIONS_DIR, else $XDG_DATA_HOME/devin/cli). Other ACP agents and local commands are skipped.
  • Each inference counts once: Devin stores one request on several message nodes with identical metrics, so records dedupe by request_id.
  • claude-opus-5-5-high-fast is priced as claude-opus-5-5 at the fast tier. Devin bills in ACUs, so cost is the API-rate estimate.
  • Web and mobile presentation, plus docs/user/usage.md.

Proposed in Ideas discussion #27535, which has no maintainer approval yet. Limits stay out of scope; #26381 covers them.

Validation: the new devinUsage.test.ts covers dedupe, the time window, model mapping, a missing database, and instance filtering. vp run check:changed passes. On a copy of a real Devin 3000.11.234 database, 80 assistant nodes became 40 records ($2.79 estimate). The screenshots below are from vp run dev with the same home data, on main and on this branch.

Not checked: macOS and Windows paths, and Devin's newer files-based session store, which this build can migrate to.

Before After
Usage on main without Devin Usage with Devin listed

Written by Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

Devin runs through the ACP Registry driver, which had no usage reader, so
Devin turns never appeared in Usage. Read the Devin CLI's sessions.db,
dedupe inferences stored on several message nodes by request id, and price
the base model with Devin's effort and fast-mode suffixes stripped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Nov 2, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — Devin history is automatically included in Usage when its local database exists, changing displayed totals and adding API-rate cost estimates rather than actual ACU charges. Human review is needed to confirm this default inclusion and cost presentation.

You can add or adjust custom eligibility rules. Learn more.

@piotrnowakowski

Copy link
Copy Markdown
Author

Both points follow how the other usage sources already work, and the maintainer decision is open in #27535:

  • Included by default. Claude Code, Codex, Pi and OpenCode history is read from local stores whenever they exist, whether or not T3 started the session. Devin's sessions.db works the same way, and the reader opens it read-only.
  • API-rate estimate. The Usage page already labels totals "API estimate" and says they are not your subscription bill. Devin's ACU charges aren't stored locally, so reportedCostUsd stays null and shared pricing estimates the cost, as it does for subscription-billed Claude and Codex usage.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between a15bccf and f6175b1.

Files selected for processing: 1
  • packages/provider-acp-registry/src/server/devinUsage.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Walkthrough

The change adds a Devin usage reader for CLI session databases, registers it with the ACP registry driver, and adds Devin to usage contracts, provider presentation, and documentation.

Changes: Devin usage history

Layer / File(s) Summary
Read Devin usage from session databases
packages/provider-acp-registry/src/server/devinUsage.ts, packages/provider-acp-registry/src/server/devinUsage.test.ts
The reader resolves session directories, parses assistant-message metadata, filters and deduplicates records, and reports missing databases or read errors. Tests cover parsed records, duplicate request IDs, time-window filtering, missing databases, and registry-instance selection.
Connect the reader to the provider
packages/contracts/src/usage.ts, packages/provider-acp-registry/src/server/driver.ts, apps/server/src/provider/builtInDrivers.ts
The usage contract accepts devin. The ACP registry driver provides the Devin reader and declares its environment requirements. The built-in driver list includes the ACP registry driver.
Present and document Devin usage
apps/mobile/src/features/usage/usageProviders.ts, apps/web/src/components/usage/usageProviders.ts, apps/web/src/components/usage/UsageProviderChart.test.ts, docs/user/usage.md
Mobile and web usage-provider configuration includes Devin. The chart test expects a Devin band. The documentation describes Devin’s session database, directory override, estimated costs, and filter value. It also lists Muse Code as a usage history source.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant devinUsageReader
  participant FileSystem
  participant sessionsDb as sessions.db
  devinUsageReader->>FileSystem: Resolve and check database path
  devinUsageReader->>sessionsDb: Query assistant messages
  sessionsDb-->>devinUsageReader: Return message rows
  devinUsageReader->>devinUsageReader: Parse and deduplicate usage records
Loading

Possibly related issues

  • pingdotgg/t3code#20246: This change deduplicates Devin records by request ID, which may intersect with the issue’s concern about undercounting from deduplication, although the issue describes a different provider and identical-metric records.

Suggested reviewers: maria-rcks

Merge Risk: Minimal · up to f6175

The prior cross-platform test risk is fixed, and no confirmed merge-blocking issue remains.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description explains the implementation, validation, screenshots, and known limitations, but it does not follow the required section structure. It also states that the linked Ideas discussion has … Organize the description under Problem, Change, Scope and approval, and Verification headings. Add the problem and expected behavior, provide maintainer approval or explain why this focused change qualifies without prior approval, and retai…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: counting Devin usage history from its local sessions database.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the implementation, validation, screenshots, and known limitations, but it does not follow the required section structure. It also states that the linked Ideas discussion has no maintainer approval and does not provide an approval exemption.

Resolution

Organize the description under Problem, Change, Scope and approval, and Verification headings. Add the problem and expected behavior, provide maintainer approval or explain why this focused change qualifies without prior approval, and retain the focused validation results and unchecked platform details.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

The ACP Registry driver serves every ACP agent, so a Kimi-only setup also
scanned Devin's sessions.db. Skip instances that are not the registry's
devin agent, and add Devin's band to the provider chart test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vxirau

vxirau commented Nov 3, 2026

Copy link
Copy Markdown

Nice, this pairs well with realhasanshoaib#1 (stacked on #26381), which fills the Limits side with Devin's daily and weekly allowance from the CLI's GetUserStatus. With both, Devin gets Cost, Tokens and Limits like the other providers. They both touch the AcpRegistryDriverEnv line in driver.ts, so whichever lands second needs a one-line rebase.

Copy link
Copy Markdown
Member

Thanks @piotrnowakowski for the earlier Devin history work and tests. Closing this in favor of #30248 by @screen-gd, which also reads and deduplicates Devin session history and has newer work and broader verification. This branch has not been updated since November 2, and main has changed the affected files since then. The DEVIN_SESSIONS_DIR override here is worth considering separately if still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants