feat(integrations): bound repository transport for harness reads - #5710
Open
iscekic wants to merge 1 commit into
Open
feat(integrations): bound repository transport for harness reads#5710iscekic wants to merge 1 commit into
iscekic wants to merge 1 commit into
Conversation
This was referenced Aug 29, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryOpt-in bounded repository transport (GitHub, GitLab, Bitbucket) preserves legacy unbounded callers; abort, size, pagination, and schema limits look correct. Files Reviewed (8 files)
Reviewed by grok-4.6 · Input: 194.5K · Output: 22K · Cached: 236.7K Review guidance: REVIEW.md from base branch |
This was referenced Aug 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No new behavior — existing repository lists do not use the new limits.
Summary
RepositoryReadOptionsintroduces opt-inboundedand callersignal;REPOSITORY_READ_LIMITSdefines two pages, 50 repositories, one mebibyte (MiB) per response, and 30 seconds.withRepositoryReadDeadlinecombines cancellation with one deadline;repositoryPageSchema,boundRepositoryResponse, andboundedRepositoryFetchcheck array limits before expansion and byte limits before parsing.Only
bounded: trueactivates these controls; omitted options preserve legacy behavior, and callers must not replace a complete shared cache with incomplete bounded results.Files
apps/web/src/lib/integrations/core/repository-read-limits.ts— source, added; 102 changed lines. Checks successful JavaScript Object Notation (JSON) content types, declared and streamed bytes, and text encoding; cancels failed reads and refuses redirects.apps/web/src/lib/integrations/core/repository-read-limits.test.ts— test, added; 77 changed lines. Covers exact-byte acceptance, oversized or invalid responses, stream cancellation, deadlines, and caller cancellation.fetchGitLabProjectsacceptsRepositoryReadOptionsand caps reads at two fetched pages and 50 active projects, counting archived-only pages and pagination jumps.The 1 MiB response cap and one 30-second deadline cover public, self-hosted, and redirected requests.
Existing address checks, address binding, redirect limits, credential stripping, output fields, and omitted-option pagination remain unchanged; malformed bounded pages throw.
Files
apps/web/src/lib/integrations/platforms/gitlab/adapter.ts— source, modified; 158 changed lines. Propagates bounds through safe transports, narrows active-project inputs, retains deletion filtering, and selects results before mapping.apps/web/src/lib/integrations/platforms/gitlab/adapter.test.ts— test, modified; 115 changed lines. Adds isolated mocks and coverage for archived-only pages, pagination jumps, response limits, safe redirects, and a shared deadline.fetchGitHubRepositoriesacceptsRepositoryReadOptions, limits reads to two pages and 50 unarchived repositories, and validates bounded pages before mapping results.generateGitHubInstallationTokenaccepts an optional Octokitrequest, letting authentication and repository requests share the byte cap, deadline, and caller cancellation.Standard/lite selection, token authentication, returned fields, and omitted-option pagination stay unchanged; bounded results do not guarantee a complete list.
Files
apps/web/src/lib/integrations/platforms/github/adapter.ts— source, modified; 90 changed lines. Passes the bounded transport through installation authentication, rejects malformed pages, and preserves archived filtering and the creation-time fallback.apps/web/src/lib/integrations/platforms/github/adapter.repositories.test.ts— test, added; 130 changed lines. Uses installed Octokit with provider doubles to cover authentication, legacy pagination, malformed data, archived-only pages, provider errors, and authentication deadlines.fetchBitbucketRepositoriesFromTokenServiceandfetchBitbucketWorkspaceAccessTokenRepositoriesFromTokenServiceacceptRepositoryReadOptions, enforce the response-byte cap before parsing, and return at most 50 repositories in bounded mode.BitbucketRepositoryListResult, authentication, and service pagination stay unchanged; validation still checks every item, including items beyond the returned limit.Bounded network, body, and schema failures throw; non-success responses still return
temporarily_unavailable, and omitted options retain legacy results and fallbacks.Files
apps/web/src/lib/integrations/platforms/bitbucket/token-service-client.ts— source, modified; 85 changed lines. Applies shared bounds, deadlines, cancellation, and redirect rejection; forwards workspace access-token options and retains explicit provider states.apps/web/src/lib/integrations/platforms/bitbucket/token-service-client.test.ts— test, modified; 124 changed lines. Covers both entry points, truncation, provider states, malformed trailing items, oversized bodies, network failures, stalled streams, and legacy fallbacks.Tests: 4 files changed —
repository-read-limits.test.tsand GitHubadapter.repositories.test.tsadded; GitLabadapter.test.tsand Bitbuckettoken-service-client.test.tsmodified.Generated: 0 files changed.
Verification
The handoff reports no manual or live-provider verification for this level.
Runtime verification remains pending at the stack tip. This level adds opt-in transports without activating harness consumers.
Visual Changes
Visual Changes: N/A
Reviewer Notes
shared-agent-harness-3bb0-s16andshared-agent-harness-3bb0-s17; this change adds no authorized procedure or harness consumer.Kilo-Org/cloud; worktree:/Users/igor/Projects/.worktrees/shared-agent-harness-3bb0.git diff --check.Human steps
Stacked PRs — merge bottom to top. Each level shows only its own diff.
Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Every level keeps its own checks, its own bot review, and its own threads; each one is answered on its own PR.
Each level is its own deliverable: it builds and passes its own checks alone.
A finding on a level is repaired on that level, then carried upward with stack.sh forward.
shared-agent-harness-3bb0— chore(agent-harness): register workspaces and enforce CI boundaries #5632shared-agent-harness-3bb0-s2— feat(agent-harness): define portable domain and snapshots #5637shared-agent-harness-3bb0-s3— feat(agent-harness): define commands tools and permission policy #5639shared-agent-harness-3bb0-s4— feat(agent-harness): share client state and cursor recovery #5643shared-agent-harness-3bb0-s5— feat(agent-harness): persist command intents and execution receipts #5647shared-agent-harness-3bb0-s6— feat(db): add harness ingress grants and retirement fences #5655shared-agent-harness-3bb0-s7— feat(agent-harness): deliver legacy history and project durable text #5659shared-agent-harness-3bb0-s8— feat(agent-harness): authorize durable grants and registered clients #5662shared-agent-harness-3bb0-s9— feat(agent-harness): fence retirement and retry payload cleanup #5667shared-agent-harness-3bb0-s10— feat(agent-harness): persist authoritative state in SQLite #5675shared-agent-harness-3bb0-s11— feat(agent-harness): admit durable runs and revisioned commands #5678shared-agent-harness-3bb0-s12— feat(agent-harness): recover queued runs and stream checkpointed steps #5688shared-agent-harness-3bb0-s13— feat(agent-harness): resolve interactions and dispatch tools sequentially #5693shared-agent-harness-3bb0-s14— feat(agent-harness): fence designated client tool execution #5697shared-agent-harness-3bb0-s15— feat(agent-harness): synchronize durable snapshots and legacy history #5701shared-agent-harness-3bb0-s16— feat(agent-harness): reuse authorized invitations with durable replay #5704shared-agent-harness-3bb0-s17— feat(integrations): bound repository transport for harness reads #5710 ← this PRshared-agent-harness-3bb0-s18— feat(integrations): expose bounded authorized repository reads #5714shared-agent-harness-3bb0-s19— feat(agent-harness): expose named authorized resource reads #5718shared-agent-harness-3bb0-s20— feat(sessions): bound history transport for harness reads #5724shared-agent-harness-3bb0-s21— feat(agent-harness): read scoped Cloud Agent context and progress #5726 (tip)