GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: runed self-bootstrap with manifest-driven artifact install by couragehong · Pull Request #4 · CryptoLabInc/runed

Conversation

@couragehong

@couragehong couragehong commented May 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • runed now fetches a manifest at first boot and downloads the llama-server tarball and embedding GGUF described there directly into ~/.runed/{bin/llama-cpp,models}/, verifying SHA-256 along the way. End users no longer touch RUNED_MANIFEST — the URL is baked into the binary via -ldflags (DEFAULT_MANIFEST_URL Makefile var).
  • internal/spawn is now fully optional: ~/.runed/config.json and every field inside it are optional. RunedBinary falls back through PATH → build-time DefaultRunedBinary (also injected via Makefile). launchDaemon no longer forces empty LlamaServer/Model into the child env, so the daemon's self-bootstrap
  • scripts/dev_standalone.sh + scripts/manifest.dev.json give an end-to-end local test path (local HTTP server + build + symlink + run). README's TBD sections replaced with real docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@couragehong
couragehong requested a review from esifea May 27, 2026 09:53
@couragehong
couragehong force-pushed the feat/self-bootstrap branch from 3a20236 to 52d1fe7 Compare May 27, 2026 09:56
@jh-lee-cryptolab

jh-lee-cryptolab commented May 28, 2026

Copy link
Copy Markdown
Contributor

Could you rebase the branch firstly please?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

couragehong added 6 commits May 28, 2026 09:39
@couragehong
feat(bootstrap): introduce self-bootstrap package
c03cad2
internal/bootstrap downloads the llama-server tarball and embedding GGUF
described by a manifest at first boot, so runed can run standalone
without pre-installed dependencies or external setup scripts.

- paths.go: Paths struct, EnsureDirs, model variant filenames
- config.go: ~/.runed/config.json reader (model_variant), tolerant of
  spawn-package fields so both readers can share one file
- manifest.go: schema + FetchManifest (30s timeout, 1MB body cap).
  DefaultManifestURL for ldflags injection.
- download.go: streaming SHA-256 verify, partial+rename atomic commit,
  2h absolute timeout per artifact
- extract.go: tar.gz extract with path-traversal defense
  (symlinks/hardlinks/devices skipped)
- lock.go: advisory flock with polling
- install.go: EnsureAll holds install.lock, ensures llama_server via
  sidecar SHA marker, ensures model via per-file hash compare, emits
  throttled progress through *slog.Logger
@couragehong
feat(runed): wire self-bootstrap on missing env
b0595e1
cmd/runed/main.go calls selfBootstrap when RUNED_LLAMA_SERVER or
RUNED_MODEL is unset, then proceeds to backend.Start.

- anotherDaemonReachable probe before bootstrap: exit 0 if another
  daemon already serves the socket; clean up stale socket files
- threads the daemon's *slog.Logger into bootstrap.EnsureAll for
  step-by-step INFO output (manifest fetch, ensure target, cache hit,
  downloading, extracting, install complete)
- HTTP-not-HTTPS manifest URL warning
@couragehong
feat(spawn,build): optional spawn config + DefaultRunedBinary
2e7325d
spawn config no longer requires the file or any field. LlamaServer /
Model staying unset means "let the daemon self-bootstrap"; launchDaemon
no longer forces those values into the child env.

RunedBinary resolution chain:
  config > PATH > DefaultRunedBinary (ldflags) > os.Executable
  (basename=="runed") > error

Makefile injects DEFAULT_MANIFEST_URL and DEFAULT_RUNED_BINARY via
-ldflags. Both runed and rundemo receive the same flags so a client
auto-spawning the daemon resolves the binary without env or config.
@couragehong
chore(scripts): dev_standalone.sh + manifest.dev.json
8d3bfb3
dev_standalone.sh runs an end-to-end self-bootstrap test against a local
HTTP server:

- copies scripts/manifest.dev.json into the docroot
- serves it via python3 -m http.server (background)
- builds runed + rundemo with DEFAULT_MANIFEST_URL pointing at the
  local server and DEFAULT_RUNED_BINARY=$HOME/.runed/bin/runed
- symlinks ~/.runed/bin/runed -> ./bin/runed so client auto-spawn
  resolves the freshly-built fork binary
- --clean wipes ~/.runed/{bin/llama-cpp,models,cache} for fresh-install
  verification

manifest.dev.json carries the URL/sha256/size metadata so the runner
script holds no artifact specifics.
@couragehong
chore: gofmt comment indentation in test files
70fa61b
go fmt ./... normalized doc-comment indentation that drifted in the
fork. No behaviour change.
@couragehong
docs(readme): document self-bootstrap installation/usage/configuration
07b9b24
Replace TBD sections with the actual flow:

- Installation: rune install bakes DEFAULT_MANIFEST_URL into the binary;
  scripts/dev_standalone.sh for local testing
- Usage: spawn-on-Connect via client.Connect, foreground launch for dev
- Configuration: env var table, build-time ldflags, manifest format
  reference, config.json shared by spawn + bootstrap readers
@couragehong
couragehong force-pushed the feat/self-bootstrap branch from 52d1fe7 to 07b9b24 Compare May 28, 2026 00:48
@couragehong

couragehong commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

Could you rebase the branch firstly please?

Finished rebase and resolved merge conflict with minor fix!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@couragehong
couragehong requested a review from jh-lee-cryptolab May 28, 2026 00:50
jh-lee-cryptolab
jh-lee-cryptolab reviewed May 28, 2026
View reviewed changes
Comment thread README.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

jh-lee-cryptolab
jh-lee-cryptolab reviewed May 28, 2026
View reviewed changes
Comment thread internal/bootstrap/extract.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

