Build Basalt 0.3.3 candidate and integrate media and response controls

This commit is contained in:
Mikei386 committed 2026-11-13 12:53:49 +01:00
1 parent 584a884cc9
commit 34e711721a
44 files changed
+2290 -166

No files matched your search

+23
View File
@@ -5,6 +5,29 @@ curated project handoff, not imported chat history. Read applicable `AGENTS.md`,
then the current source and relevant linked documentation; verify live state
again before changing anything. Historical notes do not override current facts.
## Basalt 0.3.3 staged: new runtime and Deck media/control integration
Maintained recipe now pins `2729e2288f59e01836ddd7fcc630810ada98995a` /
0.3.3, with the same v2 model/config and existing expert/cache policy. Own bounded
Athena candidate built without GPU/model access: textSM120, visionSM86/SM120,
pypdf7.0.1 and FFmpeg6 ABI. Actual binary hashes and fatbin architectures checked.
Deck adds bounded inline documents/video, installed-versus-loaded capabilities,
logprobs (including Responses channel extensions), principal-scoped request/session
IDs and authenticated answer-now without ensure/lease/model switching. Testchat
attachments, PDF pages, effort/logprobs and job-bound controls are implemented.
827 synthetic Root tests passed on the exact index, plus 11/11 browser-mock and
1102 pinned-upstream CPU-mock tests (6skips, no errors/failures). The hostcontroller
timed out after emitting all successful gates and hit an auto/manual-remove race;
owned sandbox absence verified, helper fixed with5 local regressions, not rerun.
Both the successful checks and failed controller closure are recorded. These are
not real0.3.3 inference, NVDEC or a fresh native Debian/full-restore acceptance.
No0.3.3 production activation or new-model benchmark has been authorized here.
The last verified production remains healthy0.3.0/original model/allCPU/one slot,
same image/start/protected settings. Keep that pair for rollback, preserve Qwen
and audio; future app/runtime activation needs a separate Go and normal drain.
[Build, contracts, checks, execution environments and open gates](maintenance/basalt-033-staged-2026-11-13/README.md).
## Basalt all-CPU/one-slot configuration active · 9 November, 19:39 CET
Michael separately approved normal API/audio interruption and short acceptance,
+18
View File
@@ -1,3 +1,21 @@
## Basalt 0.3.3 prepared; production 0.3.0 deliberately unchanged
The new recipe/runtime candidate and Deck source support bounded documents and
video, capabilities/logprobs, principal-scoped request/session IDs and answer-now,
including testchat controls. TextSM120 and visionSM86/SM120 built and independently
inspected; pypdf7.0.1/FFmpeg6 ABI, 827 Root tests and 11/11 browser-mock gates passed.
The exact-index suite passed. Pinned-upstream CPU-mock:1102 tests,6skips,no failures.
All8 feature gates passed before the hostcontroller's timeout/auto-remove race;
own container absent, helper fixed and5 local unit tests passed. This failed
controller closure is retained separately, not hidden by the successful tests.
No production image/runtime activation, weight download, profile change, service
restart or real0.3.3 inference. The running Basalt0.3.0/original Qwen/allCPU/one-slot
pair and existing audio remain the protected baseline and rollback. New app-code
activation and model/NVDEC/audio acceptance need a separate Go and ordinary
authenticated drain. Fresh Debian/systemd/full encrypted restore still unproven.
[Prepared artifact, contracts, native recipe and acceptance limits](maintenance/basalt-033-staged-2026-11-13/README.md).
## 9.11.2026 · Basalt all-CPU/one-slot configuration active
Existing Basalt0.3.0/original model remains active on5080; normal vision/Anna/ASR
@@ -0,0 +1,164 @@
# Basalt 0.3.3: Laufzeitkandidat und Deck-Funktionen
## Ergebnis und klare Betriebsgrenze
Der Auftrag umfasst **bauen und in Deck implementieren**, nicht das ungefragte
Umschalten des laufenden Dienstes. Basalt0.3.3 wurde isoliert gebaut; die neuen
Deck-API-/Testchatfunktionen liegen im Quellcode. **Die Produktion bleibt beim
bisherigen Basalt0.3.0, demselben Modell und der all-CPU-/Ein-Slot-Konfiguration.**
Kein echter Modellstart, GPU-Inferenzlauf, Benchmark, neues TTS-Profil oder
Produktions-/Container-/Gatewayneustart gehört zu dieser Vorbereitung.
- Upstream: [Basalt v0.3.3](https://github.com/jesdga95/basalt/releases/tag/v0.3.3).
- Source-Pin: `2729e2288f59e01836ddd7fcc630810ada98995a`.
- Modell-/Konfigurationsformat bleiben v2; Gewichte/Quantisierung unverändert.
- Athena-Kandidat: `/opt/athena-deck-dev/basalt-033-candidate-2729e2288f59/runtime`.
- Native Installation/Restore/Rückfall: [gepflegtes Rezept](../../../deploy/BASALT_NATIVE.md).
## Implementierte Funktionen
| Bereich | Deck-Vertrag |
|---|---|
| Dokumente | Chat: `type=file`, eingebettete `file_data`, `filename`, optional `file.pages`. Responses: `input_file`. PDF, DOCX, PPTX, XLSX und UTF-8-Textformate. Keine Datei-IDs, Serverpfade oder URL-Nachladefunktion. |
| Video | Chat: `video_url` bzw. `input_video` mit eingebetteter URL; Responses: `input_video` mit `video_url`. Standard/Maximum2Frames/s und128Frames; keine Audioauswertung. Vision-Projektor und bestätigte Videofähigkeit erforderlich. |
| Fähigkeiten | `/props?model=API_ID` trennt `available_capabilities` der Installation von `capabilities` und `loaded` des tatsächlich passenden Workers. Die Erkennung startet kein Modell. `/v1/capabilities` beschreibt den Routervertrag. |
| Logprobs | Chat: `logprobs=true`, `top_logprobs` als ganze Zahl0–20. Responses: `include=["message.output_text.logprobs"]`; Text-, Thinking- und Toolkanäle bleiben erhalten. Kein Wahrheits-/Qualitätsscore. |
| Request-IDs | `X-Request-Id` auf Chat-/Responses-Antworten; eine optionale `X-Client-Request-Id` ist ein principalgebundener Alias. Interne IDs werden zufällig erzeugt, nicht unkontrolliert vom Client übernommen. |
| Sitzung | `session_id` oder in dieser Reihenfolge `x-llm-flow-id`, `x-claude-code-session-id`, `x-session-id`, `x-session-affinity`. Die Weitergabe verwendet einen principalgebundenen flüchtigen HMAC, keinen fremden Klartext-Namespace. |
| Jetzt antworten | Authentifiziertes `POST /v1/answer_now` mit `request_id` oder Sitzung. Nur eigener Principal, ursprüngliches Profil/Revision/Workergeneration; keine Lease, kein Ensure/Load/Stop. Auch in Deck wartende Anfragen können die Umschaltung vormerken. |
| Testchat | Dateien hinzufügen/entfernen, PDF-Seitenwahl, Denkstufe, optionale Tokenwahrscheinlichkeiten und „Jetzt antworten“. Abbruch/Steuerung bindet die aktuelle Testjob-ID. Anmeldung/CSRF bleiben erforderlich. |
Die öffentliche Deck-Integration betrifft die vorhandenen Chat-Completions-
und optionalen Responses-Routen. Sie veröffentlicht keinen neuen Anthropic-
Messages-Endpunkt und aktiviert Responses nicht automatisch.
### Eingabe- und Kontrollgrenzen
- Gesamtes JSON einschließlich Verlauf:64MiB.
- Höchstens8 Anhänge und zusammen32MiB über den gesamten Verlauf.
- Ein Dokument maximal16MiB, ein Video maximal32MiB.
- PDF-Seitenauswahl auf Seiten1–600 begrenzt; der native Parser begrenzt auch
die Zahl gelesener Seiten. Scans benötigen einen Vision-Projektor.
- Office-ZIP-Metadaten: höchstens2048 Einträge,16MiB je entpacktem Eintrag,
zusammen64MiB; keine verschlüsselten, Symlink- oder Traversal-Einträge.
- Kontroll-JSON maximal4KiB. Die Registry hält höchstens1024 Metadatensätze;
abgeschlossene Einträge verfallen nach600s. Prompts und Tokens gehören nicht hinein.
- 32 Datenverbindungen plus4 zusätzliche HTTP-Plätze für Steuerung. Das ist keine
Zusage gegen beliebige Netzwerküberlastung, hält aber die Kontrollroute bei
belegten normalen Datenplätzen frei.
## Tatsächliche Prüfungen
- **827 Root-Tests bestanden**, auch im expliziten Git-Indexexport: keine Fehler,
Skips oder vom Offline-Audit festgestellten verbotenen I/O, Prozessexit0.
Spätere Änderungen betreffen nur Belege, Dokumentation und den separat
geprüften Operatorhelfer; die Root-App-/Testquellen sind hashgleich.
- **11/11 Browser-Mockprüfungen bestanden**: Dateilesen und Payloadformen,
PDF-Seiten, Video-Defaults, Denkstufe/Logprobs, eigener Steuerknopf,
Antwortabschluss, Dateinamen-Escaping,32MiB-Clientlimit, alte Laufzeit gesperrt,
keine JavaScript-Fehler. Das war die echte neue UI mit synthetischem Backend,
nicht die produktiv ausgelieferte Oberfläche und keine echte Videoanalyse.
- Managementtests prüfen zusätzlich Anmeldung statt API-Bearer, CSRF,
jobgebundene Steuerung und größere Chat-Uploads ohne Aufweitung der32KiB-
Grenzen allgemeiner Einstellungen.
- Text-/Vision-Binärhashes wurden unabhängig gelesen. NVIDIAs gepinntes
`cuobjdump` bestätigte die tatsächlichen ELF-Ziele **Text120, Vision86/120**.
- `pypdf7.0.1`, `pip check`, CLI-Hilfe und zusammenpassende FFmpeg6-Bibliotheken
bestanden im Kandidatenbau. FFmpeg-ABI-Prüfung ist **kein NVDEC-Funktionstest**.
- Der zusätzliche pinned-Upstream-Lauf nutzt echte Server-/Dokument-/Control-
Implementierung mit ausdrücklich geskriptetem CPU-Mock: **1102 Tests,
0Fehler, 0Fehlschläge, 6Skips**; Skip-Gründe wurden nicht einzeln gespeichert.
Alle8 Prüfgates einschließlich Deck→Upstream-Chat/Responses, authentifizierter
Kontrolle und numerischer Telemetrie bestanden. Kein Modell-/Geschwindigkeitstest.
- **5/5 lokale Operatorhelfer-Tests bestanden**, zuvor3 gezielt rote Fälle:
automatisches/manuelles Entfernen, Erhalt des Timeoutfehlers, Zeitbudget,
erfolgreicher Abschluss und Verweigerung fremder Containerlabels. Docker wird
in diesen Unit-Tests ausdrücklich nur simuliert, nicht wirklich aufgerufen.
Maschinenlesbare Belege: [Build](build-result.json), [Native-Prüfungen](native-checks.json),
[tatsächlich ausgeführte Source-Hashes](native-inputs.json),
[Produktion unverändert und Prüfcontainer entfernt](live-preservation.json),
[Prüfzusammenfassung](verification.json), [Quellmanifest](source-manifest.json)
und [aufgelöste Kandidaten-Pythonabhängigkeiten](python-lock.txt).
### Festgehaltene anfängliche Fehler
1. Die erste Root-Gesamtsuite war nicht grün:824 Tests, ein Fehlschlag und zwei
Auditfehler. Ein global gepatchtes stdlib-`Popen` fing eine unabhängige
Hardwareabfrage ab. Der Testbereich hat jetzt seine eigene subprocess-Fassade
mit Rot/Grün-Regression. Zwei Fixtures verwendeten unnötig einen Livepfad-Link
bzw. `/tmp`; sie nutzen nun reine aufgelöste Testpfade bzw. das eigene TMPDIR.
Der Audit wurde dafür **nicht** abgeschwächt; anschließend827 Tests grün.
2. Die erste Native-Zusatzprüfung erwartete fälschlich eine echte Engineversion
von einem CPU-Mock. Upstream `/props` bezieht sie aus `engine.info`; eine
fehlende Mockversion wird nicht mit erfundenen Metadaten ersetzt.
3. Die zweite Zusatzprüfung suchte eine zusammenhängende Antwort in rohen SSE-
Bytes, obwohl der Mock einzelne Zeichen pro Event sendet. Der korrigierte
Prüfer setzt die Antwort aus den tatsächlichen Events zusammen.
4. Befehlsfreigaben liefen zwischenzeitlich ab. Solche Befehle wurden nicht
ausgeführt oder über andere Wege wiederholt; erst nach erneuter Freigabe.
5. Versuch3 schrieb den vollständigen erfolgreichen Prüfbeleg, sein Hostcontroller
endete aber **nicht erfolgreich**: allein die Upstream-Suite dauerte479,532s,
das gesamte Containerbudget war480s. Beim Timeout kollidierte zusätzlich
`--rm` mit dem manuellen Entfernen; der zweite Fehler verdeckte den ersten.
Das ist kein fehlgeschlagener Modelltest. Der eigene Container wurde unabhängig
als entfernt nachgewiesen; Produktion/Originaltext-PID/geschützte Hashes gleich.
Das gepflegte Skript verwendet jetzt genau einen manuellen Lebenszyklus und
höchstens900s einschließlich Setup. Die Korrektur ist lokal Rot/Grün geprüft;
**kein vierter Athena-Lauf**, kein nachträglich erfundener Controller-Exit0.
## Ausführungsorte und Wiederholbarkeit
- `build_host.py`: **Athena-Host**, expliziter Quelltext-/Vorherzustands-Bundle
über die bestehende Athena-SSH-Verbindung. Eigene Wurzel, kein Wiederverwenden
einer vorhandenen Wurzel,1CPU/4GiB/nice15, UID65534 des verifizierten heutigen
Deck-Kontos, runc ohne GPU-Geräte. Nur CUDA-Werkzeuge read-only geliehen;
Produktionsstate ist nicht als Datenmount beteiligt. Das ist ein isolierter
Bau auf der bestehenden Ubuntu-Appbasis, kein frischer nativer Debian-Nachweis.
- `verify_host.py`: **Athena-Host**, nur eigener fertiger Kandidat. runc ohne GPU
und ohne Netz,1CPU/4GiB, Source/Runtime/Toolkit read-only, eigene Temp-/Ausgabe-
verzeichnisse. `check_upstream.py` läuft in der tatsächlichen Kandidatenvenv.
`cuobjdump-lock.json` pinnt das kleine offizielle Inspektionswerkzeug; es wird
nicht hostweit installiert. Jeder Versuch hat eine getrennte, exklusive Wurzel.
- `test_verify_host.py`: **NAS**, führt die tatsächlichen Command-/finally-
AST-Blöcke mit einer ausdrücklich synthetischen subprocess-Fassade aus.
Es liest keine Hostkonfiguration und startet/stoppt keinen echten Container.
- `verify_offline.py`: **NAS, eigenes Projekt-Test-Python**, Root-Suite auch gegen
einen Export des Git-Index. Sperrt Produktions-/VPN-Zugriffe, andere Profile,
Remote-/Containerbefehle und nichtlokale Testverbindungen. Kein Live-Abnahmeclient.
- `ui_mock.py`: **NAS**, zeitlich begrenzte Loopback-UI mit explizitem Mock-Banner;
keine Verbindung zu Athena, keine Modellinferenz. Keine neue Dauerdienstinstallation.
- `acceptance.py`: **NAS, bestehende Hermes-Profilumgebung**. Standardaufruf ohne
neues `--go` verweigert vor Zugangsdatenauflösung und API-Zugriff. `--self-test`
erzeugt nur synthetisches PNG/PDF/MP4 in RAM; FFmpeg/libx264 arbeitet auf CPU.
Der No-Go-Schutz und die Fixture-Erzeugung wurden tatsächlich ausgeführt.
Der spätere Live-Client ist auf höchstens900s begrenzt, verändert keine
Einstellungen und startet kein anderes Modell absichtlich kalt. Vor jeder
Inferenz muss `/props` bereits geladenes Basalt0.3.3 mit den erwarteten Fähigkeiten,
einem Slot und262144 Kontext bestätigen. Geprüft werden Text/Request-ID/Logprobs,
PDF, synthetisches rotes Video und Sitzungs-`answer_now` im selben Stream.
Responses wird nur bei bereits eingeschalteter Kompatibilität geprüft; andernfalls
erscheint dies ausdrücklich als nicht ausgeübt. Es werden keine Rohantworten,
Prompts oder Zugangsdaten in den Ergebnisbeleg geschrieben.
## Aktivierung, Rückfall und ausdrücklich offene Gates
**Dieses Ergebnis ist keine Aktivierungserlaubnis.** Eine spätere Übernahme
braucht Michaels separates Go, normale Management-Anmeldung, frischen Nachweis
für aktive **und wartende** Arbeit sowie ein abgestimmtes Audiofenster. Stop
kann auch Audio entladen. App-Code und passendes Runtime-Rezept müssen zusammen
umgestellt werden; ein bloßes Worker-Neuladen installiert diese Python-/UI-
Änderungen nicht. Noch kein neues produktives App-Image aus diesem Stand aktiviert.
Altes Basalt0.3.0-App-/Runtime-Paar, dieselben Gewichte und Ein-Slot-/CPU-
Konfiguration bleiben der Rückfall. Kein stilles Wechseln auf Strata, Lamina,
ein anderes Modell oder eine andere Quantisierung. Das heutige private Toolkit
muss nativ aus dem festen Rezept rekonstruierbar sein; die geliehene CUDA-Quelle
des Kandidaten ist kein verstecktes dauerhaftes Restore-Erfordernis.
**Nicht abgenommen:** echte0.3.3-Modell-/NVDEC-Inferenz und Audio-Koexistenz,
Geschwindigkeitsgewinn, volle262144 Token oder Last-/Dauertest, produktive UI,
Mac-Client sowie frisches Debian/systemd mit vollständigem verschlüsseltem
Restore. Der Basisinstaller bleibt der dokumentierte offene Produktumfang;
Container- und Dateiprüfungen ersetzen ihn nicht.
@@ -0,0 +1,119 @@
#!/usr/bin/env python3
"""NAS/Hermes-profile client, ONLY after a separate live-model acceptance Go.
No activation, restart, unload, settings changes or benchmarks. --self-test only
creates synthetic media in memory and checks its structure, without credentials.
"""
import argparse
import base64
import concurrent.futures
import importlib.util
import io
import json
import math
from pathlib import Path
import struct
import subprocess
import threading
import time
import urllib.error
import urllib.request
import uuid
import zlib
HERE=Path(__file__).resolve().parent
BASE='http://192.168.1.212:8120'
MODEL='flash-next-basalt'
CODE='BASALT-033-317'
def fixtures():
def chunk(name,data):return struct.pack('!I',len(data))+name+data+struct.pack('!I',zlib.crc32(name+data)&0xffffffff)
png=b'\x89PNG\r\n\x1a\n'+chunk(b'IHDR',struct.pack('!2I5B',64,64,8,2,0,0,0))+chunk(b'IDAT',zlib.compress((b'\0'+b'\xff\0\0'*64)*64))+chunk(b'IEND',b'')
text=('BT /F1 12 Tf 10 50 Td ('+CODE+') Tj ET').encode()
objects=[b'<< /Type /Catalog /Pages 2 0 R >>',b'<< /Type /Pages /Kids [3 0 R] /Count 1 >>',b'<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 100] /Resources << /Font << /F1 5 0 R >> >> /Contents 4 0 R >>',b'<< /Length '+str(len(text)).encode()+b' >>\nstream\n'+text+b'\nendstream',b'<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>']
pdf=bytearray(b'%PDF-1.4\n');offsets=[]
for n,obj in enumerate(objects,1):offsets.append(len(pdf));pdf.extend(str(n).encode()+b' 0 obj\n'+obj+b'\nendobj\n')
xref=len(pdf);pdf.extend(b'xref\n0 6\n0000000000 65535 f \n'+b''.join(f'{n:010d} 00000 n \n'.encode() for n in offsets)+b'trailer\n<< /Size 6 /Root 1 0 R >>\nstartxref\n'+str(xref).encode()+b'\n%%EOF\n')
# Explicit CPU-only lavfi -> libx264, no input file, decoder or GPU device.
command=['ffmpeg','-nostdin','-hide_banner','-loglevel','error','-f','lavfi','-i','color=c=red:s=64x64:r=2:d=2','-frames:v','4','-an','-c:v','libx264','-threads','1','-pix_fmt','yuv420p','-movflags','frag_keyframe+empty_moov','-f','mp4','pipe:1']
video=subprocess.run(command,capture_output=True,check=True,timeout=20).stdout
assert b'ftyp' in video[:64] and len(video)<1024**2
assert pdf[xref:xref+4]==b'xref' and all(pdf[offset:offset+len(str(n))+6].startswith(str(n).encode()+b' 0 obj') for n,offset in enumerate(offsets,1))
return dict(png=png,pdf=bytes(pdf),video=video)
def url(mime,data):return 'data:'+mime+';base64,'+base64.b64encode(data).decode()
def main(argv=None):
p=argparse.ArgumentParser();p.add_argument('--go',action='store_true');p.add_argument('--self-test',action='store_true');p.add_argument('--output',type=Path);p.add_argument('--seconds',type=int,default=900);a=p.parse_args(argv)
if a.self_test:
values=fixtures();print(json.dumps({'synthetic_fixtures':{k:len(v) for k,v in values.items()},'credentials_resolved':False,'network_requests':0,'model_inference':False}));return 0
if not a.go:p.error('Separate explicit live-model acceptance Go required; --self-test makes no API calls.')
if a.output is None or a.output.exists() or not a.output.parent.is_dir() or not 1<=a.seconds<=900:p.error('New output path in an existing directory and a budget of at most 900 seconds required.')
spec=importlib.util.spec_from_file_location('athena_managed_transport',HERE.parent/'basalt-candidate-2026-11-01/paired_transport.py')
if spec is None or spec.loader is None:raise RuntimeError('Tracked profile-scoped transport is unavailable.')
module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module);credential=module.key()
deadline=time.monotonic()+a.seconds;result={'complete':False,'activation_performed':False,'checks':{},'inference_requests_sent':0,'started_at':time.time()};media=fixtures()
def save():a.output.write_text(json.dumps(result,indent=2)+'\n')
def request(path,body=None):
remaining=deadline-time.monotonic();assert remaining>0
req=urllib.request.Request(BASE+path,data=None if body is None else json.dumps(body).encode(),headers={'Content-Type':'application/json','Authorization':'Bearer '+credential})
with urllib.request.urlopen(req,timeout=min(30,remaining)) as response:return json.load(response),dict(response.headers)
def chat(content,**options):
result['inference_requests_sent']+=1
return request('/v1/chat/completions',dict(model=MODEL,messages=[dict(role='user',content=content)],temperature=0,max_tokens=32,reasoning_effort='none',**options))
def text(value):return value['choices'][0]['message'].get('content') or ''
try:
props,_=request('/props?model='+MODEL);info=props.get('basalt',{})
assert info.get('loaded') is True and info.get('version')=='0.3.3','Resident Basalt0.3.3 required; this client must not cold-load another runtime.'
assert {'answer_now','documents','logprobs','video'}<=set(info.get('capabilities',[]))
assert props['total_slots']==1 and props['default_generation_settings']['n_ctx']==262144
result['checks']['resident_version_and_unchanged_slot_context']=True
value,headers=chat('Antworte nur mit BEREIT.',logprobs=True,top_logprobs=2)
probs=value['choices'][0].get('logprobs',{}).get('content',[])
assert 'BEREIT' in text(value).upper() and headers.get('X-Request-Id') and probs
assert all(isinstance(e,dict) and type(e.get('logprob')) in (int,float) and math.isfinite(e['logprob']) and isinstance(e.get('top_logprobs'),list) and len(e['top_logprobs'])<=2 for e in probs)
result['checks']['text_request_id_and_logprobs']=True;save()
value,_=chat([{'type':'text','text':'Nenne ausschließlich den Code aus der PDF.'},{'type':'file','file':{'filename':'synthetic.pdf','file_data':url('application/pdf',media['pdf']),'pages':'1'}}]);assert CODE in text(value);result['checks']['pdf_selected_page']=True;save()
value,_=chat([{'type':'text','text':'Welche Farbe füllt das Video? Antworte mit genau einem deutschen Farbnamen.'},{'type':'video_url','video_url':{'url':url('video/mp4',media['video'])},'fps':2,'max_frames':4}]);assert 'rot' in text(value).lower();result['checks']['synthetic_video_red']=True;save()
caps,_=request('/v1/capabilities');enabled=caps.get('responses',{}).get('enabled') is True
if enabled:
result['inference_requests_sent']+=1
value,_=request('/v1/responses',dict(model=MODEL,input=[dict(role='user',content=[dict(type='input_text',text='Gib nur den Dateicode aus.'),dict(type='input_file',filename='synthetic.txt',file_data=url('text/plain',CODE.encode()))])],max_output_tokens=32,reasoning={'effort':'none'},include=['message.output_text.logprobs'],top_logprobs=0))
parts=[c for item in value.get('output',[]) if item.get('type')=='message' for c in item.get('content',[])];assert any(CODE in c.get('text','') and c.get('logprobs') for c in parts);result['checks']['responses_file_and_logprobs']=True
else:result['responses_not_exercised']='Responses compatibility remains disabled; this client does not change that setting.'
ready=threading.Event();finished=threading.Event();session='acceptance-'+uuid.uuid4().hex
def stream():
result['inference_requests_sent']+=1
body=dict(model=MODEL,messages=[dict(role='user',content='Prüfe ausführlich die Vor- und Nachteile von fünf verschiedenen Archivierungsstrategien und gib dann eine kurze Empfehlung.')],stream=True,max_tokens=512,reasoning_effort='high',session_id=session,temperature=0)
req=urllib.request.Request(BASE+'/v1/chat/completions',data=json.dumps(body).encode(),headers={'Authorization':'Bearer '+credential,'Content-Type':'application/json'})
answer='';done=False
try:
with urllib.request.urlopen(req,timeout=min(30,deadline-time.monotonic())) as response:
assert response.headers.get('X-Request-Id')
for line in response:
assert time.monotonic()<deadline
if not line.startswith(b'data:'):continue
raw=line[5:].strip()
if raw==b'[DONE]':done=True;break
event=json.loads(raw);assert not event.get('error')
for choice in event.get('choices',[]):
delta=choice.get('delta',{})
if delta.get('reasoning_content'):ready.set()
answer+=delta.get('content') or ''
assert done and answer.strip();return True
finally:finished.set()
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool:
future=pool.submit(stream)
assert ready.wait(min(20,max(.1,deadline-time.monotonic()))) and not finished.is_set(),'No still-running thinking phase observed; answer_now not exercised.'
control,_=request('/v1/answer_now',{'session_id':session});assert control.get('state') in ('thinking','prompt','queued')
assert future.result(timeout=max(.1,deadline-time.monotonic()))
result['checks']['session_answer_now_same_stream']=True;result['complete']=True;save();return 0
except Exception as exc:
result['failure_type']=type(exc).__name__;save();raise RuntimeError('Bounded acceptance incomplete; inspect nonsecret result flags, not a claimed success.') from None
finally:result['finished_at']=time.time();save()
if __name__=='__main__':raise SystemExit(main())
@@ -0,0 +1,68 @@
{
"owner": "athena-deck",
"commit": "2729e2288f59e01836ddd7fcc630810ada98995a",
"image": "sha256:0a358dd687a415faf26cea2d73160654fb9b2e56ad68c7013bef52bc166fed33",
"root_device": 66306,
"root_inode": 8914120,
"phase": "built_no_model_test",
"started_at": 1794561680.5234628,
"cpu_quota": 1,
"memory_gib": 4,
"nice": 15,
"gpu_access": false,
"production_state_mount": false,
"borrowed_cuda_read_only": "/opt/athena-deck-dev/runtime/state/basalt-runtime/cuda",
"source_hashes": {
"basalt_sources.json": "e2c0ca28dce89aea30b7ba0be4d05641687938fe9b08e485830c4635bb1ae30f",
"basalt_tuning.py": "f2585dab9581ce8c8b3712c4ee9f9a98d5b58d41ce11f9f8ab5b17f429e0dfdf",
"deploy/install_basalt.py": "7e81efe44224707c5b3b5417382381113b263bf6532060f8c80b4e1eed4748e5"
},
"container_id": "33d488507d47157dbfd235710f82f886c6d158d95f4d5d033e59d194acf5cf3b",
"client_exit": 0,
"container_exit": 0,
"oom_killed": false,
"ready": {
"commit": "2729e2288f59e01836ddd7fcc630810ada98995a",
"version": "0.3.3",
"cuda": "13.0",
"architectures": [
120
],
"vision_architectures": [
86,
120
],
"python": "3.12.3",
"binary_sha256": "9e89333cd2f12eee69a5e1535433631155ae92dc089774ad6c8f99e9b62c0c46",
"vision_binary_sha256": "e75b4f529acf7623c8fede68847052c097a325ca9f808d88cea4c061ed15b798",
"pdf_version": "7.0.1",
"video": {
"available": true,
"ffmpeg_major": 6,
"libraries": {
"avcodec": "libavcodec.so.60",
"avformat": "libavformat.so.60",
"avutil": "libavutil.so.58",
"swscale": "libswscale.so.7"
},
"abi_only": true
},
"origin": "native-build",
"inference_performed": false
},
"owned_container_final_state": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 0,
"Error": "",
"StartedAt": "2026-11-13T09:21:20.688388049Z",
"FinishedAt": "2026-11-13T09:54:01.431731057Z"
},
"owned_container_removed": true,
"finished_at": 1794563641.7705805
}
@@ -0,0 +1,73 @@
#!/usr/bin/env python3
"""ATHENA HOST only: bounded no-GPU builder, production state never mounted.
Input is a reviewed source-only JSON bundle from the NAS. Not an activation tool.
"""
import argparse
import hashlib
import json
import os
from pathlib import Path
import shutil
import subprocess
import sys
import time
ROOT=Path('/opt/athena-deck-dev/basalt-033-candidate-2729e2288f59')
NAME='athena-basalt033-build-20261113'
LABEL='basalt033-20261113'
COMMIT='2729e2288f59e01836ddd7fcc630810ada98995a'
CUDA=Path('/opt/athena-deck-dev/runtime/state/basalt-runtime/cuda')
FILES=('basalt_sources.json','basalt_tuning.py','deploy/install_basalt.py')
def run(*args,**kwargs):return subprocess.run(list(map(str,args)),check=True,**kwargs)
def main():
p=argparse.ArgumentParser();p.add_argument('--go',action='store_true');a=p.parse_args();assert a.go
bundle=json.load(sys.stdin);assert set(bundle['files'])==set(FILES)
recipe=json.loads(bundle['files']['basalt_sources.json']);assert recipe['code']==COMMIT and recipe['version']=='0.3.3'
before=bundle['before'];assert before['image'].startswith('sha256:')
assert not ROOT.exists() and not ROOT.is_symlink() and CUDA.is_dir()
mem=dict(x.split(':',1) for x in Path('/proc/meminfo').read_text().splitlines())
assert int(mem['MemAvailable'].split()[0])>=7*1024**2,'Insufficient live headroom; Qwen is not unloaded'
assert shutil.disk_usage(ROOT.parent).free>=12*1024**3
live=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev']))[0]
assert live['Image']==before['image'] and live['Id']==before['container_id'] and live['State']['StartedAt']==before['started']
ROOT.mkdir(mode=0o700);os.chown(ROOT,65534,65534)
for folder in ('recipe','recipe/deploy','runtime','tmp'):
q=ROOT/folder;q.mkdir();q.chmod(0o700);os.chown(q,65534,65534)
for name,text in bundle['files'].items():
q=ROOT/'recipe'/name;q.write_text(text);q.chmod(0o600);os.chown(q,65534,65534)
marker={'owner':'athena-deck','commit':COMMIT,'image':before['image'],'root_device':ROOT.stat().st_dev,'root_inode':ROOT.stat().st_ino,'phase':'prepared','started_at':time.time(),'cpu_quota':1,'memory_gib':4,'nice':15,'gpu_access':False,'production_state_mount':False,'borrowed_cuda_read_only':str(CUDA),'source_hashes':{n:hashlib.sha256(t.encode()).hexdigest() for n,t in bundle['files'].items()}}
status=ROOT/'build-status.json'
def save():status.write_text(json.dumps(marker,indent=2)+'\n')
save();cid=None
try:
args=['docker','create','--pull=never','--name',NAME,'--label','athena-deck.build='+LABEL,'--runtime=runc','--network=bridge','--read-only','--user=65534:65534','--cpus=1','--memory=4g','--memory-swap=4g','--pids-limit=1024','--cap-drop=ALL','--security-opt=no-new-privileges',
'--mount',f'type=bind,src={ROOT}/recipe,dst=/recipe,readonly','--mount',f'type=bind,src={ROOT}/runtime,dst=/var/lib/deck/basalt-runtime','--mount',f'type=bind,src={ROOT}/tmp,dst=/tmp','--mount',f'type=bind,src={CUDA},dst=/toolchain,readonly',
'-e','HOME=/var/lib/deck/basalt-runtime/home','-e','TMPDIR=/tmp','-e','NVIDIA_VISIBLE_DEVICES=void','-e','CUDA_VISIBLE_DEVICES=','-e','OPENBLAS_NUM_THREADS=1','-e','OMP_NUM_THREADS=1','-e','PYTHONDONTWRITEBYTECODE=1','--entrypoint','nice',before['image'],'-n','15','python3','/recipe/deploy/install_basalt.py','--destination','/var/lib/deck/basalt-runtime','--nvcc','/toolchain/bin/nvcc']
cid=subprocess.check_output(args,text=True).strip();marker.update(container_id=cid,phase='building');save();print(json.dumps(marker),flush=True)
with (ROOT/'build.log').open('w') as log:
result=subprocess.run(['docker','start','--attach',cid],stdout=log,stderr=subprocess.STDOUT)
info=json.loads(subprocess.check_output(['docker','inspect',cid]))[0]
assert info['Config']['Labels'].get('athena-deck.build')==LABEL
marker.update(client_exit=result.returncode,container_exit=info['State']['ExitCode'],oom_killed=info['State']['OOMKilled'])
assert result.returncode==0 and info['State']['ExitCode']==0,'Owned build failed; inspect build.log and preserved status'
ready=json.loads((ROOT/'runtime/ready.json').read_text());assert ready['commit']==COMMIT and ready['inference_performed'] is False
assert ready['video']['available'] is True and ready['pdf_version']=='7.0.1'
marker.update(phase='built_no_model_test',ready=ready)
except BaseException as exc:
marker.update(phase='failed',error=type(exc).__name__+': '+str(exc));raise
finally:
if cid:
i=json.loads(subprocess.check_output(['docker','inspect',cid]))[0]
assert i['Config']['Labels'].get('athena-deck.build')==LABEL
if i['State']['Running']:run('docker','stop','--time','20',cid)
marker['owned_container_final_state']=json.loads(subprocess.check_output(['docker','inspect',cid]))[0]['State']
run('docker','rm',cid,stdout=subprocess.DEVNULL);marker['owned_container_removed']=True
marker['finished_at']=time.time();save();print(json.dumps(marker),flush=True)
if __name__=='__main__':main()
@@ -0,0 +1,115 @@
#!/usr/bin/env python3
"""CANDIDATE PYTHON/sandbox only: artifact checks and real upstream CPU mocks.
This never constructs a real engine or loads weights. SlowThinker and all model
answers/probabilities are explicitly scripted upstream test fixtures, not inference.
"""
import argparse
import base64
import hashlib
from http.client import HTTPConnection
import importlib
import io
import json
import os
from pathlib import Path
import re
import socket
import subprocess
import sys
import tempfile
import threading
import time
import unittest
from types import SimpleNamespace
from typing import Any
def main():
p=argparse.ArgumentParser();p.add_argument('--runtime',type=Path,required=True);p.add_argument('--cuobjdump',type=Path,required=True);p.add_argument('--result',type=Path,required=True);a=p.parse_args()
assert os.environ.get('ATHENA_BUILD_SANDBOX')=='basalt033' and os.environ.get('CUDA_VISIBLE_DEVICES')==''
runtime=a.runtime;source=runtime/'source';sys.path.insert(0,str(source));checks={}
ready=json.loads((runtime/'ready.json').read_text());assert ready['commit']=='2729e2288f59e01836ddd7fcc630810ada98995a' and ready['inference_performed'] is False
assert subprocess.check_output(['git','-C',str(source),'rev-parse','HEAD'],text=True).strip()==ready['commit']
artifacts={}
for name,key,expected in [('basalt','binary_sha256',[120]),('basalt-vision','vision_binary_sha256',[86,120])]:
binary=source/'bin'/name;actual=hashlib.sha256(binary.read_bytes()).hexdigest();assert actual==ready[key]
result=subprocess.run([a.cuobjdump,'--list-elf',binary],capture_output=True,text=True,check=True)
architectures=sorted({int(x) for x in re.findall(r'\.sm_(\d+)',result.stdout)})
assert architectures==expected,(name,architectures)
artifacts[name]={'sha256':actual,'bytes':binary.stat().st_size,'actual_elf_architectures':architectures}
checks['binary_hashes_and_actual_fatbins']=True
a.result.write_text(json.dumps({'scope':'isolated_no_gpu_candidate','phase':'artifact_checks_passed_interop_pending','artifacts':artifacts,'real_model_inference':False,'successful':False},indent=2)+'\n')
import pypdf
assert pypdf.__version__=='7.0.1';checks['pdf_import']=True
import deploy.install_basalt as recipe
video=recipe.video_libraries();assert video['available'] is True;checks['ffmpeg_abi']=True
subprocess.run([sys.executable,'-m','pip','check'],check=True,capture_output=True)
service:Any=importlib.import_module('serve.service');handler:Any=importlib.import_module('serve.handler')
original_service=service.Service;original_handler=handler.make_handler
from basalt_serve import install
install(service,handler)
SlowThinker=importlib.import_module('serve.tests.test_answer_now').SlowThinker
ChatTemplate=importlib.import_module('serve.frontend').ChatTemplate
ByteTokenizer=importlib.import_module('serve.util.text').ByteTokenizer
from basalt_worker import BasaltWorker
from endpoint import Endpoint
from inference import Scheduler
tok=ByteTokenizer();engine=SlowThinker(tok);svc=service.Service(engine,tok,ChatTemplate.from_file(source/'serve/chat_template.jinja'));svc.api_key='synthetic-native-key'
native=handler.serve(svc,host='127.0.0.1',port=0)
def http(port,path,body=None,token='synthetic-native-key',headers=None)->tuple[int,dict[str,str],Any]:
conn=HTTPConnection('127.0.0.1',port,timeout=15);conn.request('GET' if body is None else 'POST',path,None if body is None else json.dumps(body),{'Content-Type':'application/json','Authorization':'Bearer '+token,**(headers or {})});response=conn.getresponse();raw=response.read();value=raw if (body or {}).get('stream') else json.loads(raw);result=(response.status,dict(response.headers),value);conn.close();return result
ep=None
try:
status,_,props=http(native.server_port,'/props');assert status==200,(status,props)
# /props takes version from engine.info; an upstream CPU mock is not the
# compiled engine. Do not fabricate a real-engine version for this fixture.
engine_version=getattr(engine,'info',{}).get('version');assert props['basalt']['version']==(str(engine_version) if engine_version else None)
assert {'documents','logprobs','answer_now'}<=set(props['basalt']['capabilities']);checks['real_upstream_properties']=True
assert http(native.server_port,'/v1/answer_now',{'request_id':'fixture'},token='incorrect')[0]==401;assert http(native.server_port,'/telemetry',token='incorrect')[0]==401;checks['native_control_and_telemetry_auth']=True
profile={'id':'fixture','revision':1,'name':'Fixture','api_id':'basalt','kind':'chat','runnable':True,'blockers':[],'updated_at':1,'parameters':{'chat_runtime':'basalt','slots':1,'context':65536,'temperature':0,'top_p':1,'top_k':1}}
class Worker:
def __init__(self):self.profile=profile;self.state='ready';self.generation='fixture-generation';self.lock=threading.RLock();self.port=native.server_port;self.key='synthetic-native-key';self.process=SimpleNamespace(poll=lambda:None);self.backend_info=props['basalt'];self.sent=[]
def status(self):return dict(runtime='basalt',state='ready',profile_id='fixture',profile_name='Fixture',generation=self.generation,error=None,gpus=[])
def stop(self):pass
def ensure(self,p):assert p['id']=='fixture' # never load or switch any engine
def capabilities(self,p):return dict(installed=True,loaded=True,version='0.3.3',available=props['basalt']['capabilities'],capabilities=props['basalt']['capabilities'],session_affinity=True)
def connect(self):return HTTPConnection('127.0.0.1',self.port,timeout=15),self.key
answer_now=BasaltWorker.answer_now
worker=Worker();token='synthetic-deck-token-not-for-production';credentials=SimpleNamespace(read=lambda:{'api_token_hash':hashlib.sha256(token.encode()).hexdigest()});profiles=SimpleNamespace(status=lambda:{'profiles':[profile]},reasoning_budget=lambda:None);images=SimpleNamespace(status=lambda:{'job':None},stop=lambda:None)
with tempfile.TemporaryDirectory() as state:
ep=Endpoint(state,profiles,worker,Scheduler(worker),images,credentials,1)
with socket.socket() as sock:sock.bind(('127.0.0.1',0));port=sock.getsockname()[1]
ep.configure({'port':port});ep.config['enabled_profiles']=['fixture'];ep.config['responses_compat']=True;ep.start()
writer=pypdf.PdfWriter();page=writer.add_blank_page(width=200,height=100)
from pypdf.generic import DictionaryObject,NameObject,DecodedStreamObject
font=DictionaryObject({NameObject('/Type'):NameObject('/Font'),NameObject('/Subtype'):NameObject('/Type1'),NameObject('/BaseFont'):NameObject('/Helvetica')});page[NameObject('/Resources')]=DictionaryObject({NameObject('/Font'):DictionaryObject({NameObject('/F1'):font})});content=DecodedStreamObject();content.set_data(b'BT /F1 10 Tf 10 30 Td (SYNTHETIC_PDF_TEXT) Tj ET');page[NameObject('/Contents')]=content;pdf=io.BytesIO();writer.write(pdf)
for responses in (False,True):
engine.thinking.clear();out:dict[str,Any]={};alias='fixture-client-'+str(responses)
part={'type':'input_file','filename':'fixture.pdf','file_data':'data:application/pdf;base64,'+base64.b64encode(pdf.getvalue()).decode(),'pages':'1'}
body={'model':'basalt','stream':True,**({'input':[{'role':'user','content':[{'type':'input_text','text':'2+2?'},part]}],'max_output_tokens':20000} if responses else {'messages':[{'role':'user','content':[{'type':'text','text':'2+2?'},{'type':'file','file':{k:v for k,v in part.items() if k!='type'}}]}],'max_tokens':20000})}
def run():out['reply']=http(port,'/v1/responses' if responses else '/v1/chat/completions',body,token,{'X-Client-Request-Id':alias,'X-Session-Id':'synthetic-session'})
thread=threading.Thread(target=run,daemon=True);thread.start();assert engine.thinking.wait(8)
status,_,control=http(port,'/v1/answer_now',{'request_id':alias},token);assert status==200 and control['state'] in ('thinking','prompt');thread.join(10);assert not thread.is_alive()
code,headers,stream=out['reply'];assert code==200 and headers.get('X-Request-Id')
events=[json.loads(line[5:].strip()) for line in stream.splitlines() if line.startswith(b'data:') and line[5:].strip()!=b'[DONE]']
# A streaming response may emit one byte/token per JSON event. Compare the
# assembled answer, never a purported contiguous string in raw SSE bytes.
answer=''.join(e.get('delta','') for e in events if e.get('type')=='response.output_text.delta') if responses else ''.join(c.get('delta',{}).get('content') or '' for e in events for c in e.get('choices',[]))
assert answer==SlowThinker.ANSWER,answer
assert 'SYNTHETIC_PDF_TEXT' in tok.decode(engine.prompts[-1]);checks['deck_to_real_upstream_'+('responses' if responses else 'chat')]=True
assert http(port,'/v1/answer_now',{'request_id':alias},token)[0]==409
_,_,telemetry=http(native.server_port,'/telemetry');assert telemetry['metrics']['requests_completed_total']>=2;assert 'SYNTHETIC_PDF_TEXT' not in json.dumps(telemetry);checks['numeric_telemetry_preserved']=True
ep.close();ep=None
finally:
if ep:ep.close()
native.shutdown();native.server_close()
service.Service=original_service;handler.make_handler=original_handler
sys.modules.pop('serve.tests.test_answer_now',None)
# Run upstream's own server fixtures: their engines and token probabilities are scripted.
started=time.monotonic();suite=unittest.defaultTestLoader.discover(str(source/'serve/tests'),pattern='test_*.py',top_level_dir=str(source));result=unittest.TextTestRunner(verbosity=1).run(suite)
value={'scope':'isolated_no_gpu_candidate','commit':ready['commit'],'artifacts':artifacts,'checks':checks,'upstream_mock_engine_version':engine_version,'ffmpeg':video,'upstream_tests':{'tests':result.testsRun,'failures':len(result.failures),'errors':len(result.errors),'skips':len(result.skipped),'seconds':round(time.monotonic()-started,3)},'real_model_inference':False,'nvdec_functional_test':False,'native_debian_restore':False,'successful':result.wasSuccessful() and all(checks.values())}
a.result.write_text(json.dumps(value,indent=2)+'\n');print(json.dumps(value),flush=True);return 0 if value['successful'] else 1
if __name__=='__main__':raise SystemExit(main())
@@ -0,0 +1,9 @@
{
"manifest": "https://developer.download.nvidia.com/compute/cuda/redist/redistrib_13.0.0.json",
"url": "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cuobjdump/linux-x86_64/cuda_cuobjdump-linux-x86_64-13.0.39-archive.tar.xz",
"version": "13.0.39",
"archive_sha256": "2385804b0a628b98b3ed96a19c803143d5c2e2fcc5139f633450862cf7755d65",
"archive_bytes": 244840,
"member": "cuda_cuobjdump-linux-x86_64-13.0.39-archive/bin/cuobjdump",
"purpose": "Independent fatbin inspection only; no driver or host installation."
}
@@ -0,0 +1,32 @@
{
"sampled_at": 1794570078.5519354,
"container_id": "788723c2fc2f4cae707147d1d339294546bce9ec6011c0fa16dbb2a13ad10976",
"image": "sha256:0a358dd687a415faf26cea2d73160654fb9b2e56ad68c7013bef52bc166fed33",
"started": "2026-11-09T16:02:55.751847414Z",
"health": "healthy",
"basalt_version": "0.3.0",
"binary_matches_marker": true,
"basalt_pids": [
3537748
],
"gpu_pids": [
3537711,
3538175,
3538223,
3537748
],
"protected": {
"profiles.json": "2d7602a18d08b0916ebd6ed794ff1246d9766aab02e26047e862602233bb775c",
"endpoint.json": "98181e6b1d254f8507aee15e4135ebeaa7c409d6cca2edd030ff25b9f51b1a61",
"audio-policy.json": "f48dedea718968c00c0647ca90c1402bdabac9ce600dbeddc495817680527a3f",
"cpu-partition.json": "836a97564094f95850c6fa0fd3776e164e7aeff2bf4bb8a61d43ea4182cfaaec",
"reasoning-budget.json": "4884a379adf2f888415041b81ef55a01a2c22ef7a41ca1554460f410bec5cf0c"
},
"same_container_image_start": true,
"protected_unchanged": true,
"original_text_pid_preserved": true,
"sandbox": {
"container_absent": true,
"running": false
}
}
@@ -0,0 +1,54 @@
{
"scope": "isolated_no_gpu_candidate",
"commit": "2729e2288f59e01836ddd7fcc630810ada98995a",
"artifacts": {
"basalt": {
"sha256": "9e89333cd2f12eee69a5e1535433631155ae92dc089774ad6c8f99e9b62c0c46",
"bytes": 154288304,
"actual_elf_architectures": [
120
]
},
"basalt-vision": {
"sha256": "e75b4f529acf7623c8fede68847052c097a325ca9f808d88cea4c061ed15b798",
"bytes": 915648,
"actual_elf_architectures": [
86,
120
]
}
},
"checks": {
"binary_hashes_and_actual_fatbins": true,
"pdf_import": true,
"ffmpeg_abi": true,
"real_upstream_properties": true,
"native_control_and_telemetry_auth": true,
"deck_to_real_upstream_chat": true,
"deck_to_real_upstream_responses": true,
"numeric_telemetry_preserved": true
},
"upstream_mock_engine_version": null,
"ffmpeg": {
"available": true,
"ffmpeg_major": 6,
"libraries": {
"avcodec": "libavcodec.so.60",
"avformat": "libavformat.so.60",
"avutil": "libavutil.so.58",
"swscale": "libswscale.so.7"
},
"abi_only": true
},
"upstream_tests": {
"tests": 1102,
"failures": 0,
"errors": 0,
"skips": 6,
"seconds": 479.532
},
"real_model_inference": false,
"nvdec_functional_test": false,
"native_debian_restore": false,
"successful": true
}
@@ -0,0 +1,33 @@
{
"deck_sha256": {
"api_compat.py": "729eef3614688fb06ef2f64409c31be7672c0f92fa66c84887e3262c75341cae",
"basalt_runtime.py": "e3078aa2a7aa2052a9ffcbcab056a4d134ed156e427ee2cef0679a91e935e701",
"basalt_serve.py": "03863add9614e9cc480171a45945a660ac49a21d12d8f33059971bb9e71776cb",
"basalt_sources.json": "e2c0ca28dce89aea30b7ba0be4d05641687938fe9b08e485830c4635bb1ae30f",
"basalt_telemetry.py": "e6585bf0f9b102dc579704f790985707746b6dab4ffd37233153f0c1064d2054",
"basalt_tuning.py": "f2585dab9581ce8c8b3712c4ee9f9a98d5b58d41ce11f9f8ab5b17f429e0dfdf",
"basalt_worker.py": "0df07b59c85136bacaf95a87095867796f1d124a8df895d3a92406dc4057e9b7",
"chat_control.py": "5efad2c742ba893e22d926fe38cfe31c16eb0e35b1accd2556899ad348bc7923",
"chat_media.py": "7d3e6954cd6f4140a97b3991edeb266c5cac19cb781cb9927647c0f21992c06c",
"deploy/install_basalt.py": "7e81efe44224707c5b3b5417382381113b263bf6532060f8c80b4e1eed4748e5",
"endpoint.py": "22614fce51e306a3e312485fbb103863ca702dfa6361280d84beb4f4fa091684",
"responses_compat.py": "08e2fdaeb5b1b670a390dc8f2330ebc0825410d0b17d911e9c9f3f602366640f",
"strata_worker.py": "b20b274c97c34641f2c2a0837207a3e6d371098ee5c74f084ce053039b76db3b"
},
"check_sha256": "a94b840480f007e92cb03230b63ff667f6a431304554b059e03a6db95d403517",
"cuobjdump": {
"manifest": "https://developer.download.nvidia.com/compute/cuda/redist/redistrib_13.0.0.json",
"url": "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cuobjdump/linux-x86_64/cuda_cuobjdump-linux-x86_64-13.0.39-archive.tar.xz",
"version": "13.0.39",
"archive_sha256": "2385804b0a628b98b3ed96a19c803143d5c2e2fcc5139f633450862cf7755d65",
"archive_bytes": 244840,
"member": "cuda_cuobjdump-linux-x86_64-13.0.39-archive/bin/cuobjdump",
"purpose": "Independent fatbin inspection only; no driver or host installation."
},
"checker_type_only_update": {
"executed_source_sha256": "a94b840480f007e92cb03230b63ff667f6a431304554b059e03a6db95d403517",
"current_source_sha256": "1725c41ef6f1c778690a05755a8b264c6a274c42ff2ec08974d1f5f254245872",
"type_annotations_only": true,
"semantic_bytecode_equal": true
}
}
@@ -0,0 +1,12 @@
cmake==3.31.6
Jinja2==3.1.6
MarkupSafe==3.0.3
ninja==1.11.1.4
numpy==2.5.3
pillow==12.3.0
pip==24.0
psutil==7.2.2
pypdf==7.0.1
PyYAML==6.0.3
regex==2026.9.10
tqdm==4.70.1
@@ -0,0 +1,46 @@
{
"base_commit": "584a884cc909f17be06314751fe24a78a8160077",
"root_suite_source_sha256": {
"api_compat.py": "729eef3614688fb06ef2f64409c31be7672c0f92fa66c84887e3262c75341cae",
"basalt_runtime.py": "e3078aa2a7aa2052a9ffcbcab056a4d134ed156e427ee2cef0679a91e935e701",
"basalt_serve.py": "03863add9614e9cc480171a45945a660ac49a21d12d8f33059971bb9e71776cb",
"basalt_sources.json": "e2c0ca28dce89aea30b7ba0be4d05641687938fe9b08e485830c4635bb1ae30f",
"basalt_tuning.py": "f2585dab9581ce8c8b3712c4ee9f9a98d5b58d41ce11f9f8ab5b17f429e0dfdf",
"basalt_worker.py": "0df07b59c85136bacaf95a87095867796f1d124a8df895d3a92406dc4057e9b7",
"chat-test-ui.js": "cb299f33c527535ebdbd9f404506f32ca1b47fd4d0a4a1cba815a7c32cd7773b",
"chat_control.py": "5efad2c742ba893e22d926fe38cfe31c16eb0e35b1accd2556899ad348bc7923",
"chat_media.py": "7d3e6954cd6f4140a97b3991edeb266c5cac19cb781cb9927647c0f21992c06c",
"chat_test.py": "02754ae25f8f7e6ad14785f7e2102dbb818f4a5a118abf13b47bfbba779325ab",
"deploy/install.py": "e342ddfdf9fa77492c568342e68024e5864e09e68ab3c77b5ca61390b3f99ad5",
"deploy/install_basalt.py": "7e81efe44224707c5b3b5417382381113b263bf6532060f8c80b4e1eed4748e5",
"endpoint.py": "22614fce51e306a3e312485fbb103863ca702dfa6361280d84beb4f4fa091684",
"responses_compat.py": "08e2fdaeb5b1b670a390dc8f2330ebc0825410d0b17d911e9c9f3f602366640f",
"server.py": "c73206dbac9ff21cdfb266b67d678a5e4aec79fa92ffbb918f8273df5c01478b",
"strata_worker.py": "b20b274c97c34641f2c2a0837207a3e6d371098ee5c74f084ce053039b76db3b",
"test_basalt.py": "7fbff965897e488a1a51e605a4a563b8cedb7842b1b802015243fff1e0aaf9bc",
"test_basalt033_integration.py": "eac5d60325a41527c42ca4bd80eca2f56fafcf8477517920c79ee91551e36149",
"test_basalt_tuning.py": "7bf7c8b1f5f42170a1e93b90bd1b8af1c1ff87f6b837ec94e6108288ee96da4a",
"test_chat_control.py": "fa5f45efb07353a49896323094ac6db2e64ff5fd71c8c73241c321d1671c18c6",
"test_chat_media.py": "42f9c39a52ad6f138be5d7c64b47cce209fc6e5aa01ef8dbf20b31a758766c37",
"test_inference.py": "5918f4b7ac501479711dd0364bf7aa8c530578bec204058afcedde6911dfd173",
"test_legacy_cleanup.py": "b3590865f87f0a9bf654663561f84fb5c174cdc74e2ef4108cbc1b40d914f11d",
"test_server.py": "973981dc80776937879ca354a3f440d3f999751551bd3755ed924370d1637925",
"test_stimmatelier_proxy.py": "9ae213922a121096c0edbea565f17a65fb183744f2943370229bd8babfbade39"
},
"maintenance_source_sha256": {
"docs/maintenance/basalt-033-staged-2026-11-13/acceptance.py": "8b999c7b3d8338898bfbf4c8fdeef11a9f58b4eaa8978e821cd8d46ff8c44ee9",
"docs/maintenance/basalt-033-staged-2026-11-13/build_host.py": "a6998be89662f8cd5d1c70bd69725ec2ede9d79cf372f8b8698d2dde0710fa0d",
"docs/maintenance/basalt-033-staged-2026-11-13/check_upstream.py": "1725c41ef6f1c778690a05755a8b264c6a274c42ff2ec08974d1f5f254245872",
"docs/maintenance/basalt-033-staged-2026-11-13/python-lock.txt": "2dcb15488a68e15eaa3c24c350887a536dc1dfce3919009f5c9c173883bd575c",
"docs/maintenance/basalt-033-staged-2026-11-13/test_verify_host.py": "6ccfbc1fe099e62249a705190374abe60b510c8cda2616f3f46990d0a86f6612",
"docs/maintenance/basalt-033-staged-2026-11-13/ui_mock.py": "3eb0b859eb17abc4f394dda008f025a4345e1ed32080d151c834e4cf133b9241",
"docs/maintenance/basalt-033-staged-2026-11-13/verify_host.py": "4d18e5ce64ab5aca61c451b14397ae9ac83eb64ad08c16d71ffe2a5f3194ed99",
"docs/maintenance/basalt-033-staged-2026-11-13/verify_offline.py": "6013b0dcd42ed40dae33cb47f4e7f979a1d22e48b1bba36cc62e0f6be5771313"
},
"evidence_sha256": {
"build-result.json": "03b8442484d07658f10417e1d2629979f961568d0058941e5fa9d441154a58f5",
"native-checks.json": "f12b385add37782e2fb3de7a029f5730425907659cad5952df2fa312da5315b4",
"native-inputs.json": "4ba9a4294f614807fe702e4847b007a34ecce15d824d6a13e1bb100af44bdde3",
"live-preservation.json": "54234e893b913a06fede12398a1e1808419a0b8d1b7b23c61de06b68ad035828"
}
}
@@ -0,0 +1,83 @@
#!/usr/bin/env python3
"""NAS-only unit tests for the operator helper; Docker is never executed."""
import ast
import contextlib
import io
import json
from pathlib import Path
import subprocess
import tempfile
from types import SimpleNamespace
import unittest
class HostVerifierTests(unittest.TestCase):
def setUp(self):
self.tree=ast.parse(Path(__file__).with_name('verify_host.py').read_text())
self.main=next(n for n in self.tree.body if isinstance(n,ast.FunctionDef) and n.name=='main')
self.assignment=next(n for n in self.main.body if isinstance(n,ast.Assign) and any(isinstance(t,ast.Name) and t.id=='command' for t in n.targets))
self.block=next(n for n in self.main.body if isinstance(n,ast.Try))
def command(self,folder):
namespace={'ROOT':folder,'folder':folder,'container_name':'synthetic-owned-check','LABEL':'synthetic-verifier','status':{'borrowed_cuda_read_only':str(folder/'cuda'),'image':'synthetic-image-only'}}
exec(compile(ast.Module(body=[self.assignment],type_ignores=[]),'<actual-helper-command>','exec'),namespace)
return namespace['command']
def test_explicit_lifecycle_does_not_mix_auto_and_manual_removal(self):
self.assertNotIn('--rm',self.command(Path('synthetic-root')))
def test_bounded_budget_includes_setup_and_completed_suite(self):
timeouts=[ast.literal_eval(k.value) for n in ast.walk(self.block) if isinstance(n,ast.Call) for k in n.keywords if k.arg=='timeout']
self.assertEqual(len(timeouts),1)
observed=json.loads(Path(__file__).with_name('native-checks.json').read_text())['upstream_tests']['seconds']
self.assertGreaterEqual(timeouts[0],observed+60)
self.assertLessEqual(timeouts[0],900)
def exercise(self,*,timeout=False,foreign=False):
with tempfile.TemporaryDirectory(prefix='verifier-unit-') as name:
folder=Path(name);command=self.command(folder);state={'exists':False,'running':False};calls=[]
def run(args,**kwargs):
calls.append(list(args))
if args==command:
state.update(exists=True,running=timeout)
if timeout:raise subprocess.TimeoutExpired(args,kwargs['timeout'])
if '--rm' in args:state['exists']=False
return subprocess.CompletedProcess(args,0)
if args[:2]==['docker','inspect']:
value={'Id':'synthetic-owned-id','Config':{'Labels':{'athena-deck.build':'foreign' if foreign else 'synthetic-verifier'}},'State':{'Running':state['running']}}
return subprocess.CompletedProcess(args,0 if state['exists'] else 1,stdout=json.dumps([value]) if state['exists'] else '')
if args[:2]==['docker','stop']:
state['running']=False
if '--rm' in command:state['exists']=False
return subprocess.CompletedProcess(args,0)
if args[:2]==['docker','rm']:
if not state['exists']:raise subprocess.CalledProcessError(1,args)
state['exists']=False
return subprocess.CompletedProcess(args,0)
raise AssertionError('unexpected operator action')
namespace={'folder':folder,'command':command,'container_name':'synthetic-owned-check','LABEL':'synthetic-verifier','json':json,'subprocess':SimpleNamespace(run=run,STDOUT=subprocess.STDOUT,DEVNULL=subprocess.DEVNULL)}
error=None
try:
with contextlib.redirect_stdout(io.StringIO()):exec(compile(ast.Module(body=[self.block],type_ignores=[]),'<actual-helper-lifecycle>','exec'),namespace)
except BaseException as exc:error=exc
return state,calls,error
def test_timeout_is_not_masked_by_double_removal(self):
state,calls,error=self.exercise(timeout=True)
self.assertIsInstance(error,subprocess.TimeoutExpired)
self.assertFalse(state['exists'])
self.assertEqual(sum(c[:2]==['docker','rm'] for c in calls),1)
def test_success_removes_owned_container(self):
state,calls,error=self.exercise()
self.assertIsNone(error)
self.assertFalse(state['exists'])
def test_foreign_label_is_never_stopped_or_removed(self):
state,calls,error=self.exercise(timeout=True,foreign=True)
self.assertIsInstance(error,AssertionError)
self.assertTrue(state['exists'])
self.assertFalse(any(c[:2] in (['docker','stop'],['docker','rm']) for c in calls))
if __name__=='__main__':unittest.main(verbosity=2)
@@ -0,0 +1,60 @@
#!/usr/bin/env python3
"""NAS development only: bounded loopback UI fixture; never calls a real backend."""
import argparse
import json
from pathlib import Path
import sys
import time
from http.server import BaseHTTPRequestHandler,ThreadingHTTPServer
from urllib.parse import urlsplit,parse_qs
ROOT=Path(__file__).resolve().parents[3]
sys.path.insert(0,str(ROOT))
from chat_media import normalize_messages
def main():
p=argparse.ArgumentParser();p.add_argument('--port',type=int,default=0);p.add_argument('--duration',type=int,default=900);a=p.parse_args()
assert 1<=a.duration<=1800
profile=dict(id='fixture',api_id='fixture',name='Basalt · synthetisch',kind='chat',runnable=True,blockers=[],parameters=dict(chat_runtime='basalt',context=262144,slots=1,vision_projector='fixture'))
legacy=dict(profile,id='legacy',api_id='legacy',name='Alte Laufzeit · synthetisch',parameters=dict(chat_runtime='llama',context=8192,slots=1))
state={'job':None,'calls':[],'uploads':[]}
class Handler(BaseHTTPRequestHandler):
def log_message(self,format,*args):pass
def send(self,value,status=200,mime='application/json'):
raw=value if isinstance(value,bytes) else json.dumps(value,ensure_ascii=False).encode();self.send_response(status);self.send_header('Content-Type',mime);self.send_header('Content-Length',str(len(raw)));self.send_header('Cache-Control','no-store');self.end_headers();self.wfile.write(raw)
def do_GET(self):
q=urlsplit(self.path);path=q.path
if path=='/':return self.send(b'<!doctype html><meta charset="utf-8"><title>Deck 0.3.3 UI mock</title><link rel="stylesheet" href="/style.css"><main><p role="alert"><strong>MOCK ONLY: Keine Verbindung zu Athena, keine Modellinferenz.</strong></p><div id="fixture-root"></div></main><script src="/chat-test-ui.js"></script><script>window.fixtureErrors=[];window.addEventListener("error",e=>fixtureErrors.push(e.message));document.getElementById("fixture-root").innerHTML=ChatTestUI.html();ChatTestUI.bind();</script>',mime='text/html; charset=utf-8')
if path in ('/chat-test-ui.js','/style.css'):return self.send((ROOT/path[1:]).read_bytes(),mime='text/javascript' if path.endswith('.js') else 'text/css')
if path=='/fixture/state':return self.send(state)
if path=='/api/v1/profiles':return self.send({'profiles':[profile,legacy]})
if path=='/api/v1/hardware':return self.send({'gpus':[]})
if path=='/api/v1/chat-tests/capabilities':
old=parse_qs(q.query).get('profile_id',[''])[0]=='legacy';features=[] if old else ['answer_now','documents','video','logprobs']
return self.send(dict(runtime='llama' if old else 'basalt',version=None if old else '0.3.3',installed=True,loaded=not old,available=features,capabilities=features,session_affinity=not old))
if path=='/api/v1/chat-tests':return self.send(dict(job=state['job'],worker=dict(runtime='basalt',state='ready',phase='Synthetischer Worker',profile_id='fixture',profile_name='UI fixture',generation='fixture',memory_plan=dict(runtime='basalt',context=262144,slots=1,kv='int8',experts='resident',gpus=[])),scheduler=dict(active_requests=int(bool(state['job'] and state['job']['state']=='running')),waiting_requests=0,switching=False)))
return self.send({'error':'Keine Fixture-Route.'},404)
def do_POST(self):
length=int(self.headers.get('Content-Length',0))
if not 0<length<=64*1024**2:return self.send({'error':'Fixture-Limit.'},413)
data=json.loads(self.rfile.read(length));state['calls'].append({'path':self.path,'csrf_header':self.headers.get('X-Athena-Deck')})
if self.path=='/api/v1/chat-tests/start':
try:_,info=normalize_messages(data['messages'],profile,('documents','video'))
except ValueError as exc:return self.send({'error':str(exc)},400)
state['uploads'].append(data);job=dict(id='fixture-job-'+str(len(state['uploads'])),state='running',phase='Synthetisches Denken',profile_id='fixture',started_at=time.time(),answer='',reasoning='Synthetisches Denken',request_id='fixture-request',can_answer_now=True,answer_now_requested=False,timings={},usage={},logprobs=[]);state['job']=job;return self.send(job)
if self.path in ('/api/v1/chat-tests/answer-now','/api/v1/chat-tests/cancel'):
job=state['job']
if not job or job['state']!='running' or data.get('job_id')!=job['id']:return self.send({'error':'Staler Testauftrag.'},409)
job.update(state='complete' if self.path.endswith('answer-now') else 'cancelled',phase='Synthetisch beendet',finished_at=time.time(),can_answer_now=False,answer='Synthetische Antwort',logprobs=[{'token':'synthetisch','logprob':-.1,'top_logprobs':[]}]);return self.send({'state':'thinking'})
if self.path=='/api/v1/chat-tests/unload':return self.send({'mock_only':True})
return self.send({'error':'Keine Fixture-Route.'},404)
server=ThreadingHTTPServer(('127.0.0.1',a.port),Handler);server.timeout=.5
print(json.dumps({'mock_only':True,'url':'http://127.0.0.1:'+str(server.server_port),'duration':a.duration}),flush=True)
deadline=time.monotonic()+a.duration
try:
while time.monotonic()<deadline:server.handle_request()
finally:server.server_close()
if __name__=='__main__':main()
@@ -0,0 +1,86 @@
{
"scope": "built_runtime_and_implemented_not_activated",
"root_index_suite": {
"scope": "synthetic_root_suite",
"tests": 827,
"failures": 0,
"errors": 0,
"skips": 0,
"expected_failures": 0,
"unexpected_successes": 0,
"blocked_io": [],
"seconds": 117.002,
"successful": true,
"model_inference": false,
"process_exit": 0,
"process_id": "proc_72ae815b8b18"
},
"upstream_cpu_mock_suite": {
"tests": 1102,
"failures": 0,
"errors": 0,
"skips": 6,
"seconds": 479.532
},
"upstream_gates": {
"binary_hashes_and_actual_fatbins": true,
"pdf_import": true,
"ffmpeg_abi": true,
"real_upstream_properties": true,
"native_control_and_telemetry_auth": true,
"deck_to_real_upstream_chat": true,
"deck_to_real_upstream_responses": true,
"numeric_telemetry_preserved": true
},
"browser_mock": {
"passed": 11,
"total": 11,
"source": "Recorded Browser Use checks in this task session; synthetic backend, real new UI",
"real_model": false
},
"operator_helper_unit": {
"tests": 5,
"failures": 0,
"errors": 0,
"initial_red_failures": 3,
"docker_executed": false
},
"native_controller_attempt3": {
"successful": false,
"native_result_successful": true,
"failure": "480-second overall timeout followed by auto/manual-remove race",
"sandbox_absence_read_back": true,
"local_fix": "explicit manual lifecycle and 900-second overall bound",
"fixed_controller_rerun_on_athena": false
},
"acceptance_self_test": {
"synthetic_fixtures": {
"png": 168,
"pdf": 588,
"video": 1761
},
"credentials_resolved": false,
"network_requests": 0,
"model_inference": false
},
"acceptance_no_go_exit": 2,
"video_fixture_metadata": {
"programs": [],
"stream_groups": [],
"streams": [
{
"codec_name": "h264",
"width": 64,
"height": 64
}
],
"format": {
"duration": "2.000000"
}
},
"production_preserved": true,
"real_model_inference": false,
"nvdec_functional_test": false,
"native_debian_restore": false,
"root_code_hashes_still_match_tested_index": true
}
@@ -0,0 +1,54 @@
#!/usr/bin/env python3
"""ATHENA HOST only: verify the owned candidate with no GPU/production mounts."""
import argparse
import hashlib
import io
import json
import os
from pathlib import Path
import subprocess
import sys
import tarfile
import urllib.request
ROOT=Path('/opt/athena-deck-dev/basalt-033-candidate-2729e2288f59')
NAME='athena-basalt033-check-20261113'
LABEL='basalt033-check-20261113'
FILES={'api_compat.py','basalt_runtime.py','basalt_serve.py','basalt_sources.json','basalt_worker.py','basalt_tuning.py','basalt_telemetry.py','chat_media.py','chat_control.py','endpoint.py','responses_compat.py','strata_worker.py','deploy/install_basalt.py'}
def main():
parser=argparse.ArgumentParser();parser.add_argument('--attempt',type=int,default=1);args=parser.parse_args();assert 1<=args.attempt<=3
container_name=NAME+'-'+str(args.attempt)
bundle=json.load(sys.stdin);assert set(bundle['files'])==FILES
status=json.loads((ROOT/'build-status.json').read_text());assert status['phase']=='built_no_model_test' and status['owned_container_removed'] is True
folder=ROOT/('verification-'+str(args.attempt));assert not folder.exists();folder.mkdir(mode=0o700);os.chown(folder,65534,65534)
for name in ('deck','deck/deploy','tools','out','tmp'):
p=folder/name;p.mkdir(mode=0o700);os.chown(p,65534,65534)
for name,text in {**{'deck/'+k:v for k,v in bundle['files'].items()},'check_upstream.py':bundle['check']}.items():
p=folder/name;p.write_text(text);p.chmod(0o600);os.chown(p,65534,65534)
lock=bundle['cuobjdump'];assert lock['archive_sha256']=='2385804b0a628b98b3ed96a19c803143d5c2e2fcc5139f633450862cf7755d65' and lock['url'].startswith('https://developer.download.nvidia.com/compute/cuda/redist/')
with urllib.request.urlopen(lock['url'],timeout=60) as response:archive=response.read(1024**2)
assert len(archive)==lock['archive_bytes'] and hashlib.sha256(archive).hexdigest()==lock['archive_sha256']
with tarfile.open(fileobj=io.BytesIO(archive),mode='r:xz') as tar:
member=tar.getmember(lock['member']);assert member.isfile() and member.size<16*1024**2
stream=tar.extractfile(member);assert stream is not None
with stream:binary=stream.read()
p=folder/'tools/cuobjdump';p.write_bytes(binary);p.chmod(0o700);os.chown(p,65534,65534)
(folder/'inputs.json').write_text(json.dumps({'deck_sha256':{n:hashlib.sha256(t.encode()).hexdigest() for n,t in bundle['files'].items()},'check_sha256':hashlib.sha256(bundle['check'].encode()).hexdigest(),'cuobjdump':lock},indent=2)+'\n')
command=['docker','run','--pull=never','--name',container_name,'--label','athena-deck.build='+LABEL,'--runtime=runc','--network=none','--read-only','--user=65534:65534','--cpus=1','--memory=4g','--memory-swap=4g','--pids-limit=1024','--cap-drop=ALL','--security-opt=no-new-privileges',
'--mount',f'type=bind,src={ROOT}/runtime,dst=/candidate/runtime,readonly','--mount',f'type=bind,src={folder}/deck,dst=/probe/deck,readonly','--mount',f'type=bind,src={folder}/tools,dst=/probe/tools,readonly','--mount',f'type=bind,src={folder}/check_upstream.py,dst=/probe/check_upstream.py,readonly','--mount',f'type=bind,src={folder}/out,dst=/out','--mount',f'type=bind,src={folder}/tmp,dst=/tmp','--mount',f'type=bind,src={status["borrowed_cuda_read_only"]},dst=/toolchain,readonly',
'-e','HOME=/tmp','-e','TMPDIR=/tmp','-e','NVIDIA_VISIBLE_DEVICES=void','-e','CUDA_VISIBLE_DEVICES=','-e','PYTHONDONTWRITEBYTECODE=1','-e','OPENBLAS_NUM_THREADS=1','-e','OMP_NUM_THREADS=1','-e','ATHENA_BUILD_SANDBOX=basalt033','-e','PYTHONPATH=/probe/deck:/app','-e','LD_LIBRARY_PATH=/toolchain/lib64:/toolchain/lib','--entrypoint','/candidate/runtime/venv/bin/python',status['image'],'-B','/probe/check_upstream.py','--runtime','/candidate/runtime','--cuobjdump','/probe/tools/cuobjdump','--result','/out/native-checks.json']
try:
with (folder/'check.log').open('w') as log:result=subprocess.run(command,stdout=log,stderr=subprocess.STDOUT,timeout=900)
finally:
leftover=subprocess.run(['docker','inspect',container_name],capture_output=True,text=True)
if leftover.returncode==0:
c=json.loads(leftover.stdout)[0];assert c['Config']['Labels'].get('athena-deck.build')==LABEL
if c['State']['Running']:subprocess.run(['docker','stop','--time','10',container_name],check=True,stdout=subprocess.DEVNULL)
subprocess.run(['docker','rm',container_name],check=True,stdout=subprocess.DEVNULL)
print(json.dumps({'exit':result.returncode,'log':str(folder/'check.log'),'result':str(folder/'out/native-checks.json')}),flush=True)
return result.returncode
if __name__=='__main__':raise SystemExit(main())
@@ -0,0 +1,54 @@
#!/usr/bin/env python3
"""NAS/project test Python only: synthetic root suite with explicit I/O guards.
No production, VPN access, remote SSH, external sockets or model acceptance.
Can run against a staged-index export using --root.
"""
import argparse
import json
import os
from pathlib import Path
import socket
import sys
import time
import unittest
def main():
p=argparse.ArgumentParser();p.add_argument('--root',type=Path,default=Path.cwd());p.add_argument('--result',type=Path,required=True);a=p.parse_args()
root=a.root.absolute();scratch=Path(os.environ['TMPDIR']).absolute();profile=Path('/opt/data/profiles/athena-deck')
blocked=[]
def deny(label):
blocked.append(label);raise PermissionError('Offline test guard: '+label)
def path_check(value):
if not isinstance(value,(str,bytes,os.PathLike)):return
value=os.fsdecode(value);parts=Path(value).parts
if 'vpn.auth' in parts or 'vpn' in parts or any(x in parts for x in ('OpenVPN-KIT','GluetunVPN')):deny('prohibited path')
path=os.path.abspath(value)
if path.startswith(('/etc/wireguard/','/opt/athena-deck-dev/runtime/','/var/lib/deck/','/mnt/nvme-storage/')):deny('production/private path')
if path.startswith('/opt/data/profiles/') and not path.startswith(str(profile)+'/'):deny('other profile path')
def audit(event,args):
if event in ('open','os.listdir','os.scandir','os.remove','os.rmdir','os.mkdir','os.chmod') and args:path_check(args[0])
elif event in ('os.rename','os.link','os.symlink'):
for value in args[:2]:path_check(value)
elif event=='socket.connect':
address=args[1]
if isinstance(address,tuple):
if address[0] not in ('127.0.0.1','::1') or address[1] in (8108,8120):deny('non-fixture socket')
elif isinstance(address,str) and not os.path.abspath(address).startswith(str(scratch)+'/'):deny('non-fixture Unix socket')
elif event=='socket.getaddrinfo' and args[0] not in (None,'localhost','127.0.0.1','::1'):deny('external name lookup')
elif event=='subprocess.Popen':
argv=args[1]
if isinstance(argv,(tuple,list)):
if argv and Path(str(argv[0])).name in ('ssh','athena-ssh','docker','podman'):deny('remote/container command')
for value in argv:
if isinstance(value,str) and ('/' in value or value=='vpn.auth') and not '\n' in value:path_check(value)
sys.addaudithook(audit);sys.path.insert(0,str(root));os.chdir(root)
started=time.monotonic();suite=unittest.defaultTestLoader.discover(str(root),pattern='test_*.py',top_level_dir=str(root));result=unittest.TextTestRunner(verbosity=1).run(suite)
value={'scope':'synthetic_root_suite','tests':result.testsRun,'failures':len(result.failures),'errors':len(result.errors),'skips':len(result.skipped),'expected_failures':len(result.expectedFailures),'unexpected_successes':len(result.unexpectedSuccesses),'blocked_io':blocked,'seconds':round(time.monotonic()-started,3),'successful':result.wasSuccessful() and not blocked,'model_inference':False}
a.result.parent.mkdir(parents=True,exist_ok=True);a.result.write_text(json.dumps(value,indent=2)+'\n');print(json.dumps(value),flush=True)
return 0 if value['successful'] else 1
if __name__=='__main__':raise SystemExit(main())