Job 1788160187818

Command: python -c "from pathlib import Path;import hashlib,json;root=Path(r'C:\Users\ash\Documents\Codex\2026-08-26\LaptopBridge-DEV');cands=[x for x in root.rglob('*') if x.is_file() and any(k in x.name.lower() for k in ('restart','launcher','start_dev','dev_bridge'))];out=[];[(out.append({'path':str(x),'size':x.stat().st_size,'sha256':hashlib.sha256(x.read_bytes()).hexdigest(),'preview':x.read_text(encoding='utf-8',errors='replace')[:2500] if x.suffix.lower() in ('.ps1','.py','.cmd','.bat') else ''})) for x in cands if x.stat().st_size<200000];print(json.dumps(out,separators=(',',':')))"
Directory: projects
Status: SUCCESS
Exit code: 0

Cancel Job Rerun Command Refresh

[{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\DEV_BRIDGE.md","size":530,"sha256":"f3f3de3facdd296321555f84250ae8f309ee4503b7b63092e50462dd0152ac82","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\dev_bridge_launcher.py","size":214,"sha256":"660809211967867be00d8e550274e776aa316def8cc20dc43e02223b1d386034","preview":"import os, runpy\nfrom pathlib import Path\nos.environ[\"CHATGPT_BRIDGE_DRIVE_ROOT\"] = r\"G:\\My Drive\\ChatGPT Bridge Data\\dev-bridge\"\nrunpy.run_path(str(Path(__file__).with_name(\"bridge.py\")), run_name=\"__main__\")\n"},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\restart_bridge_fast_lane.py","size":2094,"sha256":"e16988f565fc77025c46857f6802e96f38f812335fd4d3c4baca7bbf01402849","preview":"from pathlib import Path\nimport hashlib, json, os, subprocess, sys, time\nimport psutil\nimport urllib.request\n\nROOT = Path(__file__).resolve().parent\nTARGET = ROOT / 'bridge.py'\nOLD_PID = 2616\nEXPECTED_SHA = '0f1762ca30dfc38a462fc9c355964f13908d908207e1b417170db23bcf908e60'\nRESULT = ROOT / 'bridge-data' / 'fast-lane' / 'restart-result.json'\nRESULT.parent.mkdir(parents=True, exist_ok=True)\n\ndef save(obj):\n    tmp = RESULT.with_suffix('.json.tmp')\n    tmp.write_text(json.dumps(obj, indent=2), encoding='utf-8')\n    os.replace(tmp, RESULT)\n\nsha = hashlib.sha256(TARGET.read_bytes()).hexdigest()\nif sha != EXPECTED_SHA:\n    save({'ok':False,'error':'source_sha_guard_failed','sha256':sha})\n    raise SystemExit(2)\ntry:\n    old = psutil.Process(OLD_PID)\n    cmd = ' '.join(old.cmdline())\nexcept Exception as exc:\n    save({'ok':False,'error':'old_pid_not_found','type':type(exc).__name__})\n    raise SystemExit(3)\nif 'bridge.py' not in cmd:\n    save({'ok':False,'error':'old_pid_command_guard_failed'})\n    raise SystemExit(4)\n\nold.terminate()\ntry:\n    old.wait(timeout=5)\nexcept psutil.TimeoutExpired:\n    old.kill()\n    old.wait(timeout=5)\n\ntime.sleep(0.5)\nflags = 0\nfor name in ('DETACHED_PROCESS','CREATE_NEW_PROCESS_GROUP','CREATE_NO_WINDOW'):\n    flags |= int(getattr(subprocess, name, 0))\nnew = subprocess.Popen(\n    [sys.executable, str(TARGET)],\n    cwd=str(ROOT),\n    stdin=subprocess.DEVNULL,\n    stdout=subprocess.DEVNULL,\n    stderr=subprocess.DEVNULL,\n    creationflags=flags,\n)\ntime.sleep(2.0)\nif new.poll() is not None:\n    save({'ok':False,'error':'new_bridge_exited','returncode':new.returncode})\n    raise SystemExit(5)\nhealth = ''\ntry:\n    with urllib.request.urlopen('http://127.0.0.1:8765/health?restart=fl1', timeout=5) as r:\n        health = r.read().decode('utf-8', errors='replace').strip()\nexcept Exception as exc:\n    save({'ok':False,'error':'local_health_failed','type':type(exc).__name__,'new_pid':new.pid})\n    raise SystemExit(6)\n\nsave({'ok': health == 'OK', 'old_pid': OLD_PID, 'new_pid': new.pid, 'health': health, 'revision':'20260830-14-FL1', 'sha256':sha})\n"},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\restart_bridge_fl2.py","size":2666,"sha256":"7f965761c5d5fdbd2b2475705baaa9b356cbdbab8918e20669ae12f9db647eb3","preview":"from pathlib import Path\nimport hashlib, json, os, subprocess, sys, time\nimport psutil\nimport urllib.request\n\nROOT = Path(__file__).resolve().parent\nTARGET = ROOT / 'bridge.py'\nEXPECTED_SHA = 'cd9fb7fc718b740fab42b52182308d76c7e1b0693a2a7a403af1f63beb82f38a'\nEXPECTED_REV = 'REVISION = \"20260830-15-FL2\"'\nRESULT = ROOT / 'bridge-data' / 'fast-lane' / 'restart-fl2-result.json'\nRESULT.parent.mkdir(parents=True, exist_ok=True)\n\ndef save(obj):\n    tmp = RESULT.with_suffix('.json.tmp')\n    tmp.write_text(json.dumps(obj, indent=2), encoding='utf-8')\n    os.replace(tmp, RESULT)\n\nraw = TARGET.read_bytes()\nsha = hashlib.sha256(raw).hexdigest()\ntext = raw.decode('utf-8', errors='replace')\nif sha != EXPECTED_SHA or EXPECTED_REV not in text:\n    save({'ok':False,'error':'source_guard_failed','sha256':sha,'revision_ok':EXPECTED_REV in text})\n    raise SystemExit(2)\n\nmatches=[]\nfor p in psutil.process_iter(['pid','name','cmdline']):\n    try:\n        name=(p.info.get('name') or '').lower()\n        cmdline=p.info.get('cmdline') or []\n        joined=' '.join(cmdline)\n        if name=='python.exe' and 'bridge.py' in joined and '-c' not in cmdline:\n            matches.append(p)\n    except (psutil.NoSuchProcess, psutil.AccessDenied):\n        continue\nif len(matches) != 1:\n    save({'ok':False,'error':'bridge_process_count_guard_failed','count':len(matches),'pids':[p.pid for p in matches]})\n    raise SystemExit(3)\nold=matches[0]\nold_pid=old.pid\nold.terminate()\ntry:\n    old.wait(timeout=5)\nexcept psutil.TimeoutExpired:\n    old.kill(); old.wait(timeout=5)\n\ntime.sleep(0.5)\nflags=0\nfor name in ('DETACHED_PROCESS','CREATE_NEW_PROCESS_GROUP','CREATE_NO_WINDOW'):\n    flags |= int(getattr(subprocess,name,0))\nnew=subprocess.Popen([sys.executable,str(TARGET)],cwd=str(ROOT),stdin=subprocess.DEVNULL,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,creationflags=flags)\ntime.sleep(2.0)\nif new.poll() is not None:\n    save({'ok':False,'error':'new_bridge_exited','returncode':new.returncode,'old_pid':old_pid})\n    raise SystemExit(4)\ntry:\n    with urllib.request.urlopen('http://127.0.0.1:8765/health?restart=fl2',timeout=5) as r:\n        health=r.read().decode('utf-8',errors='replace').strip()\nexcept Exception as exc:\n    save({'ok':False,'error':'local_health_failed','type':type(exc).__name__,'old_pid':old_pid,'new_pid':new.pid})\n    raise SystemExit(5)\nok=health=='OK'\nsave({'ok':ok,'old_pid':old_pid,'new_pid':new.pid,'health':health,'revision':'20260830-15-FL2','sha256':sha})\nprint('OLD_PID="},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\restart_bridge_fl3.py","size":2666,"sha256":"ed39aac3d6297b54e0cac8d1e2d7dbdb13cb2be4566c628b69af3291417639b5","preview":"from pathlib import Path\nimport hashlib, json, os, subprocess, sys, time\nimport psutil\nimport urllib.request\n\nROOT = Path(__file__).resolve().parent\nTARGET = ROOT / 'bridge.py'\nEXPECTED_SHA = 'f738f9712f556f0cab2979364a773510d94ffe560d0c156c4576b35d02662cc6'\nEXPECTED_REV = 'REVISION = \"20260830-16-FL3\"'\nRESULT = ROOT / 'bridge-data' / 'fast-lane' / 'restart-fl3-result.json'\nRESULT.parent.mkdir(parents=True, exist_ok=True)\n\ndef save(obj):\n    tmp = RESULT.with_suffix('.json.tmp')\n    tmp.write_text(json.dumps(obj, indent=2), encoding='utf-8')\n    os.replace(tmp, RESULT)\n\nraw = TARGET.read_bytes()\nsha = hashlib.sha256(raw).hexdigest()\ntext = raw.decode('utf-8', errors='replace')\nif sha != EXPECTED_SHA or EXPECTED_REV not in text:\n    save({'ok':False,'error':'source_guard_failed','sha256':sha,'revision_ok':EXPECTED_REV in text})\n    raise SystemExit(2)\n\nmatches=[]\nfor p in psutil.process_iter(['pid','name','cmdline']):\n    try:\n        name=(p.info.get('name') or '').lower()\n        cmdline=p.info.get('cmdline') or []\n        joined=' '.join(cmdline)\n        if name=='python.exe' and 'bridge.py' in joined and '-c' not in cmdline:\n            matches.append(p)\n    except (psutil.NoSuchProcess, psutil.AccessDenied):\n        continue\nif len(matches) != 1:\n    save({'ok':False,'error':'bridge_process_count_guard_failed','count':len(matches),'pids':[p.pid for p in matches]})\n    raise SystemExit(3)\nold=matches[0]\nold_pid=old.pid\nold.terminate()\ntry:\n    old.wait(timeout=5)\nexcept psutil.TimeoutExpired:\n    old.kill(); old.wait(timeout=5)\n\ntime.sleep(0.5)\nflags=0\nfor name in ('DETACHED_PROCESS','CREATE_NEW_PROCESS_GROUP','CREATE_NO_WINDOW'):\n    flags |= int(getattr(subprocess,name,0))\nnew=subprocess.Popen([sys.executable,str(TARGET)],cwd=str(ROOT),stdin=subprocess.DEVNULL,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,creationflags=flags)\ntime.sleep(2.0)\nif new.poll() is not None:\n    save({'ok':False,'error':'new_bridge_exited','returncode':new.returncode,'old_pid':old_pid})\n    raise SystemExit(4)\ntry:\n    with urllib.request.urlopen('http://127.0.0.1:8765/health?restart=fl3',timeout=5) as r:\n        health=r.read().decode('utf-8',errors='replace').strip()\nexcept Exception as exc:\n    save({'ok':False,'error':'local_health_failed','type':type(exc).__name__,'old_pid':old_pid,'new_pid':new.pid})\n    raise SystemExit(5)\nok=health=='OK'\nsave({'ok':ok,'old_pid':old_pid,'new_pid':new.pid,'health':health,'revision':'20260830-16-FL3','sha256':sha})\nprint('OLD_PID="},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\restart-ha1.log","size":181,"sha256":"29c7a568ed97354cd88663f2cffde6923230bed151b3cbd4f2265f5b1551fdcd","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\restart-ha2-final.log","size":73,"sha256":"abe68ffb5e1ee1d724b6f14eac4294afb645ab94156a691a4b3eb019066babaf","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\projects\\restart_dev_after_delay.py","size":3101,"sha256":"fd2b4b0104703a3b86a89fd602844322f19bb66ea7acf2daa847c1de9b9c7e73","preview":"from pathlib import Path\nimport os, subprocess, sys, time, urllib.request\n\nROOT = Path(r\"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\")\nLOG = ROOT / \"bridge-data\" / \"restart-ha1.log\"\n\ndef log(msg):\n    LOG.parent.mkdir(parents=True, exist_ok=True)\n    with LOG.open(\"a\", encoding=\"utf-8\") as f:\n        f.write(time.strftime(\"%Y-%m-%d %H:%M:%S\") + \" \" + msg + \"\\n\")\n\ndef hidden_flags(detached=False):\n    flags = getattr(subprocess, \"CREATE_NO_WINDOW\", 0) | getattr(subprocess, \"CREATE_NEW_PROCESS_GROUP\", 0)\n    if detached:\n        flags |= getattr(subprocess, \"DETACHED_PROCESS\", 0)\n    return flags\n\ndef ps(text):\n    return subprocess.run([\"powershell\", \"-NoProfile\", \"-Command\", text], capture_output=True, text=True,\n                          creationflags=getattr(subprocess, \"CREATE_NO_WINDOW\", 0))\n\ndef worker():\n    time.sleep(4)\n    r = ps(\"$c=Get-NetTCPConnection -LocalPort 8766 -State Listen -ErrorAction SilentlyContinue;if($c){$c.OwningProcess}\")\n    pid_text = (r.stdout or \"\").strip().splitlines()\n    pid = int(pid_text[-1]) if pid_text and pid_text[-1].strip().isdigit() else 0\n    if pid:\n        q = ps(f\"$p=Get-CimInstance Win32_Process -Filter 'ProcessId={pid}';$p.CommandLine\")\n        cmdline = (q.stdout or \"\").strip()\n        log(f\"owner pid={pid} cmd={cmdline}\")\n        if \"dev_bridge_launcher.py\" not in cmdline:\n            log(\"ABORT owner signature mismatch\")\n            return 12\n        subprocess.run([\"taskkill\", \"/PID\", str(pid), \"/F\"], capture_output=True,\n                       creationflags=getattr(subprocess, \"CREATE_NO_WINDOW\", 0))\n        time.sleep(1)\n    start = ROOT / \"start-dev-bridge.ps1\"\n    if not start.exists():\n        log(\"ABORT start script missing\")\n        return 13\n    subprocess.Popen([\"powershell\", \"-NoProfile\", \"-ExecutionPolicy\", \"Bypass\", \"-File\", str(start)],\n                     cwd=str(ROOT), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL,\n                     creationflags=hidden_flags(detached=True))\n    deadline = time.time() + 15\n    last = \"\"\n    while time.time() < deadline:\n        try:\n            with urllib.request.urlopen(\"http://127.0.0.1:8766/health\", timeout=2) as resp:\n                last = resp.read().decode(\"utf-8\", \"replace\").strip()\n                if resp.status == 200:\n                    log(\"RESTART_OK health=\" + last)\n                    return 0\n        except Exception as exc:\n            last = type(exc).__name__\n        time.sleep(1)\n    lo"},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\projects\\restart_ha2_final.ps1","size":912,"sha256":"12c1bd6013d0466c174c86eca5d143623f99ab45ef430fc2d6a4581c9c403338","preview":"$ErrorActionPreference='SilentlyContinue'\nStart-Sleep -Seconds 3\n$root='C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV'\n$py='C:\\Users\\ash\\AppData\\Local\\Programs\\Python\\Python312\\python.exe'\n$log=Join-Path $root 'bridge-data\\restart-ha2-final.log'\n$owners=Get-NetTCPConnection -LocalPort 8766 -State Listen -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique\nforeach($opid in $owners){ cmd /c taskkill /PID $opid /T /F | Out-Null }\nStart-Sleep -Seconds 2\n$p=Start-Process -FilePath $py -ArgumentList 'dev_bridge_launcher.py' -WorkingDirectory $root -PassThru -WindowStyle Hidden\nStart-Sleep -Seconds 4\n$health='FAIL'\ntry { $r=Invoke-WebRequest -UseBasicParsing 'http://127.0.0.1:8766/health' -TimeoutSec 2; if($r.Content.Trim() -eq 'OK'){$health='OK'} } catch {}\n(\"TIME=\"+(Get-Date -Format o)+\"`nSTARTED_PID=\"+$p.Id+\"`nHEALTH=\"+$health) | Set-Content -Encoding UTF8 $log\n"},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\__pycache__\\dev_bridge_launcher.cpython-312.pyc","size":569,"sha256":"a2638dead1be51c019fd77153be67ef433a211879ffb100ffc956babc0c1d7aa","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\drive-results\\dev-ha2-postrestart-status-1788155768.json","size":779,"sha256":"b4ff7a88e340ac07907518ea011ecb2c4fab1af53990ffece7536aa0f658d249","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\drive-results\\dev-restart-for-ha2-1788153867.json","size":798,"sha256":"214da3b116826f8ea1cdcce08c174ac9eb8f031eeab4a3bf4baef817c08ae35c","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\drive-results\\dev-schedule-self-restart-ha1-1788151725.json","size":1900,"sha256":"7f59714b056b59432f37daaaadcd8f3a7227c3a01f5bc610a8e2b171b251a06d","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\drive-results\\dev-self-restart-ha2-final-1788155689.json","size":2402,"sha256":"deb07828a0452204668599351fbad4e036fad545ab475e7e956ecb2115d59e60","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\drive-results\\dev-write-restart-helper-1788152350.json","size":5229,"sha256":"a068152dabc73578c9b10bbe92d6f0a53e84400034dd5dff2bbfe4012b23383e","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\results\\dev-ha2-postrestart-status-1788155768.json","size":779,"sha256":"b4ff7a88e340ac07907518ea011ecb2c4fab1af53990ffece7536aa0f658d249","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\results\\dev-restart-for-ha2-1788153867.json","size":798,"sha256":"214da3b116826f8ea1cdcce08c174ac9eb8f031eeab4a3bf4baef817c08ae35c","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\results\\dev-schedule-self-restart-ha1-1788151725.json","size":1900,"sha256":"7f59714b056b59432f37daaaadcd8f3a7227c3a01f5bc610a8e2b171b251a06d","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\results\\dev-self-restart-ha2-final-1788155689.json","size":2402,"sha256":"deb07828a0452204668599351fbad4e036fad545ab475e7e956ecb2115d59e60","preview":""},{"path":"C:\\Users\\ash\\Documents\\Codex\\2026-08-26\\LaptopBridge-DEV\\bridge-data\\fast-lane\\results\\dev-write-restart-helper-1788152350.json","size":5229,"sha256":"a068152dabc73578c9b10bbe92d6f0a53e84400034dd5dff2bbfe4012b23383e","preview":""}]