Skip to content

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

Python

fix(learn): a --no-telemetry session keeps its background trial local

Rach Pradhan38bf84523857
diff --git a/src/main.zig b/src/main.zig
index 898adc67..e0b5b779 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -481,7 +481,7 @@ pub fn main(init: std.process.Init) !void {
session_run.compactResumedSession(&root);
// Closing the learning loop: this session counts toward the next trial.
- defer session_run.startBackgroundLearning(gpa, arena, io, init.environ_map, &invocation_budget);
+ defer session_run.startBackgroundLearning(gpa, arena, io, init.environ_map, &invocation_budget, !flags.no_telemetry_flag);
// `graff repl`: interactive chat REPL on the zigzag TUI, backed by the REAL agent loop — each prompt runs a full root turn (tools + MCP) via
// replTurnCb, reusing the root agent's tool set + registry + system prompt. Self-contained — exits after.
diff --git a/src/session_run.zig b/src/session_run.zig
index 459a0ba0..775d78e4 100644
--- a/src/session_run.zig
+++ b/src/session_run.zig
@@ -532,10 +532,12 @@ pub fn learningNotice(io: Io, arena: Allocator, environ_map: anytype, out: *Io.W
/// Closing the learning loop: a session that did real model work counts toward
/// this workspace's next trial and, on cadence, starts one in the background.
/// Workspaces with no learning store skip silently.
-pub fn startBackgroundLearning(gpa: Allocator, arena: Allocator, io: Io, environ_map: *const std.process.Environ.Map, budget: *const run_budget_mod.RunBudget) void {
+pub fn startBackgroundLearning(gpa: Allocator, arena: Allocator, io: Io, environ_map: *const std.process.Environ.Map, budget: *const run_budget_mod.RunBudget, telemetry_allowed: bool) void {
switch (learn_auto.maybeStart(gpa, arena, io, environ_map, .{
.model_calls = budget.used(),
- .contribute = main_mod.g_fleet and learning_privacy.allowsAggregate(),
+ // A session launched with --no-telemetry keeps its trial local, even
+ // though the child process would not inherit that flag.
+ .contribute = telemetry_allowed and main_mod.g_fleet and learning_privacy.allowsAggregate(),
})) {
.started => |started| std.debug.print(
"↺ learning trial started in the background{s}{s} — `graff learn status`, log .graff/learn/{s}\n",