Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Build release binaries ReleaseSafe

Rach Pradhan8c259fef0bdf
diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml
index c6639456..9ec7d565 100644
--- a/.github/workflows/beta-release.yml
+++ b/.github/workflows/beta-release.yml
@@ -36,7 +36,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
# One runner per target instead of a serial six-target loop: wall time
- # drops from ~24 min to roughly a single ReleaseFast build (~4-5 min).
+ # drops from ~24 min to roughly a single release build (~4-5 min).
# fail-fast stays on (the default) so a broken target cancels the rest
# instead of publishing a partial set.
matrix:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3dd64968..28a15882 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
# One runner per target instead of a serial six-target loop: wall time
- # drops from ~24 min to roughly a single ReleaseFast build (~4-5 min).
+ # drops from ~24 min to roughly a single release build (~4-5 min).
# fail-fast stays on (the default) so a broken target cancels the rest
# instead of publishing a partial set.
matrix:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c69d128d..99d9d894 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ current is part of cutting a release.
- The terminal REPL has a clearer session strip, a subtle divider, and distinct styling for active and completed checklist items. The bare prompt, scrollback, and plain output remain intact; no native window or graphical toolkit is required.
- Operational modes stay visible before workspace metadata when a terminal pane is narrow.
- Includes independent conversation forks for subagents and workflow fan-out, optional retained workers, and bounded workflow synthesis that preserves earlier findings.
+- Release binaries are built ReleaseSafe: an out-of-range index or overflow stops graff with a clear panic instead of silently corrupting state, and the stripped binaries are about 17-20% smaller.
- Retains all changes from v0.302.51.
## v0.302.51
diff --git a/build.zig b/build.zig
index 9ec7da12..b93a5e32 100644
--- a/build.zig
+++ b/build.zig
@@ -3,7 +3,8 @@ const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
- const lean_release = optimize == .fast or optimize == .small;
+ // Every release mode ships stripped; ReleaseSafe is the shipped one.
+ const lean_release = optimize != .debug;
// `--version` string: stamped from `git describe` at build time so every
// binary says which commit built it; `-Dversion=X.Y.Z` overrides (the
diff --git a/install.sh b/install.sh
index 4d5c803b..98e8d844 100644
--- a/install.sh
+++ b/install.sh
@@ -223,7 +223,7 @@ build_from_source() {
fi
printf " ${D}│${N} %-10s " "build"
- ( cd "$src" && zig build -Doptimize=ReleaseFast ) >/dev/null 2>&1 \
+ ( cd "$src" && zig build -Doptimize=ReleaseSafe ) >/dev/null 2>&1 \
&& printf "${G}✓${N}\n" \
|| { printf "${R}failed${N}\n\n ${R}zig build failed${N} — run it manually in $src to see the error\n\n" >&2; exit 1; }
diff --git a/scripts/build-release.py b/scripts/build-release.py
index 71001bde..c1210b78 100644
--- a/scripts/build-release.py
+++ b/scripts/build-release.py
@@ -66,7 +66,7 @@ def fetch_dependencies(zig, env):
def contract(target, version, zig, telemetry=None, portable_host=False):
# A fixed version avoids an undeclared dependency on git describe / .git.
output = ROOT / "zig-out" / target / "bin" / ("graff.exe" if target.endswith("windows") else "graff")
- command = [str(zig), "build", "graff", "-Doptimize=ReleaseFast",
+ command = [str(zig), "build", "graff", "-Doptimize=ReleaseSafe",
"-Dtarget=" + target, "-Dversion=" + version,
"--prefix", str(ROOT / "zig-out" / target)]
if portable_host:
diff --git a/src/json_args.zig b/src/json_args.zig
index baa9e7f7..64f8527c 100644
--- a/src/json_args.zig
+++ b/src/json_args.zig
@@ -3,10 +3,10 @@
//! A model can emit any JSON shape as tool arguments — nothing constrains it
//! to what a tool's schema promises. Reading `v.object`/`v.string`/`v.array`
//! off a `std.json.Value` without first checking its active tag panics in a
-//! Debug build but is UNDEFINED BEHAVIOR in ReleaseFast (the shipped build):
-//! the union access is unchecked there, so a wrong-tag read silently
-//! reinterprets whatever bytes happen to be in the payload as an object/
-//! string/array header. Every accessor below returns null (or false, for
+//! Debug or ReleaseSafe (the shipped build) and is UNDEFINED BEHAVIOR in
+//! ReleaseFast, where the union access is unchecked and a wrong-tag read
+//! silently reinterprets whatever bytes happen to be in the payload as an
+//! object/string/array header. Every accessor below returns null (or false, for
//! `flag`) on a tag mismatch instead, so a caller can turn a malformed
//! argument tree into an ordinary `is_error` tool result the model can see
//! and react to, rather than a memory-safety incident.