Skip to content

fix(vcs): stop recording expected GitHub and scan outcomes as errors - #2710

Merged
Makisuo merged 2 commits into
mainfrom
triage/vcs-errors
Nov 16, 2026
Merged

Makisuo merged 2 commits into
mainfrom
triage/vcs-errors

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Error triage for the VCS area. Every change stops an expected outcome from being recorded as a server error, or fixes a parser gap behind one.

What changes

  • vendor-http: a 3xx ends its attempt span Ok. GitHub's job log endpoint (/repos/{o}/{r}/actions/jobs/{id}/logs) always answers 302 with the signed download URL, which streamJobLog follows by hand. Each of those attempts was an Error span: about 29k VendorHttpError: github answered 302 in two days, still firing. The call still fails to its caller with the location, so nothing downstream changes. 4xx and 5xx spans still fail.
  • getCommit on a blocked repository (451 DMCA, or 403 "Repository access blocked") now fails as the anticipated VcsRepositoryBlockedError, the same way the listing calls already do. Callers map it through toVcsCommitError already.
  • DependencyScanner
    • A repository that is blocked, gone or whose installation was removed returns a RepositoryUnreachable outcome when the ref lookup fails. The span stays Ok. Before, every scheduled scan of such a repo raised a DependencyScanError, and it never wrote a scan row anyway.
    • A tree too large to list still records its failed scan row with the same message, so the page and the push dedupe stay the same. It now returns TreeTooLarge and no longer fails the scan span.
    • The plan cache stores null for a truncated tree instead of failing inside EdgeCacheService.getOrCompute. That failure was the TreeTruncated error issue. PLAN_VERSION is bumped for the new cache shape.
  • VcsSource{Repository,File,Ref}NotFoundError move to @maple/domain/http with a 404, keeping their tags. When the agent's code tools guess a path, ref or repo that does not exist, the span is now an anticipated outcome, not an error issue. Regenerated anticipated-error-identifiers.ts.
  • lockfiles
    • Strip a leading byte order mark before parsing any format. JSON.parse rejects it.
    • Read bun.lock comments the way Bun does.
    • A yarn.lock parse failure now names the line and the package. It never echoes the range, since a tarball URL can carry a token. The current message does not say which shape failed, so the next occurrence will.
    • PARSER_VERSION is bumped so lockfiles cached as unreadable get parsed again.

Verification

  • bunx vitest run on vendor-http.test.ts, integrations/vcs, dependency-scan: 365 passed. New tests:
    • ends a 3xx attempt's span Ok and still fails the call, while a 4xx span fails
    • fails a commit lookup in a blocked repository as the repository being blocked
    • answers a repository the provider blocks or lost as unreachable, recording no scan
    • the updated tree-too-large tests
  • lib/lockfiles: 120 passed, including the BOM, bun comment and yarn message tests.
  • apps/ai source-code.test.ts and sandbox.test.ts pass. The domain anticipated-errors drift test passes.
  • tsrs --noEmit for backend, domain and lockfiles. oxlint -c .oxlintrc.effect.json on the changed files.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Devin Review

- vendor-http: a 3xx answer ends its attempt span Ok. GitHub's job log
  endpoint always answers 302 to the signed download, which made ~29k error
  spans in two days.
- GithubAppClient.getCommit: a blocked repository (451, or 403 with a block)
  fails as VcsRepositoryBlockedError, like the listing calls.
- DependencyScanner: a blocked, gone or uninstalled repository is a
  RepositoryUnreachable outcome, and a tree too large to list records its
  failed scan row and returns TreeTooLarge, both without failing the span.
  The plan cache holds null for a truncated tree instead of failing inside
  the cache span.
- VcsSource*NotFoundError move to the domain with a 404, so a wrong guess by
  the agent's code tools is an anticipated outcome.
- lockfiles: strip a byte order mark before parsing, read bun.lock comments
  as Bun does, and name the yarn.lock entry a parse failure is about.
@maple-review-bot

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: af5d0592-547c-4d5b-939c-254c816aa5db
Commits