esifea
esifea reviewed May 28, 2026
View reviewed changes
Comment thread cmd/runed/main.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

jh-lee-cryptolab
jh-lee-cryptolab reviewed May 28, 2026
View reviewed changes
Comment thread cmd/runed/main.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

jh-lee-cryptolab
jh-lee-cryptolab reviewed May 28, 2026
View reviewed changes
Comment thread internal/bootstrap/install.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

jh-lee-cryptolab
jh-lee-cryptolab reviewed May 28, 2026
View reviewed changes
Comment thread internal/bootstrap/manifest.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

esifea
esifea reviewed May 28, 2026
View reviewed changes
Comment thread internal/bootstrap/install.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

esifea
esifea reviewed May 28, 2026
View reviewed changes
Comment thread internal/bootstrap/download.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@esifea esifea mentioned this pull request May 28, 2026
feat: backend idle-suspend (keep runed alive across idle) #5
Merged
couragehong and others added 7 commits May 28, 2026 13:18
@couragehong @claude
docs: move build-time options from README to CONTRIBUTING
79d6173
Build instructions belong with the rest of the developer setup in
CONTRIBUTING.md. The README only keeps a one-line pointer for readers
who notice the build-time ldflags default in the env table.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@couragehong @claude
refactor(bootstrap): parse manifest with json.Unmarshal
0c802da
Decoder.Decode silently accepts garbage after the JSON document; for a
channel where the body must be exactly one manifest, the stricter
Unmarshal surfaces corruption / MITM as a parse error instead of
swallowing it. Drops the now-unused bytes import and adds a regression
test that pins the trailing-data rejection.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@couragehong @claude
fix(bootstrap): reject Content-Length mismatch before streaming
1b45197
Compare resp.ContentLength against the manifest's expectedSize right
after the HTTP status check, so a divergence aborts the request before
~470MB of model bytes hit the partial file. The post-stream size check
stays as a safety net for chunked transfers (ContentLength == -1) and
for servers that lie in their headers.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@couragehong @claude
refactor(bootstrap): use filepath.IsLocal for tar entry safety check
8449a5e
The old strings.Contains(name, "..") prefilter over-rejected legitimate
filenames containing literal dots (e.g. "libllama..1.2.dylib"), and the
follow-up filepath.Rel block was redundant with it. filepath.IsLocal
(Go 1.20+) judges path-traversal lexically — it accepts dotted names,
rejects absolute paths and segments that would escape the destination,
and handles Windows reserved forms in one call. Sufficient under the
trusted-manifest + SHA-256-verified-archive threat model.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@couragehong @claude
fix(bootstrap): widen install lock timeout to match worst-case leader…
e5c822f
… hold

The 10m InstallLockTimeout was shorter than the leader's legitimate
upper bound: ensureLlamaServer and ensureModel each run under
downloadTimeout (2h), so a slow-but-healthy install can hold the lock
for up to 4h. A trailer arriving during a 15-minute model download
would surface a confusing "flock timeout" failure even though nothing
was wedged. Align the wait with 2*downloadTimeout; the leader's own
downloadTimeout still guards against truly stalled installs, so the
longer wait doesn't reintroduce zombie risk.

Also record the holder's PID into the lock file (best effort) so a
timed-out trailer gets "another runed instance (pid N) is bootstrapping
— retry shortly" instead of a bare flock error.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@couragehong @claude
feat(bootstrap): retry artifact downloads with exponential backoff
6f2ee13
A transient network blip during a multi-hundred-MB model download
shouldn't fail the entire boot. downloadWithRetry wraps DownloadAndVerify
with up to 3 attempts and 5s/15s exponential backoff; caller cancellation
(ctx.Err) short-circuits the retry loop so shutdown isn't delayed.

Applied to both ensureModel and ensureLlamaServer for consistency,
since both download via the same code path and benefit from the same
resilience.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@couragehong @claude
refactor(bootstrap): split EnsureAll for partial-env-override case
b9e5ea4
EnsureAll did both artifacts in one shot, so a caller who set only
RUNED_LLAMA_SERVER or only RUNED_MODEL still paid for the other side's
download — which the env override on the call site then discarded.

A stricter side effect: ensureLlamaServer's first line is
m.LlamaServerForCurrentPlatform(), so a user on a platform missing from
the manifest couldn't escape via env override even when they explicitly
pointed at their own llama-server build. EnsureAll demanded the platform
check succeed regardless of which side the caller actually needed from
the manifest.

The normal path (both env vars unset) keeps using EnsureAll, so its
single-lock fast path is preserved. New EnsureLlamaServer / EnsureModel
are called by selfBootstrap when exactly one env var is set; each
manages its own install.lock acquisition. EnsureModel notably does not
consult LlamaServerForCurrentPlatform, which is what unblocks the
platform-escape-hatch case — the platform check is now confined to
EnsureLlamaServer, so a caller that only needs the model side never
exercises it.

Tests pin the two relevant boundaries: EnsureLlamaServer surfaces
ErrNoArtifactForPlatform when the manifest has no entry for the current
platform, and EnsureModel succeeds in the same setup as long as the
target model is cached.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
jh-lee-cryptolab
jh-lee-cryptolab approved these changes May 28, 2026
View reviewed changes
@couragehong
couragehong merged commit 4ca08b3 into CryptoLabInc:main May 28, 2026
7 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@esifea esifea esifea left review comments
@jh-lee-cryptolab jh-lee-cryptolab jh-lee-cryptolab approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@couragehong @jh-lee-cryptolab @esifea
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.