Skip to content

fix(minimald): carry an in-box opt-out on the channel request - #3165

Merged
bryan-minimal merged 6 commits into
mainfrom
fix/tel045-opt-out-channel
Nov 10, 2026
Merged

bryan-minimal merged 6 commits into
mainfrom
fix/tel045-opt-out-channel

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Refs gominimal/inbox#515 (TEL-045 on a task box).

This PR follows #3148 and includes its commit. c6e42a62b is #3148 (the 712b fix: a task box's task gets the request's TRACEPARENT). This PR's own change is b3ea90ae2, 6f1d6ce18, 71090eb79 and 4da824fa7. Once #3148 merges, this branch is re-cut onto main without it.

The bug

TEL-045: a request whose CLI opted out must leave no recorded daemon span, and nothing under it may start a trace. The exec path does this: the CLI sends MINIMAL_OTEL=off on the channel, exec_span makes the exec span non-recording (adopt_opt_out), and taskenv::trace_env hands the box MINIMAL_OTEL=off and no TRACEPARENT (TEL-023).

Inside the box, the in-box min (env_min_helper.sh, __min_rpc) forwarded only a TRACEPARENT, as the traceparent% prefix (TEL-025). An opted-out box has none, so the helper sent a bare request, and channel_request_span minted a fresh root session.channel span and recorded it whenever the daemon exports. That is one recorded span per in-box request (run, materialize, net-expose, ...) from an opted-out caller, plus the trace-level log of the raw line, task argv included. It predates #3148 and covers every channel method, not only run. With #3148 a task could also be handed that fresh root's TRACEPARENT when the request carried no marker (an older helper's Line form, or a helper whose env lacked it).

The change

  • env_min_helper.sh: with MINIMAL_OTEL=off in the box, __min_rpc sends otel%off%<method>%<data> and never its TRACEPARENT (opt-out wins, as in trace_env). Otherwise nothing changes.
  • crates/minimald/src/env.rs:
    • channel_request_span returns a TaskTrace (OptedOut | Parent(Option<String>)). On otel%off% the span declares telemetry and goes through crate::exec::adopt_opt_out: it is non-recording, parents nothing and is spooled nowhere, and neither is anything under it. Any other otel%<v>% value is stripped and ignored, as opted_out ignores values other than off.
    • task_traceparent(sent, recorded): a task gets the request span's TRACEPARENT only when the helper sent a context. A bare request hands its task nothing, as before fix(minimald): give a task box's task the request's TRACEPARENT #3148.
    • run_task_trace takes the TaskTrace: OptedOut hands the task MINIMAL_OTEL=off and no TRACEPARENT, whatever the env (so a Line form gets it too); Parent keeps the env-marker fallback.
    • BoxChannel::run skips the trace-level session channel handling: <line> log for an opted-out request.
    • run_data_bytes skips an otel%<v>% prefix like the traceparent one, so an opted-out run with non-UTF-8 bytes keeps its invalid-byte marking.
  • Spec, docs/specs/25-spec-telemetry/25-spec-telemetry.md: the TEL-025 note says a box handed the marker sends the otel%off% prefix and no TRACEPARENT, so the daemon's span for the request records nothing and a task the request runs gets the marker; TEL-025's test note names the opted-out cases; TEL-045 lists the new unit test and lab scenario 712e.

Tests

  • an_opted_out_helper_request_records_no_span_and_opts_its_task_out: with an in-memory OTel exporter, the otel%off%run%... span is marked telemetry=opt-out, has no parent and exports nothing (nor does a child span), while the same bare request is exported; otel%on% is ignored; run_task_trace(OptedOut) over a Line-form request with an empty env gives exactly MINIMAL_OTEL=off.
  • a_bare_request_hands_its_task_no_traceparent: the task_traceparent truth table, and a Line-form request yields Parent(None) and adds no variable.
  • a_min_in_a_box_joins_the_outer_trace_through_the_helper_prefix (the shipped helper under bash): MINIMAL_OTEL=off sends otel%off%net-expose%8770 with or without a TRACEPARENT; MINIMAL_OTEL=on keeps the traceparent prefix.
  • The fix(minimald): give a task box's task the request's TRACEPARENT #3148 tests updated to TaskTrace; run_data_bytes gains two asserts.