Reviewing files that changed from the base of the PR and between 650c8d2 and 9de7a8b.

Files ignored due to path filters: 1

  • packages/domain/src/generated/anticipated-error-identifiers.ts is excluded by !**/generated/**
Files selected for processing: 12

  • lib/lockfiles/src/internal/decode.ts
  • lib/lockfiles/src/parse.test.ts
  • lib/lockfiles/src/parse.ts
  • lib/lockfiles/src/parsers/bun.ts
  • lib/lockfiles/src/parsers/yarn.ts
  • packages/backend/src/services/dependency-scan/DependencyScanner.test.ts
  • packages/backend/src/services/dependency-scan/DependencyScanner.ts
  • packages/backend/src/services/integrations/vcs/VcsSourceService.ts
  • packages/backend/src/services/integrations/vcs/vendor/github/GithubAppClient.ts
  • packages/backend/src/services/integrations/vcs/vendor/github/__tests__/GithubAppClient.normal-states.test.ts
  • packages/backend/src/services/integrations/vendor-http.test.ts
  • packages/domain/src/http/vcs.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment on lines +627 to +630
if (truncated) {
const failed = yield* store
.failScan({ orgId, scanId: started.id, error: TREE_TOO_LARGE })
.pipe(Effect.mapError(scanError("Could not record the scan")))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Interrupted oversized-tree scans remain running

Cancellation during failScan now leaves an oversized-tree scan running instead of failed. This branch bypasses run and its Effect.onError cleanup. Recovery requires another scan after the abandoned-scan threshold.

Learn more

The truncated-tree result now updates its persisted scan outside the error cleanup surrounding run. Cancelling the fiber while that update waits for database I/O can leave the row created by startScan in running. Previously, truncation failed inside run, so Effect.onError performed the failure update as interruption-protected cleanup. failAbandonedScans repairs the row only when another scan starts after the abandonment threshold.

Example: A manual scan finds a truncated tree and creates its scan row. Cancel its fiber while failScan waits for the database. The row remains running rather than recording the oversized-tree result.

Recommended fix: Protect the truncated-tree settlement against interruption, or move it into a shared lifecycle boundary that guarantees settlement for every row created by startScan. Add a cancellation test that stalls the truncated-tree failure update and verifies the row ends as failed.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@maple-review-bot

maple-review-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 10/10 · safe to merge. Every new outcome is pinned by a test and each caller path checked out; the oversized-tree branch that writes its own failed row is the one path to watch.
no findings · tests covered · risk medium · 2/2 new units observable

Turns expected VCS and scan outcomes (blocked repos, oversized trees, missing source files, BOM/commented lockfiles) from failures into answers, with a test per behaviour. It addresses all five open VcsSource*NotFoundError issues: those tags now carry a 404 and are in the anticipated-identifier list, so code-tool guesses stop filing error issues.

  • DependencyScanner.scan answers RepositoryUnreachable and TreeTooLarge instead of failing
  • The plan cache stores null for a truncated tree, PLAN_VERSION bumped to 2
  • getCommit maps a blocked repository to VcsRepositoryBlockedError
  • VcsSource*NotFoundError move to @maple/domain/http as anticipated 404s

Production impact

Open errors in the changed files (3)
Issue Service Occurrences File
@maple/backend/vcs/VcsSourceFileNotFoundError (3 issues) maple-chat 1.2k packages/backend/src/services/integrations/vcs/VcsSourceService.ts
@maple/backend/vcs/VcsSourceRepositoryNotFoundError maple-chat 132 packages/backend/src/services/integrations/vcs/VcsSourceService.ts
@maple/backend/vcs/VcsSourceRefNotFoundError maple-chat 66 packages/backend/src/services/integrations/vcs/VcsSourceService.ts

After this merges, Maple checks whether they stop.

9de7a8b · What was checked, coverage and telemetry details are on the Maple / review check. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@Makisuo
Makisuo merged commit 7469274 into main Nov 16, 2026
43 checks passed
@Makisuo
Makisuo deleted the triage/vcs-errors branch November 16, 2026 17:04
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.

1 participant