Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions tools/gex44-box/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# GEX44 box — preserved tooling & reproducible setup

The GEX44 GPU box (`root@46.4.26.123`, RTX 4000 Ada / 64GB) was WorldOS's primary Unity render

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the operator endpoint from tracked documentation

Tracking the exact root@46.4.26.123 SSH endpoint exposes operator-only connection information and makes it persist even after older operational documentation is cleaned up or the address is reassigned. Keep only the non-sensitive host identifier here and leave connection details in the designated external secrets/configuration.

AGENTS.md reference: AGENTS.md:L35-L35

Useful? React with 👍 / 👎.

host + image-detail lane. It is being decommissioned. This directory versions the box-only tooling

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reconcile the decommission notice with canonical host routing

Declaring this host to be under decommission conflicts with the canonical bootstrap and WorldOS-GUI-RUNBOOK.md, which still route heavy sweeps and Unity rendering to GEX44 as the preferred host. After decommissioning, agents following those entry points will continue scheduling work against a retired machine; update the canonical routing and fallback instructions atomically with this notice, or defer the decommission wording until that transition occurs.

AGENTS.md reference: AGENTS.md:L36-L36

Useful? React with 👍 / 👎.

that previously lived nowhere but the box, so the setup is reproducible and nothing is lost with the
hardware.

**The canonical Unity project itself is NOT here** — it is fully committed and pushed to
`github.com/100yenadmin/worldos-unity-2026-06-30_07-21-47` (incl. Git-LFS). This dir is the
*surrounding* ops/tooling that sat outside that repo.

## Contents

### `ops/`
- **`worldos-unity-save.sh`** — the box's autosave mechanism (cron, runs as `unity`): commit-if-dirty
locally + best-effort LFS push. `--push` does the daily GitHub push. This is the persistence
contract referenced across the WorldOS runbooks ("end every box session with this").
- **`launch_editor.sh`** — headless/hidpi Unity editor launcher for the box.
- **`derive_gbuffer.py`** — depth/normal G-buffer derivation for the render pipeline.
- **`setup_depth.sh`** — depth-pass environment setup.
- **`INSTALL.md`** — box bring-up / install notes.

### `comfyui-detail-finisher/`
A headless ComfyUI lane for a **tiled, structure-locked SDXL img2img detail pass** on painterly game
backdrops (denoise ~0.35, SDXL base + Tile ControlNet, tiled via Ultimate SD Upscale so large plates
fit in VRAM; keeps input resolution/aspect). Ran on `127.0.0.1:8188`.
- `README-WORLDOS.md` — full start/stop + usage.
- `tile_detail.sh` — driver script.
- `workflows/tile_detail.json` — the ComfyUI workflow graph (the reusable asset).

### `display-config/`
The 4K-readable remote-desktop (Xorg/openbox/sunshine) profile used to drive the headed editor over
a remote session.

## Not committed here (archived on LEXAR only)
- The vLLM model-serving scripts (`h4-vllm-*.sh`) — a separate, non-WorldOS use of the GPU box.
- ComfyUI `output/` sample renders + `user/comfyui.db`.
- Full box render caches (`Captures*`, `BuildOutput`) — regenerable; the curated renders live in
the WorldOS session-notes.

Backup location: `LEXAR/Codex/session-notes/2026-07-24/worldos-disk-cleanup-fork/artifacts/`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point the archive at the canonical mounted path

This is the sole locator given for artifacts deliberately omitted from Git, but LEXAR/Codex/... is a relative path and does not resolve to the canonical Mac artifact volume. An operator following it from the checkout cannot recover the archived-only scripts and caches; record the complete /Volumes/LEXAR/Codex/... path instead.

AGENTS.md reference: AGENTS.md:L6-L6

Useful? React with 👍 / 👎.

65 changes: 65 additions & 0 deletions tools/gex44-box/comfyui-detail-finisher/README-WORLDOS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# ComfyUI "detail-finisher" lane (WorldOS)

A headless ComfyUI install for a **tiled, structure-locked SDXL img2img detail pass** on
painterly game backdrops. Takes an input PNG (~1344x768 to 2760x1504) and runs a
denoise-~0.35 "detail" pass using SDXL base + an SDXL **Tile ControlNet** (structure lock),
tiled via **Ultimate SD Upscale (No Upscale)** so large backdrops fit in VRAM. Output keeps
the input resolution and aspect ratio.