Not covered

  • An older helper that opted out sends no marker of any kind. Its bare request's span is still recorded; its task gets no TRACEPARENT, and its run is opted out by run_task_trace's env fallback. Reading the env group before the span exists would close that; not done here.
  • A task-declared TRACEPARENT (minimal.toml env_vars) survives the opt-out, as on the exec path.
  • Info events inside an opted-out request (e.g. in-box task run starts task=t) are still log records, as on the exec path; argv is never logged there.
  • The helper reads only MINIMAL_OTEL=off, not a DO_NOT_TRACK set inside the box.

Verification

  • prepush (CI's exact commands): green at 4da824f
  • Lab: the release against this branch on ubuntu-24.04 and debian-12, x1 each. 712e (new: one daemon with telemetry on, a control min task run and a DO_NOT_TRACK=1 min task run; the opted-out run must add no session.channel or task_run span and its task must print no TRACEPARENT and MINIMAL_OTEL=off), 712b (fix(minimald): give a task box's task the request's TRACEPARENT #3148's: the control task gets the TRACEPARENT; FAIL on the release, PASS here), 717 (a min in a session joins the caller's trace) and 000-baseline:

OK: tel045-opt-out: 4 expectation(s) on ubuntu-24.04, debian-12: 712b-otel-switch-precedence:fail->pass 712e-otel-opt-out-task:fail->pass 717-otel-nested-min-trace:pass 000-baseline:pass

min-regress batch fixtel045: base rel-6a01d5ae vs the candidate cand-tel045-opt-out-29af2d46, per distro:

  • ubuntu-24.04: 712b {'fail': 1} -> {'pass': 1}; 712e {'fail': 1} -> {'pass': 1}; 717 {'pass': 1} -> {'pass': 1}; 000 {'pass': 1} -> {'pass': 1}
  • debian-12: 712b {'fail': 1} -> {'pass': 1}; 712e {'fail': 1} -> {'pass': 1}; 717 {'pass': 1} -> {'pass': 1}; 000 {'pass': 1} -> {'pass': 1}

Lab evidence (min-regress batch fixtel045 on anvil, debian-12, ubuntu-24.04)

Head: 4da824fa7ce06a8c6c968799639c613aa45abdf6 at 4da824f (lab name cand-tel045-opt-out-29af2d46). Base: rel-6a01d5ae (rel-6a01d5ae).

scenario distro base head
000-baseline: baseline (CPU + install sanity; not a bug) debian-12 pass pass
000-baseline: baseline (CPU + install sanity; not a bug) ubuntu-24.04 pass pass
712b-otel-switch-precedence: gominimal/inbox#515 Story 3: the switch precedence (OTEL_SDK_DISABLED, per-signal exporters) the off-test never reached debian-12 fail pass
712b-otel-switch-precedence: gominimal/inbox#515 Story 3: the switch precedence (OTEL_SDK_DISABLED, per-signal exporters) the off-test never reached ubuntu-24.04 fail pass
712e-otel-opt-out-task: gominimal/inbox#515 TEL-045 on a task box: a caller that opted out gets no daemon span for its task run, and its task is opted out debian-12 fail pass
712e-otel-opt-out-task: gominimal/inbox#515 TEL-045 on a task box: a caller that opted out gets no daemon span for its task run, and its task is opted out ubuntu-24.04 fail pass
717-otel-nested-min-trace: gominimal/inbox#515: a min run inside a session joins the caller's trace (Option A) debian-12 pass pass
717-otel-nested-min-trace: gominimal/inbox#515: a min run inside a session joins the caller's trace (Option A) ubuntu-24.04 pass pass

Fixed since base: 4. Still reproducing on both: 0. Regressed: 0. Passing on both: 4. A verdict links to the run's trace in Cloud Trace (project access needed); the scenario link is its source with the # issue: it reproduces.

Why each failed run failed: what the scenario measured, then what its trace recorded (error spans and warnings, most frequent first):

  • 712e-otel-opt-out-task on ubuntu-24.04 (base, trace b549f7b4): scenario: control_tp=TP-NONE control_otel=OTEL-UNSET optout_tp=TP-NONE optout_otel=OTEL-UNSET channel_spans=0:1:2 task_run_spans=0:1:1; trace: 1x minimald WARN Copying instead of hardlinking: cache and destination are on different filesystems; further cross-device copies this run are silent (first:
  • 712b-otel-switch-precedence on ubuntu-24.04 (base, trace cd5f37e1): scenario: control_files=2 control_spans=55 control_threads=2 control_conns=2 control_tp=TP-NONE sdk_true_files=0 sdk_true_threads=0 sdk_true_conns=0 sdk_true_spans=0 sdk_true_logs=0 sdk_true_tp=TP-NONE sdk1_spans=55 logs_only_logs=74 logs_only_spans=0 logs_only_tp=TP-NONE; trace: 2x minimald WARN Copying instead of hardlinking: cache and destination are on different filesystems; further cross-device copies this run are silent (first:
  • 712e-otel-opt-out-task on debian-12 (base, trace 09b33cc2): scenario: control_tp=TP-NONE control_otel=OTEL-UNSET optout_tp=TP-NONE optout_otel=OTEL-UNSET channel_spans=0:1:2 task_run_spans=0:1:1; trace: 1x minimald WARN Copying instead of hardlinking: cache and destination are on different filesystems; further cross-device copies this run are silent (first:
  • 712b-otel-switch-precedence on debian-12 (base, trace 2d427939): scenario: control_files=2 control_spans=55 control_threads=2 control_conns=2 control_tp=TP-NONE sdk_true_files=0 sdk_true_threads=0 sdk_true_conns=0 sdk_true_spans=0 sdk_true_logs=0 sdk_true_tp=TP-NONE sdk1_spans=55 logs_only_logs=74 logs_only_spans=0 logs_only_tp=TP-NONE; trace: 2x minimald WARN Copying instead of hardlinking: cache and destination are on different filesystems; further cross-device copies this run are silent (first:
Each cited run's verdict and evidence

Each cited run's last VERDICT or ENV line and its EVIDENCE line (the results.jsonl rows of batch fixtel045):

  • 712b-otel-switch-precedence ubuntu-24.04 base fail: VERDICT: control: the task got no TRACEPARENT although the daemon exported spans (TEL-023: files=2 spans=55 logs=74 threads=2 conns=2 tp=TP-NONE ran=1); EVIDENCE: control_files=2 control_spans=55 control_threads=2 control_conns=2 control_tp=TP-NONE sdk_true_files=0 sdk_true_threads=0 sdk_true_conns=0 sdk_true_spans=0 sdk_true_logs=0 sdk_true_tp=TP-NONE sdk1_spans=55 logs_only_logs=74 logs_only_spans=0 logs_only_tp=TP-NONE
  • 712b-otel-switch-precedence ubuntu-24.04 head pass: VERDICT: OTEL_SDK_DISABLED=true is inert (spool too), =1 is not, logs-only spools logs and adopts no trace; EVIDENCE: control_files=2 control_spans=55 control_threads=2 control_conns=2 control_tp=00-113779714071e7093842253f7fa24126-dec5b9b256d8e1e3-01 sdk_true_files=0 sdk_true_threads=0 sdk_true_conns=0 sdk_true_spans=0 sdk_true_logs=0 sdk_true_tp=TP-NONE sdk1_spans=55 logs_only_logs=74 logs_only_spans=0 logs_only_tp=TP-NONE
  • 712b-otel-switch-precedence debian-12 base fail: VERDICT: control: the task got no TRACEPARENT although the daemon exported spans (TEL-023: files=2 spans=55 logs=74 threads=2 conns=2 tp=TP-NONE ran=1); EVIDENCE: control_files=2 control_spans=55 control_threads=2 control_conns=2 control_tp=TP-NONE sdk_true_files=0 sdk_true_threads=0 sdk_true_conns=0 sdk_true_spans=0 sdk_true_logs=0 sdk_true_tp=TP-NONE sdk1_spans=55 logs_only_logs=74 logs_only_spans=0 logs_only_tp=TP-NONE
  • 712b-otel-switch-precedence debian-12 head pass: VERDICT: OTEL_SDK_DISABLED=true is inert (spool too), =1 is not, logs-only spools logs and adopts no trace; EVIDENCE: control_files=2 control_spans=55 control_threads=2 control_conns=2 control_tp=00-8d0c1a8879a4ff7a8697aeb3054866c8-3ce4267b9c16043e-01 sdk_true_files=0 sdk_true_threads=0 sdk_true_conns=0 sdk_true_spans=0 sdk_true_logs=0 sdk_true_tp=TP-NONE sdk1_spans=55 logs_only_logs=74 logs_only_spans=0 logs_only_tp=TP-NONE
  • 712e-otel-opt-out-task ubuntu-24.04 base fail: VERDICT: an opted-out task run is not opted out: opt-out:task-has-no-MINIMAL_OTEL=off(OTEL-UNSET) opt-out:daemon-recorded-1-session.channel-span(s); EVIDENCE: control_tp=TP-NONE control_otel=OTEL-UNSET optout_tp=TP-NONE optout_otel=OTEL-UNSET channel_spans=0:1:2 task_run_spans=0:1:1
  • 712e-otel-opt-out-task ubuntu-24.04 head pass: VERDICT: an opted-out task run leaves no daemon span and its task gets MINIMAL_OTEL=off, no TRACEPARENT; EVIDENCE: control_tp=00-97fcee2e1ec9b8606df55a3f20c9380d-f536f02e664ee061-01 control_otel=OTEL-UNSET optout_tp=TP-NONE optout_otel=off channel_spans=0:1:1 task_run_spans=0:1:1
  • 712e-otel-opt-out-task debian-12 base fail: VERDICT: an opted-out task run is not opted out: opt-out:task-has-no-MINIMAL_OTEL=off(OTEL-UNSET) opt-out:daemon-recorded-1-session.channel-span(s); EVIDENCE: control_tp=TP-NONE control_otel=OTEL-UNSET optout_tp=TP-NONE optout_otel=OTEL-UNSET channel_spans=0:1:2 task_run_spans=0:1:1
  • 712e-otel-opt-out-task debian-12 head pass: VERDICT: an opted-out task run leaves no daemon span and its task gets MINIMAL_OTEL=off, no TRACEPARENT; EVIDENCE: control_tp=00-54b394b669fd0f2262fb47e8a428d07f-7f7eb93e563d73d7-01 control_otel=OTEL-UNSET optout_tp=TP-NONE optout_otel=off channel_spans=0:1:1 task_run_spans=0:1:1
  • 717-otel-nested-min-trace ubuntu-24.04 base pass: VERDICT: nested min gets the caller's trace on opt-in, nothing when off; EVIDENCE: outer_trace=86299ac4d2e279e95c3e07ea8f6704f3 on_tp=00-86299ac4d2e279e95c3e07ea8f6704f3-724be1092a7d19da-01 on_leaked_headers=0 off_tp_injected=0
  • 717-otel-nested-min-trace ubuntu-24.04 head pass: VERDICT: nested min gets the caller's trace on opt-in, nothing when off; EVIDENCE: outer_trace=596d35c8b68aa6ba5aa68633eda3fe51 on_tp=00-596d35c8b68aa6ba5aa68633eda3fe51-c27f7a300720c506-01 on_leaked_headers=0 off_tp_injected=0
  • 717-otel-nested-min-trace debian-12 base pass: VERDICT: nested min gets the caller's trace on opt-in, nothing when off; EVIDENCE: outer_trace=ac7b0e9baeea710f00d2b888d2869752 on_tp=00-ac7b0e9baeea710f00d2b888d2869752-362af1a4d874a020-01 on_leaked_headers=0 off_tp_injected=0
  • 717-otel-nested-min-trace debian-12 head pass: VERDICT: nested min gets the caller's trace on opt-in, nothing when off; EVIDENCE: outer_trace=d77fa91b2f609146a6d38814acc40492 on_tp=00-d77fa91b2f609146a6d38814acc40492-b770689352e4b5db-01 on_leaked_headers=0 off_tp_injected=0
  • 000-baseline ubuntu-24.04 base pass: VERDICT: min runs; gcc (MPFR folding) and a cached binary work; EVIDENCE: task_rc=0 tries=1 hello_c=1 zstd=1
  • 000-baseline ubuntu-24.04 head pass: VERDICT: min runs; gcc (MPFR folding) and a cached binary work; EVIDENCE: task_rc=0 tries=1 hello_c=1 zstd=1
  • 000-baseline debian-12 base pass: VERDICT: min runs; gcc (MPFR folding) and a cached binary work; EVIDENCE: task_rc=0 tries=1 hello_c=1 zstd=1
  • 000-baseline debian-12 head pass: VERDICT: min runs; gcc (MPFR folding) and a cached binary work; EVIDENCE: task_rc=0 tries=1 hello_c=1 zstd=1

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Helper requests from boxes configured with MINIMAL_OTEL=off now opt out of trace recording and do not forward trace context. Tasks started by those requests also honor the opt-out.
  • Documentation
    • Telemetry guidance now covers the helper-request opt-out behavior and related checks.

bryan-minimal and others added 5 commits November 6, 2026 17:56
Since T43 (#2999) min task run starts the task as its box's entrypoint,
the in-box min task run. The exec's TRACEPARENT reaches that helper and
rides its run request as the trace prefix, but the channel built the
task's sandbox from the task's own variables, so the task got no
TRACEPARENT and a min it ran started a trace of its own (TEL-023).

The channel now adds the trace variables to the task's, as the sandboxed
task path does: the request span's TRACEPARENT when that span is
recorded (TEL-024), the opt-out marker for a helper that opted out
(TEL-045), and nothing with telemetry off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A box whose request opted out of telemetry has MINIMAL_OTEL=off and no
TRACEPARENT, so its in-box min sent a bare request. The channel then
minted a recorded root for it (TEL-045 says nothing is recorded), and
since the task box fix the task could be handed that root's TRACEPARENT.

The helper now sends the otel%off% prefix when the box has the marker,
and never its TRACEPARENT. The channel makes that request's span
non-recording, keeps its line out of the log, and hands a task it runs
MINIMAL_OTEL=off. A bare request, such as an older helper's Line form,
hands its task no TRACEPARENT: only a request that sent a context does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The request channel_request_span returns borrows the line, so the line must outlive the call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TEL-045 lists the env.rs opt-out test and lab scenario 712e, and drops the stale note that its
tests come later. TEL-025 says its helper test covers the opted-out prefix. The env.rs test doc
pointed at scenario 712c, an unrelated one; it is 712e.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
handle_lossy_line still passed None for handle_raw's old traceparent
argument; the parameter is a TaskTrace since the in-box opt-out, so pass
TaskTrace::Parent(None), as handle does. The minimald test target did not
compile (E0308).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 8, 2026 01:51
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The helper now sends an opt-out prefix when MINIMAL_OTEL=off. The daemon parses that prefix, excludes opted-out requests from trace logging, and carries trace and opt-out state through task dispatch. Tests and telemetry specifications cover these behaviors.

Changes: Helper telemetry handling

Layer / File(s) Summary
Request prefixes and opt-out dispatch
crates/minimald/src/env_min_helper.sh, crates/minimald/src/env.rs, docs/specs/25-spec-telemetry/25-spec-telemetry.md
The helper sends otel%off% without forwarding TRACEPARENT when MINIMAL_OTEL=off. The daemon parses the opt-out and traceparent prefixes, establishes request span state, and omits the request-line trace log for opted-out requests. Raw run data parsing skips either prefix. Tests and TEL-025 documentation cover this request handling.
Task trace variables
crates/minimald/src/env.rs, docs/specs/25-spec-telemetry/25-spec-telemetry.md
Dispatch passes TaskTrace through run_task to run_task_trace. The daemon derives task trace and opt-out variables from request state and the caller environment. Tests and TEL-045 references cover the propagation behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant InBoxMin
  participant MinimalDaemon
  participant Task
  InBoxMin->>MinimalDaemon: Send otel%off% request without TRACEPARENT
  MinimalDaemon->>MinimalDaemon: Mark request span non-recording
  MinimalDaemon->>Task: Pass opt-out state in task trace variables
Loading

Suggested reviewers: norrietaylor

Merge Risk: Minimal · up to 20837

The change makes an in-box helper honor telemetry opt-out for requests and the tasks they start. No unresolved merge-blocking risk was found, and the author reports tests and lab scenarios passing.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: carrying an in-box opt-out on the channel request. It follows the required Conventional Commit style.
Description check Passed The description explains the bug, the change, tests, and verification results in detail. It also identifies documentation updates. It does not use the template’s exact Summary and Testing headings or …
Docstring Coverage Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the bug, the change, tests, and verification results in detail. It also identifies documentation updates. It does not use the template’s exact Summary and Testing headings or include the Checklist section, but the required information is mostly covered.

Full details: Docstring Coverage

Explanation

Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 11 functions across 2 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Vale (3.24.0)

{
"Line": 13,
"Path": ".vale.ini",
"Text": "Style 'ste' isn't on the StylesPath (/styles). If it's a package, run vale sync.",
"Code": "E201",
"Span": 23
}

A rabbit checks the trace at night
“Off” goes in, with no parent in sight
The daemon keeps the request unrecorded
The task gets its marker, as encoded
Then hops away beneath the moon
With tests and specs in tune.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 27827dc7-c89f-4ad0-a8aa-11f7bb07b497
Commits

Reviewing files that changed from the base of the PR and between 4da824f and 20837c4.

Files selected for processing: 2

  • crates/minimald/src/env.rs
  • docs/specs/25-spec-telemetry/25-spec-telemetry.md
Files skipped from review as they are similar to previous changes: 1

  • docs/specs/25-spec-telemetry/25-spec-telemetry.md

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

@minimal-foundry

minimal-foundry Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Approved: no findings at 20837c4192f4.

Nothing to do.

Clobber: none found in the touched code.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 8, 2026

@agent-137 agent-137 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review on Karl's behalf, at 4da824fa7. This is a comment, not an approval. Nothing was built for it: every point comes from reading the code, and each finding says how it was checked.

  • CI at 4da824fa: all green.
  • Reviews: minimal-review APPROVE at head (3/3 personas, no findings). CodeRabbit APPROVED at head with a real review ("no actionable comments"), not a rate-limit pass.

Should-fix: none.

Nit: none.

No findings. What I checked:

  • Forging the opt-out (otel%off%) from inside a box gains nothing new.
    • Before this PR, a box could already send traceparent%00-<trace>-<span>-00%…. TraceContext::parse_traceparent (crates/minimald-rpc/src/trace.rs:161) accepts flags 00. adopt_trace then aligns the span under an unsampled parent, and the parent-based sampler drops it. That is the same mechanism mlog::otel::opt_out uses (crates/mlog/src/otel.rs:1349-1388).
    • The only new effect of a forged otel%off% is that the trace-level session channel handling: <line> log line is skipped.
    • The file log still keeps the session.channel span with box.id/session.id (set by the host, not by the box), method, and telemetry=opt-out.
    • Log events inside the request are still exported (opt_out docs: "Events logged inside are still log records").
    • The spans this suppresses are only the box's own request and its descendants.
  • Stripping the opt-out gains nothing either. A box that drops the prefix sends the bare line every box sends on main today, and gets a recorded root. #3165 also stops handing a task that root's TRACEPARENT: task_traceparent(sent, …) returns it only when the helper sent a context. The opt-out is the user's own choice, enforced by the user's own process in the box. A box that ignores it is no worse than MINIMAL_OTEL= min ….
  • Prefix parsing in channel_request_span:
    • otel%off with nothing after it is passed on as off.
    • otel%on%… is stripped and ignored, as opted_out ignores values other than off.
    • otel%off%traceparent%…%run%… leaves traceparent as the method. The dispatcher sends that to other, and run_data_bytes returns None for it, so the two agree.
  • run_task_trace(OptedOut): a Line-form request with no env gets exactly MINIMAL_OTEL=off, whether telemetry is on or off, which matches trace_env.
  • Helper (env_min_helper.sh): with MINIMAL_OTEL=off it never sends TRACEPARENT. Otherwise the 55-character regex gate is unchanged.

Verdict: ready to approve once #3148 merges and this branch is re-cut (or merge this one and close #3148).

@agent-137 agent-137 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving at 4da824fa7. The earlier comment review found nothing that needs fixing, and its nits are optional.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 10, 2026
Main took #3148's shape of the channel request's task trace (an
`Option<String>` for the request span's context); this branch's
`TaskTrace` carries that and the opt-out, so every conflicting site
keeps the branch's shape and main's call sites take it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@bryan-minimal

Copy link
Copy Markdown
Member Author

Merged main into the branch (20837c4), resolved by hand: main took #3148's shape of the channel request's task trace (an Option<String> for the request span's context, handed to the task only when the span is recorded); this branch's TaskTrace carries that case and the opt-out, so every conflicting site keeps the branch's shape and main's call sites take it. The lab re-ran the pre-push at the merged tip (green) and scenarios 712b, 712e, 717 and the baseline on Ubuntu 24.04 and Fedora against a release build of main: 712e goes fail -> pass; 712b, 717 and the baseline pass on both sides (the release already carries the 712b fix).

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Scope matches the title. The helper sends an otel%off% prefix. channel_request_span makes the span non-recording through crate::exec::adopt_opt_out. run_task_trace opts the task out. run_data_bytes skips the new prefix. The spec notes for TEL-025 and TEL-045 changed to match. Clobber none: each removed line in the diff has a replacement with the same intent, and the head merge from main adds no hunk outside the three files. Correctness The helper compares the value exactly to off, the same comparison as minimald_rpc::trace::opted_out. No other code builds or parses the traceparent% prefix: the helper and env.rs are the only places. The listener (BridgeChannel::forward) and the sandbox crate do not log the line. In run_task, the info events log the task name and not the argv. OTEL_PREFIX does not collide with a CHANNEL_METHODS entry. Two small gaps remain. The TEL-045 verify: line does not run the new test. No test checks that the session channel handling trace line is skipped for an opted-out request. Not checked I did not compile or run tests. I did not confirm that the in-memory exporter test passes under set_default. The PR states a green prepush at the code commit.

crates/minimal-client/src/lib.rs::do_not_track_sends_the_opt_out_and_no_traceparent;
crates/minimald/src/env.rs::an_opted_out_helper_request_records_no_span_and_opts_its_task_out
(the in-box helper's `otel%off%` request)
lab: 785, 712e

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

low · TEL-045 now lists an_opted_out_helper_request_records_no_span_and_opts_its_task_out under test:, but the verify: command does not run it. The nextest filter an_opted_out_request_leaves_no_daemon_span is not a substring of the new test name. A reader who runs the verify: line does not check the in-box path. Add the new test name to the verify: filter, or use a filter that matches both tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Taken in #3286, since this merged first: the verify line's filter is now an_opted_out, the stem all three unit tests share, so running it checks the in-box path too, and the test list names the new one below.

// (TEL-045), the file log's included.
if trace != TaskTrace::OptedOut {
tracing::trace!("session channel handling: {}", loggable_request(&line));
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

low · The PR fixes the trace-level session channel handling: <line> record for an opted-out request. TEL-045 requires "no command line". No test drives BoxChannel::run with an otel%off% line and checks that this record does not appear. The new unit test calls channel_request_span directly, so it bypasses this guard. A later change to the guard or to the log can bring the argv record back without a failure. rg 'session channel handling' finds only the log site.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Taken in #3286: an_opted_out_helper_request_keeps_its_line_out_of_the_log drives BoxChannel::run through the request sender with a plain public-exposure request and an otel%off% one, under a thread-local TRACE subscriber, and asserts the plain request's session channel handling record carries its line, the opted-out request's line is in no record, and every record under it carries the opt-out mark. A change to the guard at the record, or to the record itself, fails it.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 3f7f49c Nov 10, 2026
37 checks passed
@bryan-minimal
bryan-minimal deleted the fix/tel045-opt-out-channel branch November 10, 2026 21:47
yermakoffivan pushed a commit to yermakoffivan/minimal that referenced this pull request Nov 13, 2026
…erify runs it (gominimal#3286)

* test(minimald): drive an opted-out request through the channel, and verify runs it

Two review points on gominimal#3165 that merged open. The in-box path had no test
that drives `BoxChannel::run` with an `otel%off%` line and checks the
channel's own trace record, so a change to the guard at the record could
bring the command line back without a failure. The new test sends a plain
public-exposure request and an opted-out one through the request sender
under a thread-local TRACE subscriber: the plain request's
`session channel handling` record carries its line, the opted-out
request's line is in no record, and every record under it carries the
opt-out mark the export layer honours.

TEL-045's verify line now filters on the stem all three unit tests share,
so running it checks the in-box path too, and its test list names the new
one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* docs(specs): name TEL-045's three minimald tests on its verify line

The stem `an_opted_out` matched five minimald tests, two of them for
other requirements, so a rename or removal of a TEL-045 test left the
line green. The line names the three tests, as the other lines do.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants