Hand-patches to the protected runtime are silently discarded on upgrade, with no supported override

Abierto
#883 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
node.js, typescript

Línea de trabajo

Start with the runtime integrity code around nativeRuntimeVerified() and the packaged files node-services/dist/main.js, files.json, and verified.json. Trace how STEP_TIMEOUT_MS and MODEL_CALL_MAX_WAIT_MS are defined and where startup verification and upgrade downloads report failures. Done means configurable limits have documented defaults, verification errors identify the mismatched file and digests, and upgrade or override behavior is covered by tests.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

The question

I had to patch the shipping runtime twice in two days to keep a local install working — once to fix wiki page rendering, once to raise two hard 5-minute model-call ceilings (see #881). Both times the fix worked, and both times I had to edit node-services/dist/main.js by hand.

Will these patches survive a version upgrade? From reading the integrity layer: no, and there is no supported alternative.

What the integrity check actually does

.simplexai-runtime/offline/ carries:

  • files.json — {schema: 1, target: "darwin-arm64", sourceCommit, sourceArchiveSha256, files: {<path>: {bytes, sha256}}}
  • verified.json — {"files": "<sha256 of files.json>"}

with four protected entries (web/static-host.mjs, web/dist/index.html, node-services/dist/main.js, node-services/dist/supervisor.js).

nativeRuntimeVerified() is effectively verifiedFor(dir) === manifest.sha256, so the two mechanisms are:

  1. every protected file must match its sha256 in files.json;
  2. verified.json must hash to the files.json it belongs to.

Editing dist/main.js therefore breaks (1) and the runtime refuses to start. I re-hashed the file, rewrote its entry in files.json (2-space JSON — a plain string replace on a minified form silently misses it), recomputed the files.json digest, and updated verified.json. That passes verification today, but the next upgrade re-downloads offline/ from sourceArchiveSha256 and my work is gone — and because the edit is unversioned, nothing in the UI or logs tells the user their install is now diverging from the release.

Why this matters more than it sounds

The two things I patched are both cases where a local install cannot work without a code change:

  • A rendering bug in renderWikiPage produced broken wiki pages for every published generation. No config could work around it.
  • Two constants — STEP_TIMEOUT_MS = 5 * 60_000 and MODEL_CALL_MAX_WAIT_MS = 3e5 — are not reachable from any config file or environment variable. When a day's evidence pack outgrows them, background reports stop existing with no user-visible error (#881).

So the only lever a user has today is to break the checksum, which is exactly what the checksum exists to prevent.

What I would ask for

  1. Say it out loud. If hand-patches are unsupported and wiped on upgrade, the verification failure should name the file and the expected/actual digest, and the UI should show "this install has local modifications" rather than a generic startup failure.
  2. A supported override for the limits. Timeouts, retry counts and evidence-pack size are operational tunables, not security boundaries — they belong in config (with the defaults above), not in compiled constants.
  3. A local overlay, if a real code fix is ever needed. Something like offline/local-overrides/ that is checked in addition to the manifest rather than instead of it, so a user can carry a fix through an upgrade and a maintainer can ask for it verbatim in a bug report.
  4. A visible upgrade path for patches. If a patched install upgrades, at minimum log which protected files differed and were replaced, so the user knows what they lost.

Reproducing the current state

D=~/.simplexai/desktop/source/<sourceCommit>/.simplexai-runtime/offline
python3 - <<'PY'
import hashlib, json, os
d = os.environ['D']
m = json.load(open(f'{d}/files.json'))
for p, e in m['files'].items():
    actual = hashlib.sha256(open(f'{d}/{p}','rb').read()).hexdigest()
    print(p, 'OK' if actual == e['sha256'] else 'MODIFIED', actual[:16])
print('manifest sha256', hashlib.sha256(open(f'{d}/files.json','rb').read()).hexdigest()[:16])
print('verified.json  ', open(f'{d}/verified.json').read())
PY

Run it on a clean install and after any local edit; the difference is the state I am describing.

Environment

macOS darwin-arm64, runtime sourceCommit 43c02e4bf47ab271a4881a00906e4fabc49fc6ec, node v26.5.0. Related: #881 (the two 5-minute gates and the stuck scheduler).

Lenguaje dominante
TypeScript
Estrellas
3.8k
Forks
360
Merge medio
8 h 10 min
PR fusionados (30 d)
540

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de simplexai-labs/linger

Todos los issues de simplexai-labs/linger

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.