Runs on `127.0.0.1:8188`. **Do NOT touch ports 8080 / 8765 or the `unity` user's editor
(pid on 8080).** This lane only owns the ComfyUI process and files under `/root/comfyui`.

## Start it

```bash
cd /root/comfyui && nohup venv/bin/python main.py --listen 127.0.0.1 --port 8188 > comfy.log 2>&1 & disown
# wait ~10s, then:
curl -s http://127.0.0.1:8188/system_stats
```

## Stop it (only ever this specific process — NEVER a broad pkill)

```bash
PID=$(pgrep -f "main.py --listen 127.0.0.1 --port 8188" | head -1)
kill "$PID"
```

## Driver script

```bash
/root/comfyui/tile_detail.sh <in.png> <out.png> <denoise>
# example (the proven proof pass):
/root/comfyui/tile_detail.sh /tmp/crisp_diff.png /tmp/crisp_diff_tiled.png 0.35
```

The driver uploads the input via the `/upload/image` API, loads
`/root/comfyui/workflows/tile_detail.json`, patches in the input filename + denoise,
POSTs to `/prompt`, polls `/history/<id>` until done, and copies the SaveImage output
(from `/root/comfyui/output/`) to `<out.png>`.

Proven proof pass: input 2760x1504 -> output 2760x1504, ~164s, peak ~12.4 GB VRAM,
output mean pixel 0.348 (valid, non-black).

## Pipeline (workflows/tile_detail.json, API format)

`CheckpointLoaderSimple` -> `LoadImage` -> `CLIPTextEncode` (pos/neg) ->
`ControlNetLoader` (tile) -> `ControlNetApplyAdvanced` (strength 0.75, applied to the
source image = structure lock) -> `UltimateSDUpscaleNoUpscale`
(denoise 0.35, cfg 6.0, dpmpp_2m/karras, 24 steps, 1024x1024 tiles, tiled_decode,
Band-Pass seam fix) -> `SaveImage`.

To change detail strength, pass a different denoise arg (0.25 subtle .. 0.45 aggressive);
higher drifts further from the source structure.

## Models

| File | Path | Size (bytes) | Size (h) | Source |
|------|------|-------------|----------|--------|
| sd_xl_base_1.0.safetensors | /root/comfyui/models/checkpoints/ | 6938078334 | 6.5G | huggingface.co/stabilityai/stable-diffusion-xl-base-1.0 (sd_xl_base_1.0.safetensors) |
| controlnet-tile-sdxl.safetensors | /root/comfyui/models/controlnet/ | 2502139104 | 2.4G | huggingface.co/xinsir/controlnet-tile-sdxl-1.0 (diffusion_pytorch_model.safetensors, renamed) |

## Env

- venv: `/root/comfyui/venv` (torch 2.6.0+cu124, CUDA available on RTX 4000 SFF Ada)
- custom node: `ComfyUI_UltimateSDUpscale` (ssitu) in `/root/comfyui/custom_nodes/`
- log: `/root/comfyui/comfy.log`
111 changes: 111 additions & 0 deletions tools/gex44-box/comfyui-detail-finisher/tile_detail.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/usr/bin/env bash
# tile_detail.sh <in.png> <out.png> <denoise>
# Runs a tiled, structure-locked SDXL + Tile-ControlNet img2img detail pass
# through the local ComfyUI HTTP API (127.0.0.1:8188) and writes the result to <out.png>.
set -euo pipefail

IN="${1:?usage: tile_detail.sh <in.png> <out.png> <denoise>}"
OUT="${2:?usage: tile_detail.sh <in.png> <out.png> <denoise>}"
DENOISE="${3:-0.35}"

COMFY_DIR="/root/comfyui"
COMFY_URL="http://127.0.0.1:8188"
WORKFLOW="${COMFY_DIR}/workflows/tile_detail.json"
PY="${COMFY_DIR}/venv/bin/python"

[ -f "$IN" ] || { echo "ERROR: input not found: $IN" >&2; exit 1; }
[ -f "$WORKFLOW" ] || { echo "ERROR: workflow not found: $WORKFLOW" >&2; exit 1; }

"$PY" - "$IN" "$OUT" "$DENOISE" "$WORKFLOW" "$COMFY_URL" "$COMFY_DIR" <<'PYEOF'
import sys, os, json, time, uuid, shutil, urllib.request, urllib.parse, mimetypes

in_path, out_path, denoise, workflow_path, base, comfy_dir = sys.argv[1:8]
denoise = float(denoise)

