Repository navigation
Effect Service Conventions: 1 issue found
apps/server/src/provider/Layers/ClaudeAdapter.ts:2262— the new snapshot selection referencescontextUsageSnapshot, which is not declared anywhere in the repository, so thecompleteTurnEffect function does not compile;latestAssistantSnapshot(L2233) is left computed but unused. The change also alters backend token-usage reporting behavior without any accompanying test updates.
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.
Verification performed:
git grep contextUsageSnapshotat head7fa074dreturns exactly one hit — the added line 2262 itself. No definition exists incompleteTurn(L2204–2376) or at module scope.- At the merge base, the selection chain started with
latestAssistantSnapshot, which is still computed at L2233 but is now referenced nowhere. - Existing coverage in
apps/server/src/provider/Layers/ClaudeAdapter.test.ts("completes with result usage without querying current context usage" L1794, "preserves compacted usage when completion follows an older assistant frame" L1911, "preserves oversized Claude result totals after task progress snapshots are recorded" L2955) pins the previous precedence; the PR touches no test files, so the behavior change (result.usage no longer usable as active context) is unpinned.
Other convention areas (imports/namespaces, service definition order, dependency acquisition, ManagedRuntime/runPromise boundaries, error modeling, file layout) show no violations in the changed scope — the diff is confined to local snapshot-selection logic inside an existing service module.
🔍 Agent activity — 7 tool calls
💭 I'm looking at the diff in ClaudeAdapter.ts, which modifies token usage snapshot logic rather than an Effect service definition. I want to check the surrounding code to see whether
contextUsageSnapshotis defined there.
1. git_tools — contextUsageSnapshot
2. git_tools — resultIterationSnapshot|latestAssistantSnapshot|resultUsageRecord
💭 I'm confused because contextUsageSnapshot only shows up once in my search, which would mean it's undefined and should cause a compile error—let me check lines 2200-2265 to see if it's actually declared somewhere nearby.
3. browse_code — apps/server/src/provider/Layers/ClaudeAdapter.ts
💭 I notice
contextUsageSnapshotreferenced but undefined, likely meant to belatestAssistantSnapshot, which is now unused, and thecompactedSinceLatestAssistantUsagecheck seems to have been dropped. I'm weighing whether this counts as an Effect service convention violation or just a plain bug outside the check's scope, since the review instructions restrict flagging to concrete violations tied to that convention. I confirm via search that this variable name appears nowhere else in the repo, so it's genuinely undefined — a real compile error introduced in this change, not legacy code. Even though it's not strictly an Effect convention issue, it's a hard break in the changed lines, so I need to decide how the check's default failure behavior should treat it. But it does relate to a real listed convention: backend behavior changes requiring focused tests. This PR alters token usage reporting in ClaudeAdapter with no accompanying tests, so I want to check the merge base and existing test coverage to see if that requirement was already being met or ignored before this change.
4. git_tools — compactedSinceLatestAssistantUsage
5. git_tools — latestAssistantSnapshot
💭 I'm noticing the PR replaces latestAssistantSnapshot with an undefined contextUsageSnapshot, which is a build break — though strictly that falls outside the listed conventions I'm meant to check. Still, this PR changes backend behavior in ClaudeAdapter's usage snapshot selection without adding tests, which does fall under the change discipline requirement, so I'm checking whether existing tests already cover this area.
6. browse_code — Are there existing tests covering ClaudeAdapter completeTurn token usage snapshot selection (result.usage vs lastKnownTokenUsage / latestAssistantUsage)? List test file paths and relevant test names.
💭 This does fall within the check's mandate—an undefined identifier causing a compile break plus a behavior change without corresponding test updates both warrant flagging. I'm leaning toward a single precise inline comment on line 2262 covering both issues. For the fix, I'm considering restoring the fallback chain to use the assistant snapshot before falling back to other values, but I need to check whether that preserves the original precedence—specifically whether the compaction test case (expecting the last known token usage of 40 to win over a stale assistant frame) still passes, since compaction clears that assistant usage value. That case works fine since compaction empties it, letting the fallback take over. I'll post the inline comment with the suggested fix at the right line, noting the indentation, the unused variable, and the lack of test coverage for this behavior change.
7. modify_pr — One blocking finding in apps/server/src/provider/Layers/ClaudeAdapter.ts. The rewritten snapshot selection references an identifier that does not exist anywhere in the module, so the service module will not compile, and the behavior change it encodes is not covered by updated tests.
Agent Credits: 228 credits
Token usage: 22 uncached input · 645,430 cache-read input · 247,153 cache-write input · 12,058 output
Agent Credits may also include non-token charges from external tools such as web research.