Skip to content

The code.repo ops that register or change a repository refuse when code intelligence is off - #211

Merged
zlareb1 merged 13 commits into
mainfrom
fix/code-repo-ops-kill-switch
Nov 3, 2026
Merged

zlareb1 merged 13 commits into
mainfrom
fix/code-repo-ops-kill-switch

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

With LOOM_CODE_INTEL_ENABLED=false, the code.repo.* operations that register or change a repository (add, add a branch, list remote branches, set access, set source) answer a precondition error like every other code.* operation. code.repo.remove stays available, so an index can be retired on a deployment with code off.

Why

code_intel_enabled is the code plane's kill switch. Its setting comment says it is checked at the top of every code.* handler (require_code_intel). The six handlers in server/code/app/repo_admin.py never called it; five of them now do.

So with code intelligence off and self-service on (code_self_service_enabled defaults to on):

  • code.repo.add probed the sandbox and registered a repository;
  • code.repo.set_access and code.repo.set_source changed repository state. (code.repo.remove ran too; it stays available on purpose, see Scope and risk.)

The deployment the switch exists for, one that serves memory without the code index, still let maintainers start indexing.

Calling every code.* handler in the registry with the switch off found exactly these six. code.search, code.grep, code.callers and code.callees call it from the function they delegate to.

Scope and risk

  • Touches: one line at the top of five repo_admin handlers, and a comment on code.repo.remove saying why it is exempt.
  • Retirement stays open: code.repo.remove only deletes, so it is not behind the switch. Refusing it would leave a maintainer no way to retire an index while the code workers, each on its own switch (only the coverage workers follow this one), keep building it. With the switch off the dashboard cannot list repositories (code.repos refuses), so a retirement goes through code.repo.remove over HTTP, MCP or the SDK. The replica that serves the call removes its mirror; the other replicas sweep theirs only once code intelligence is on again, as the repositories and operations pages say.
  • Dashboard: with the switch off the Repositories page fails on code.repos, and its Add repository button (shown from the sandbox check, not the switch) now gets the precondition error from code.repo.remote_branches / code.repo.add instead of registering a repository.
  • Docs and settings text: the code_intel_enabled comment (and the generated configuration reference, settings schema and example file) names the exception.

Compatibility, rollout and rollback

  • Wire: no op or field changes. With LOOM_CODE_INTEL_ENABLED=false, five code.repo.* ops answer PRECONDITION_FAILED.
  • Operator steps: none.
  • Rollback: revert.

Tests

  • tests/unit/test_code_kill_switch.py calls the handler of every code.* op in the registry but code.repo.remove (51) with the switch off and an empty input, and expects the precondition error before anything is read; a new code op that skips the switch fails it. A second test checks that code.repo.remove gets past the switch and its confirm check, and reaches the registry lookup (NOT_A_REPO with an empty registry).
    • The five refusing code.repo.* cases fail on main and pass here.
  • The 13 unit test files that touch the repository-admin ops, and test_package_contracts.py, pass (148 tests).
  • Lint, typecheck (mypy_gate) and the function-length gate pass.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. The six handlers were found by inspecting every code.* handler in the registry for the switch.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint and make typecheck pass; the targeted unit files above pass, and CI runs make test-unit.
  • Generated files are regenerated in this PR, not by hand: docs/reference/configuration.md, schemas/loom-settings.schema.json and loom.example.yaml come from the catalog.py comment (settings_reference, settings_schema, settings_example).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited (none).
  • A behaviour change to any file a plugin ships bumps both plugin manifests' version (none).
  • The frontend builds and its tests pass, if frontend/ changed (unchanged).
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s).

🤖 Generated with Claude Code

@zlareb1
zlareb1 force-pushed the fix/code-repo-ops-kill-switch branch from 2b6de18 to d76603e Compare November 3, 2026 11:45
@zlareb1 zlareb1 changed the title The code.repo ops refuse when code intelligence is off The code.repo ops that register or change a repository refuse when code intelligence is off Nov 3, 2026
@zlareb1
zlareb1 force-pushed the fix/code-repo-ops-kill-switch branch 3 times, most recently from 4f026d2 to 40bb1d7 Compare November 3, 2026 13:08
zlareb1 and others added 11 commits November 3, 2026 13:18
LOOM_CODE_INTEL_ENABLED is checked at the top of every code.* handler except the six repository-admin ones, which registered and changed repositories with the switch off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…s over the ops

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…st patches settings directly

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ne sweep round

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
code.repo.remove only deletes: refusing it left a maintainer no way to retire an index on a code-off deployment, while the workers kept building it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…e HTTP route

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 force-pushed the fix/code-repo-ops-kill-switch branch from 40bb1d7 to 83bf14d Compare November 3, 2026 13:18
zlareb1 and others added 2 commits November 3, 2026 13:21
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…hat stay on

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 merged commit 3ae455c into main Nov 3, 2026
21 of 22 checks passed
@zlareb1
zlareb1 deleted the fix/code-repo-ops-kill-switch branch November 3, 2026 13:39
@pufit pufit mentioned this pull request Nov 4, 2026
9 tasks done
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