def http_json(path, data=None, headers=None):
url = base + path
req = urllib.request.Request(url, data=data, headers=headers or {})
with urllib.request.urlopen(req, timeout=600) as r:
return json.loads(r.read().decode())

# 1. Upload input image to ComfyUI's input dir via /upload/image (multipart)
def upload_image(path):
fn = os.path.basename(path)
boundary = "----comfyboundary" + uuid.uuid4().hex
with open(path, "rb") as f:
content = f.read()
ctype = mimetypes.guess_type(path)[0] or "image/png"
parts = []
def add(name, value, filename=None, is_file=False):
head = f'--{boundary}\r\nContent-Disposition: form-data; name="{name}"'
if filename:
head += f'; filename="{filename}"'
head += f'\r\nContent-Type: {ctype}'
head += "\r\n\r\n"
parts.append(head.encode() + (value if is_file else value.encode()) + b"\r\n")
add("image", content, filename=fn, is_file=True)
add("overwrite", "true")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Give each uploaded input a unique server-side name

When two driver instances use inputs with the same basename while another prompt is queued, both upload to the same ComfyUI input filename and the later invocation overwrites the first file before its LoadImage node necessarily executes. The first job can therefore process the second caller's image while reporting success to the first caller's output path; upload under a per-run UUID/subfolder rather than setting overwrite=true on a shared basename.

Useful? React with 👍 / 👎.

body = b"".join(parts) + f"--{boundary}--\r\n".encode()
req = urllib.request.Request(base + "/upload/image", data=body,
headers={"Content-Type": f"multipart/form-data; boundary={boundary}"})
with urllib.request.urlopen(req, timeout=120) as r:
resp = json.loads(r.read().decode())
# returns {"name":..., "subfolder":..., "type":"input"}
return resp["name"] if not resp.get("subfolder") else f'{resp["subfolder"]}/{resp["name"]}'

uploaded = upload_image(in_path)
print(f"[tile_detail] uploaded input as: {uploaded}")

# 2. Load workflow, patch input filename + denoise
with open(workflow_path) as f:
wf = json.load(f)
patched = False
for nid, node in wf.items():
if node.get("class_type") == "LoadImage":
node["inputs"]["image"] = uploaded
patched = True
if node.get("class_type") in ("UltimateSDUpscaleNoUpscale", "UltimateSDUpscale", "KSampler"):
node["inputs"]["denoise"] = denoise
# keep seam-fix denoise in step with the main pass when present
if "seam_fix_denoise" in node["inputs"]:
node["inputs"]["seam_fix_denoise"] = denoise
assert patched, "no LoadImage node found in workflow"

client_id = uuid.uuid4().hex
payload = json.dumps({"prompt": wf, "client_id": client_id}).encode()
resp = http_json("/prompt", data=payload, headers={"Content-Type": "application/json"})
prompt_id = resp["prompt_id"]
print(f"[tile_detail] queued prompt_id={prompt_id} denoise={denoise}")

# 3. Poll /history/<id> until complete
t0 = time.time()
outputs = None
while True:
time.sleep(2)
hist = http_json(f"/history/{prompt_id}")
if prompt_id in hist:
entry = hist[prompt_id]
status = entry.get("status", {})
if status.get("completed") or status.get("status_str") == "success":
outputs = entry.get("outputs", {})
break
if status.get("status_str") == "error":
raise SystemExit(f"[tile_detail] ComfyUI reported error: {json.dumps(status)}")
if time.time() - t0 > 1800:
raise SystemExit("[tile_detail] timed out after 1800s")

# 4. Locate the SaveImage output and copy to out_path
saved = None
for nid, out in (outputs or {}).items():
for img in out.get("images", []):
if img.get("type") == "output":
saved = img
break
if saved:
break
assert saved, f"no output image in history: {json.dumps(outputs)[:500]}"

