Repository navigation
Context 0.7.107: update knowledge without cloning through Sourcegraph - #120
Merged
Merged
Conversation
Updates, revisions, submission checks, verify and status can read a registered repository from a Sourcegraph site instead of a local checkout. - CONTEXT_SOURCE_MODE / --source-mode: local (default, no network), remote (repositories Sourcegraph cannot serve are skipped and keep their processed version) or auto (Sourcegraph first, checkout fallback). - Raw blobs at the registered commit, batched (100 paths, budget overflow reread later, FILE_TOO_LARGE not retried) and checked against their Git object id; names-only diffs and directory lists mapped to the subpath, split by subdirectory when too large. Results equal the local checkout: FILE_NOT_FOUND and NOT_A_FILE map to the local missing-file and file-type reasons, every other failure is a read failure, never a citation change. - A repository is read remotely only when the site declares the remote-read operations, the code host and name match the registered remote, one path group contains the whole subpath, and the registered commit is readable. update --pending prepares an unreadable commit's content and waits a bounded time; refusals and limits are reported, not retried. - context source sourcegraph-auth exchanges a one-time code from the MCP authorize_cli tool for a temporary read-only token kept in the workspace runtime directory (mode 600) and reused until a 401 or its hard expiry; SOURCEGRAPH_URL and SOURCEGRAPH_API_TOKEN take precedence. A reported TEMPORARY_TOKEN_LIMIT stops asking for authorization for a while. - update, verify and status report how each repository was read (source_access, skipped_sources, status access fields). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Knowledge-updates guide: "Update without cloning: read repositories through Sourcegraph" covers the source modes, when a repository can be read remotely, MCP authorize_cli authorization and token reuse, version preparation, and reading code through MCP for remote sources. - The context Skill passes the configured source mode, treats access: remote sources as needing no clone, and follows the authorization step; the routine update and source-update procedure skip checkouts for remote sources and handle skipped_sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Auto mode without a token asks for MCP authorization like remote mode instead of silently falling back to checkouts; it falls back only after a refused authorization or when the site cannot serve the repository. The authorization step is reported once at top level (next_action / source_authorization in update, verify and status); per-source entries keep only their state and reason, and sources waiting for it get no checkout or recovery advice in status. - A directory too large to list exists in that commit, so only its new subdirectories are marked new_directory. - Files over the raw-frame byte budget stay in batched reads while batches make progress; only a batch that settles nothing falls back to single reads, with a round cap against a misbehaving server. - A split diff treats only an absent directory as empty; other listing failures leave uncited changes unavailable. - A later prepare-enabled access decision re-decides unless the commit is already readable. - Raw reads reject trailing bytes after the frames and answers that name another commit; --host rejects credentials, query and fragment. - Content preparation clears a rejected temporary token and asks for authorization, and stops polling when its job reports failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Background
Updating knowledge needs a local checkout of every repository source. When the repositories are already registered on a Sourcegraph instance, Context can read the pinned commits remotely instead.
Changes
CONTEXT_SOURCE_MODE/--source-mode:local(default, unchanged, no network),remote(skip repositories that cannot be read remotely and report them),auto(remote first, falls back to the local checkout per repository).authorize_cli;context source sourcegraph-auth --code --hostexchanges the single-use code for a temporary read-only token kept in the workspace (never printed); one authorization per workspace session;SOURCEGRAPH_URL/SOURCEGRAPH_API_TOKENtake precedence.update, revision andverifyread through the new reader;update --pendingcan prepare a commit's contents and wait for it;status/verifyreportsource_accessand a single top-levelsource_authorization.Risks
Remote mode depends on the Sourcegraph site exposing the remote-read operations; sites without them are treated as unavailable. Local mode is unchanged.
Compatibility
Default
localkeeps 0.7.106 behaviour and network access. New output fields are additive.Testing
Build, typecheck and lint pass; new tests (remote source access, remote update integration) and existing tests of touched modules pass per file. A comparison on a real knowledge workspace produced byte-identical update inputs and evidence in local and remote modes, apart from repositories that are not registered remotely.
🤖 Generated with Claude Code