feat: show provider usage limits with /usage-limits - #9875
juliusmarminge merged 18 commits into
Effect Service Conventions: no issues found
All clear
Details
Note
Your check run agent prompt is: .macroscope/check-run-agents/effect-service-conventions.md
More information about how Check Run Agents work can be found in our Help Center.
In-scope changed files (apps//*.ts, packages//*.ts, excluding tests): apps/server/src/ws.ts, apps/mobile/src/connection/runtime.ts, apps/mobile/src/state/server.ts, apps/mobile/src/features/threads/use-composer-command-menu.ts, apps/web/src/connection/runtime.ts, apps/web/src/state/server.ts, packages/client-runtime/src/rpc/session.ts, packages/client-runtime/src/state/server.ts, packages/contracts/src/providerUsageLimits.ts, packages/contracts/src/rpc.ts, packages/shared/src/usageLimits.ts.
Checks performed on changed lines:
- Effect modules are imported as subpath namespaces (
import * as DateTime from "effect/DateTime"in packages/shared/src/usageLimits.ts); no named imports from the bareeffectpackage were added. - New named imports come from whole packages (
@t3tools/contracts) or from a pure-helper module (@t3tools/shared/usageLimits), which the conventions allow. - No new service definitions, tags,
make/layerpairs, or barrel re-export shims were introduced. - apps/server/src/ws.ts acquires
usageLimitSourcesandproviderRegistryfrom the environment viayield*inside the layer;loadServerConfigwas changed from a value to a function of a plain boolean option, which is configuration rather than service injection. NoManagedRuntime.make/runPromisewas added in domain or service code. - No new error classes,
Schema.iswrappers,catchTag/catchIfusage, or error-construction helpers were added. - No new lint/type-checker suppression directives were added.
- Backend behavior change in ws.ts is covered by focused tests in apps/server/src/server.test.ts and packages/shared/src/usageLimits.test.ts (test files are out of scope for findings but were used as context).
🔍 Agent activity — 3 tool calls
💭 I'm scanning through the modified TypeScript files across the server, shared packages, contracts, client-runtime, mobile, and web apps to understand the scope of changes. I notice .tsx files aren't matched by the include patterns since they only target .ts extensions, so those stay out of scope for this review. Now I'm checking the Effect library conventions on the changed lines—the usageLimits.ts file correctly uses a namespace subpath import for DateTime, and ws.ts adds a clean import from the shared usageLimits helpers. I want to verify how usageLimitSources.current is being accessed within loadServerConfig, so I'm going to look more closely at that section of ws.ts.
1. browse_code — In apps/server/src/ws.ts, how is usageLimitSources obtained inside makeWsRpcLayer? Show the function signature of makeWsRpcLayer and how services like providerRegistry, keybindings, usageLimitSources are acquired (parameters vs yield* from environment). Also show the import block at the top of ws.ts.
2. browse_code — packages/shared/src/usageLimits.ts
💭 Everything else in scope checks out fine - the contracts, session, and hook changes are just straightforward passthroughs, and the usageLimits code doesn't introduce anything problematic. I'm now verifying the imports and moving on to check the server ws directory. The ws.ts diff adds a named import of pure helpers from the shared usageLimits module at the top, which is fine, and no lint-disable directives were added. Test coverage exists for the backend changes in both server and shared test files, and the loadServerConfig change from a value to a function is fine too, so I'll take a quick look at the client-runtime state/server.ts changes for convention adherence.
3. browse_code — packages/client-runtime/src/state/server.ts
💭 Everything checks out against existing patterns, including the session.ts change and the connection/runtime.ts layer options for mobile and web—no Effect service convention violations found. I need to figure out how to fit "All clear" into the required structured output format with title and summary fields.
Agent Credits: 0 credits
This check reused a previous run's cached results, so there was no new model usage to bill. Re-run the check to force a fresh review.