Skip to content

Readers prepare contents; fix tokens, instances and settings save - #26

Merged
qiansc merged 1 commit into
mainfrom
sync/reader-prepare-20261129
Nov 29, 2026
Merged

qiansc merged 1 commit into
mainfrom
sync/reader-prepare-20261129

Conversation

@qiansc

@qiansc qiansc commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Background

Agents that only hold a read-only personal token could report, but not fix, a commit that is not readable yet. This lets ordinary readers prepare the contents of one full SHA under their own limits, as the internal release does, and fixes several community-site issues.

Changes

  • Reader content preparation (site setting reader_prepare, on by default): a signed-in user or token that can see a repository but does not manage it may prepare contents of a full SHA through HTTP prepare kind: "content" or MCP prepare with content_only: true. Limits per user (50 new tasks an hour, 5 active) and per repository (10 an hour, 10 active), plus 60 requests a minute per caller; ready commits and joined work are free. Reader versions have a share of 50 per path group with one-hour protection, are kept 7 days outside the retention policy, never cause index or ordinary-version eviction, and become ordinary once synchronized or prepared by a manager. Failed fetches are remembered for an hour. MCP without a token lists prepare and answers LOGIN_REQUIRED. Capabilities add prepare-content-reader.
  • Raw reads repeat their media type in X-Sourcegraph-Content-Type and send X-Content-Type-Options: nosniff.
  • Fix: the SQL identity store implements UpdateAPIKeyScope and RenameScopeTag; the API token page and the MCP visibility panel failed with API_KEY_STORAGE_UNAVAILABLE.
  • Fix: Operations shows each instance's repositories on a single-host site (the field failed to mount without coordination members).
  • Fix: repository settings save with a fresh preview and are no longer refused (REVISION_CONFLICT) when only a synchronization check moved the revision; real concurrent setting changes still conflict.
  • Fix: the connect page hides the address section when the deployment has one site.
  • Docs (docs/interfaces.md) and the sourcegraph skill.

Risk

On by default: reader tasks use the manual worker after managers' work and count toward each repository's active-task limit. Cross-repository user concurrency is best effort across instances.

Compatibility

reader_prepare.enabled=false keeps the previous behaviour; all fields are additive.

Testing

gofmt, go vet ./..., go test ./..., -race on control/sso/sitesettings/httpserver/mcpserver/service, bun run check. New tests cover the permission matrix, limits, share and protection, storage low-water behaviour, marking, failure memory, MCP listings, and the SQL API key store.

🤖 Generated with Claude Code

Ordinary readers may prepare the contents of one full SHA (site setting
reader_prepare, on by default): per-user and per-repository limits, a
reader share of 50 versions per path group with one-hour protection,
7-day retention outside the retention policy, no index or ordinary
version is dropped for them, and failed fetches are remembered for an
hour. HTTP prepare kind=content and MCP prepare content_only serve
readers; MCP without a token answers LOGIN_REQUIRED. Raw reads repeat
their media type in X-Sourcegraph-Content-Type and send nosniff.

Fixes:
- The SQL identity store implements UpdateAPIKeyScope and
  RenameScopeTag, so the API token page and the MCP visibility panel no
  longer fail with API_KEY_STORAGE_UNAVAILABLE.
- Operations: a single-host site shows each instance's repositories.
- Repository settings: saving takes a fresh preview and is not refused
  when only a synchronization check moved the revision.
- Connect: the address section is hidden when a deployment has one site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qiansc
qiansc merged commit 9ccc9b3 into main Nov 29, 2026
3 checks passed
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