src = os.path.join(comfy_dir, "output", saved.get("subfolder", ""), saved["filename"])
shutil.copyfile(src, out_path)
print(f"[tile_detail] DONE in {time.time()-t0:.1f}s -> {out_path} (from {src})")
PYEOF
76 changes: 76 additions & 0 deletions tools/gex44-box/comfyui-detail-finisher/workflows/tile_detail.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"1": {
"class_type": "CheckpointLoaderSimple",
"inputs": { "ckpt_name": "sd_xl_base_1.0.safetensors" }
},
"2": {
"class_type": "LoadImage",
"inputs": { "image": "INPUT_IMAGE_PLACEHOLDER" }
},
"3": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": ["1", 1],
"text": "masterpiece, highly detailed painterly game backdrop, crisp fine detail, sharp textures, intricate brushwork, high fidelity, detailed foliage and stonework, professional concept art"
}
},
"4": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": ["1", 1],
"text": "blurry, low detail, jpeg artifacts, oversaturated, washed out, deformed, watermark, text, noise, smudge"
}
},
"5": {
"class_type": "ControlNetLoader",
"inputs": { "control_net_name": "controlnet-tile-sdxl.safetensors" }
},
"6": {
"class_type": "ControlNetApplyAdvanced",
"inputs": {
"positive": ["3", 0],
"negative": ["4", 0],
"control_net": ["5", 0],
"image": ["2", 0],
"strength": 0.75,
"start_percent": 0.0,
"end_percent": 1.0
}
},
"7": {
"class_type": "UltimateSDUpscaleNoUpscale",
"inputs": {
"upscaled_image": ["2", 0],
"model": ["1", 0],
"positive": ["6", 0],
"negative": ["6", 1],
"vae": ["1", 2],
"seed": 12345,
"steps": 24,
"cfg": 6.0,
"sampler_name": "dpmpp_2m",
"scheduler": "karras",
"denoise": 0.35,
"mode_type": "Linear",
"tile_width": 1024,
"tile_height": 1024,
"mask_blur": 8,
"tile_padding": 32,
"seam_fix_mode": "Band Pass",
"seam_fix_denoise": 0.35,
"seam_fix_width": 64,
"seam_fix_mask_blur": 8,
"seam_fix_padding": 16,
"force_uniform_tiles": true,
"tiled_decode": true,
"batch_size": 1
}
},
"8": {
"class_type": "SaveImage",
"inputs": {
"images": ["7", 0],
"filename_prefix": "tile_detail"
}
}
}
6 changes: 6 additions & 0 deletions tools/gex44-box/display-config/1440-fallback.Xresources
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Xft.dpi: 120
Xft.antialias: true
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.rgba: rgb
Xcursor.size: 32
6 changes: 6 additions & 0 deletions tools/gex44-box/display-config/4k-readable.Xresources
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Xft.dpi: 192
Xft.antialias: true
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.rgba: rgb
Xcursor.size: 48
6 changes: 6 additions & 0 deletions tools/gex44-box/display-config/4k-workspace.Xresources
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Xft.dpi: 144
Xft.antialias: true
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.rgba: rgb
Xcursor.size: 40
50 changes: 50 additions & 0 deletions tools/gex44-box/display-config/gex44-display-profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -euo pipefail

profile="${1:-4k-readable}"
export DISPLAY="${DISPLAY:-:0}"
export XAUTHORITY="${XAUTHORITY:-/home/unity/.Xauthority}"
export HOME="${HOME:-/home/unity}"

case "$profile" in
4k-readable)
mode="3840x2160R"
fallback_fb="3840x2160"
dpi="192"
resources="/home/unity/.config/gex44-display-profiles/4k-readable.Xresources"
;;
4k-workspace)
mode="3840x2160R"
fallback_fb="3840x2160"
dpi="144"
resources="/home/unity/.config/gex44-display-profiles/4k-workspace.Xresources"
;;
1440-fallback)
mode="2560x1440R"
fallback_fb="2560x1440"
dpi="120"
resources="/home/unity/.config/gex44-display-profiles/1440-fallback.Xresources"
;;
*)
echo "Usage: gex44-display-profile [4k-readable|4k-workspace|1440-fallback]" >&2
exit 64
;;
esac

output="$(xrandr --query | awk '/ connected/{print $1; exit}')"

if [[ -n "${output:-}" ]] && xrandr --query | grep -qE "(^| )${mode}( |$)"; then
xrandr --output "$output" --mode "$mode" --primary --dpi "$dpi"
else
xrandr --fb "$fallback_fb" --dpi "$dpi"
fi

if [[ -f "$resources" ]]; then
xrdb -merge "$resources"
fi

if command -v openbox >/dev/null 2>&1; then
openbox --reconfigure >/dev/null 2>&1 || true
fi

xdpyinfo 2>/dev/null | grep -E 'dimensions|resolution' || true
8 changes: 8 additions & 0 deletions tools/gex44-box/display-config/gtk-settings.ini.4k-readable
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Settings]
gtk-font-name=Sans 16
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintslight
gtk-xft-rgba=rgb
gtk-xft-dpi=196608
gtk-cursor-theme-size=48
Loading
Loading