Skip to content

slide rollback: a fact graph is removed only when its own folders file names the folder - #3073

Merged
ashhart merged 3 commits into
mainfrom
security/rollback-graphs
Nov 13, 2026
Merged

ashhart merged 3 commits into
mainfrom
security/rollback-graphs

Conversation

@ashhart

@ashhart ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

What this changes

Before: tensorfold slide rollback unlinked every path its snapshot's graphs list named that read as a fact graph. The list sits in the model folder, so a folder copied or downloaded with a snapshot inside could name any fact graph of the user's. After: a --slide server also writes GRAPH.folders beside the fact graph, listing the folders that learned from it, and a rollback removes a listed graph only when that file names the folder. The ones it leaves are printed.

  • Issue: n/a. SECURITY.md asks for private reports, so there is no public issue.
  • Stacked on: main.
  • atc overlap --json: not run.

Checks on this head

  • Head commit: 61025cb29b69a17a7a0b5d8d1a3eb0b4bd0366c7
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 345 on the base, 345 on this head, 0 new.
  • Tests run, with the command and pass, fail and skip counts:
    • zig fmt --check and git diff --check: pass
    • the engine API module's snapshot and rollback tests, through a filter step added for the run only (they have no host step of their own): 3/3 steps succeeded; 70/70 tests passed
    • zig build test-server-cpu: 5/5 steps succeeded; 1325/1332 tests passed (7 skipped)
    • zig build test-golden test-server-security test-pull-security: 76/76 steps succeeded
    • zig build check-native-cuda-host compile-flashnext-mtp-parity-host compile-glm-native-open: 11/11 steps succeeded
    • zig build native: 66/66 steps succeeded
  • New tests:
    • security: a rollback leaves a fact graph its snapshot lists unless the graph's own side names the folder
  • CI: runs on this push.
  • Not run, and why: Not run against a real taught folder. zig build test and every step that runs on a GPU were not run: this Mac's GPU was serving a model, and no CUDA, ROCm or Intel hardware was available.

Receipt

n/a. This change cannot reach inference: it is the rollback command and the snapshot's bookkeeping before a lesson.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. On main, a rollback of a folder whose snapshot list was given the path of an unrelated fact graph deleted that graph: 69 of 70 tests passed and the probe failed.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

Notes for the reviewer

  • A fact graph taught by an earlier version has no .folders file until a --slide server next teaches the folder. A rollback before that leaves the graph and prints it. docs/living-weights.md says so.
  • The folder is listed by its real path. A model folder moved after it learned no longer matches, and its graph is left and printed.
  • The record sits beside the graph and not inside its JSON because slide_graph.zig is at 599 lines. A field in the graph would do the same job if you prefer it there.

Suggested changelog line

tensorfold slide rollback removes a fact graph only when the GRAPH.folders file beside it lists the folder, and prints the ones it leaves.

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Review: the rule is right, and the cases it now leaves alone err toward keeping the user's data: graphs taught before this version, and folders moved or reached through another mount. Two fixes before landing:

  1. Delete the .folders file with its graph. After a graph is removed, writeLines (originals.zig:445) keeps the other folders' names. A new graph later made at the same path would inherit them, and an old folder's rollback could then delete it.
  2. Never abort a half-done rollback. Today, a read error other than FileNotFound on .folders (:438, :455) aborts the rollback after files were already put back, and so does a failed rewrite after the graph is removed (:445). Re-running it fails the same way. Treat an unreadable file as "not listed": leave the graph and print it. Make the cleanup after removal best effort.

The attack paths hold: a planted list can't vouch for a graph outside the folder, and a symlinked file only loses its link. We'll push both fixes.

  • Synthena (Ash's Agent)

@ashhart

ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

Review fixes pushed (f54cdf7):

  • A removed graph takes its .folders file with it, so a later graph at the same path starts clean. If that delete fails, the rollback still succeeds and prints how to remove the file by hand.
  • A .folders file that can't be read leaves its graph in place, and the CLI prints why. A rollback that has already put files back no longer aborts.
  • The paragraph in docs/living-weights.md is updated.
  • New step test-originals-host in the Linux and macOS fast host lists.

Results:

  • test-originals-host: 39/39.

  • test-server-cpu: 1325/1332 (7 skipped).

  • check-native-cuda-host, which compiles the rollback CLI: passes.

  • Both new tests fail without the fixes. Lean: 345 before and after.

  • Synthena (Ash's Agent)

@ashhart
ashhart marked this pull request as ready for review November 13, 2026 00:01
…e names the folder

A rollback unlinked every path its snapshot's graphs list named that read as a fact graph. The list sits in
the model folder, so a folder copied or downloaded with a snapshot inside could name any fact graph of the
user's. A --slide server now also writes GRAPH.folders beside the fact graph, listing the folders that
learned from it, and a rollback removes a listed graph only when that file names the folder. The ones it
leaves are printed. A graph taught by an earlier version has no such file until a server next teaches the
folder.
…and a folders file it cannot read leaves the graph

After a rollback removed a graph, its folders file kept the other folders' names, so a graph made later at the same
path took them on and an old folder's rollback could remove it; the file now goes with the graph. A folders file
that cannot be read stopped a rollback that had already put the files back; it now counts as one that does not
name the folder, the graph stays, and the rollback prints why. A folders file left behind after its graph is
removed is printed too, not fatal. test-originals-host runs the snapshot and rollback tests on Linux and macOS.
@ashhart
ashhart force-pushed the security/rollback-graphs branch from f54cdf7 to 06b454d Compare November 13, 2026 10:55
@ashhart
ashhart merged commit 13d7ce0 into main Nov 13, 2026
16 of 24 checks passed
@ashhart
ashhart deleted the security/rollback-graphs branch November 13, 2026 10:55
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