Zhang-Wei (Discord, v0.1.1318, 102 skills) saw every sync fail with "GitHub sync: HTTP 422: Sorry, the file is too large to be processed" on magpie/magpie.magpie-backup; the last backup that went up was about 19 MB. The Contents API's PUT refuses files well under the 100 MB a blob can hold. A repository with commits is now written through the Git Data API: the ref's head, the file's version at that head (it must still be the one sync read, or errChanged), a base64 blob, a tree on the head's tree, a commit with the head as its parent, and a ref update without force. Still one commit per write or removal, and the version is the blob SHA as before. A ref update that is not a fast-forward is built again on the new head (the blob is kept), up to three times, then errChanged; if the new head changed the backup it is errChanged at once, so another computer's backup goes through the normal merge. A branch deleted meanwhile is an error, not created. Usage files and their removal take the same path. An empty repository has no head to build on, so its first write still goes through the Contents API (one commit, unchanged). If that is refused as too large (422 "too large" or 413), a short README.md in magpie's folder makes the first commit and the backup follows as the second. Reading was already right for large files: the object media type gives encoding "none" over 1 MB and bytes() downloads by blob SHA; the new test covers it at 21 MB. The fixture now serves the Git Data API (blobs, commits, trees, a fast-forward-only ref update) and refuses a Contents PUT over contentsLimit with GitHub's 422 text. docs/subsystems/sync-backup.md says how writes go and names the new tests. Record for this push: 13 commits on origin/mainca4a1cde0, head tree539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go run and vet were at tree d6393dfc8, the same Go code as this head: only app.js comments (cut under the core script budget) and one ja string changed after it. - gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. - go test -timeout 45m ./..., through tee, one suite on the machine: 68 packages ok. The one red was internal/gui's TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew app.js under the stack. The autoscroll commit's own comments were cut (to 1,334,629) rather than the budget raised, and go test -count=1 ./internal/gui is ok at this head (113s). Packages the run took from Go's test cache had the same inputs. - GUI: the 18 files this stack touches or names, both engines, 202 of 204 pass (tree068acf128, this push less the last commit). The two reds: gui-ja, red on main sincec2636b7b5and fixed by this push's last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's chromium "several accounts" (#2163, red on main the same way). - internal/davsync and internal/cli ok, the GitHub large-backup tests and TestGitHubCmd among them. - s3-sync.test.cjs (WebKit en) is red alone on main too: #2448, the header over the form's tick. This commit doesn't touch the GUI. The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run alone at the stack and at origin/main8278fd9b0. Eight are red the same way on main: plugin-card-update (#3079), quota-count-wrap and quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide (#2276), usage-checkin (#3091), usage-fold's chromium "several accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both and were red only under that run's load (50 to 335): currency #3101, plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564, routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804, routing-wb-restricted #1905, sessions-folder-delete #2218, sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack #3296. Red on the old github.go (the new tests with the old code): TestGitHubLargeBackup and TestGitHubEmptyRepositoryLargeBackup fail with "HTTP 422: Sorry, the file is too large to be processed", TestGitHubRemote too at its 1.26 MB put, and TestGitHubBranchMovedMeanwhile's three subtests fail. Broken by hand on the new code, each red: - version check at the head skipped: TestGitHubRemote, LargeBackup's stale put, BranchMovedMeanwhile/the_backup - no rebuild on a non-fast-forward: BranchMovedMeanwhile/another_file and /the_backup - large read by base64 only: TestGitHubRemote, TestGitHubLargeBackup - no README initialization: TestGitHubEmptyRepositoryLargeBackup (409) Not tried against the real GitHub API: the fixture follows GitHub's documented Git Data API, and GitHub's exact Contents API size limit is not documented.
Subsystem design references
These pages describe current responsibilities, runtime paths, state, and contracts. Start with the subsystem relevant to your task, then follow its source links to verify the implementation you change.
| Subsystem | Reference |
|---|---|
| Built-in subscriptions moving to plugins | Provider and plugin ownership |
| Built-in plugins: registry, lifecycle, plugins.yml, presets, settings schemas, the window's kernel (slots, error boundary, kit) | Plugin runtime |
| Plugins that run on the gateway's requests and replies | Gateway middleware |
| Tools that plugins give, offered to every agent as an MCP server | Plugin tools |
| Plugins that await context recall and observe completed replies | Asynchronous gateway request hooks |
| Claude subscription turns across Claude Code runs | Claude subscription bridge |
| How the gateway picks a provider, key or account, and falls back | Gateway routing and fallback |
| Gateway Session Aggregation | Gateway Session Aggregation |
| Connecting an agent's config to the gateway, drift, disconnect, WSL twins | Agent wiring |
| Providers, keys, subscription accounts, refresh and allowance | Providers and accounts |
| Instructions, MCP servers, skills and RTK written into agents | Library |
Tray, panel, window, magpie web and the page's JSON API |
GUI app shell |
| Encrypted backups and setup synchronization over WebDAV, S3 or GitHub | Sync and backup |
A subsystem can span several packages or repositories. Its reference describes the behavior those parts provide together; it does not need to list every function.
Maintain a reference
Update the owning reference in the same PR when a change alters a documented responsibility, interface, state transition, runtime path, compatibility rule, or failure behavior. An internal refactor that preserves these contracts does not require a prose change.
Keep each fact in one reference and link to it from agent instructions or other pages. Link to source files and named symbols rather than copying implementation details that change frequently. Explain field meanings and constraints that signatures alone do not express.
For a new reference, include the responsibilities and boundaries, source of truth, main runtime paths, state transitions, important constraints, and existing verification commands. Include failure and compatibility behavior where relevant. Document current behavior separately from proposed changes; the proposal belongs in its issue or PR.
Describe a PR's semantic changes
For each affected subsystem, explain the observable change with its trigger and before/after behavior. Include changes to interfaces, state, compatibility, and failure behavior when relevant. Link the affected reference, implementation, and verification evidence. State when a refactor preserves the documented behavior.
For example, a change to plugin adoption should explain which migration state and account condition trigger it, which implementation handles requests before and after adoption, and which test exercises that transition.
This is an author-provided explanation that a reviewer verifies against the diff and surrounding code. It is not an automatically proven compatibility verdict.
Review a change
- Identify the affected subsystem and the actual runtime path, including plugin or built-in ownership.
- Compare the claimed before/after behavior with the base and head implementation. Trace relevant callers and state transitions beyond the changed lines.
- Check that changed contracts appear in the owning reference and that source links still resolve.
- Check that the cited tests or runtime evidence exercise the claimed behavior. Report checks that were not run.
A documentation update alone does not prove the implementation. Existing tests and runtime evidence remain necessary for behavior changes.