Skip to content

fix(#2779): respect inbound TRACEPARENT in trace chain - #2833

Closed
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/2779-respect-inbound-traceparent
Closed

fix(#2779): respect inbound TRACEPARENT in trace chain#2833
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/2779-respect-inbound-traceparent

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

When fullsend runs inside an instrumented pipeline that already exports TRACEPARENT, the runner now adopts the inbound trace-id (continuing the distributed trace chain) instead of generating a fresh one. The W3C trace-flags sampled bit is preserved so upstream sampling decisions are honored. The security trace-id is derived from the inbound trace-id via UUID reformatting.

Additionally, childScriptEnv now filters any pre-existing TRACEPARENT from os.Environ() before appending, ensuring exactly one entry is present regardless of the parent environment.

Shell interpolation guards (injectTraceID, buildScanContextCommand) use the new IsShellSafeTraceID validator that accepts any dashed-hex UUID format, not just UUID v4, since adopted trace-ids may have arbitrary version/variant bits.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Closes #2779

Post-script verification

  • Branch is not main/master (agent/2779-respect-inbound-traceparent)
  • Secret scan passed (gitleaks — eb4cd140210bf3a65693a3c748889102b0ef5f6a..HEAD)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

When fullsend runs inside an instrumented pipeline that already exports
TRACEPARENT, the runner now adopts the inbound trace-id (continuing the
distributed trace chain) instead of generating a fresh one. The W3C
trace-flags sampled bit is preserved so upstream sampling decisions are
honored. The security trace-id is derived from the inbound trace-id via
UUID reformatting.

Additionally, childScriptEnv now filters any pre-existing TRACEPARENT
from os.Environ() before appending, ensuring exactly one entry is
present regardless of the parent environment.

Shell interpolation guards (injectTraceID, buildScanContextCommand) use
the new IsShellSafeTraceID validator that accepts any dashed-hex UUID
format, not just UUID v4, since adopted trace-ids may have arbitrary
version/variant bits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner July 1, 2026 07:51
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Site preview

Preview: https://01b387ed-site.fullsend-ai.workers.dev

Commit: f25746e7f1fc8d0fc4118234b7d5449e2337ffef

@rh-hemartin

Copy link
Copy Markdown
Member

Didn't mean to get this autocoded.

@rh-hemartin rh-hemartin closed this Jul 1, 2026
@rh-hemartin
rh-hemartin deleted the agent/2779-respect-inbound-traceparent branch July 1, 2026 07:53
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.46154% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/cli/run.go 24.00% 18 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@fullsend-ai-retro

fullsend-ai-retro Bot commented Jul 1, 2026

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 7:57 AM UTC · Completed 8:02 AM UTC
Commit: f25746e · View workflow run →

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #2833 — Unwanted autocoding from /fs-triage

What happened: rh-hemartin ran /fs-triage on issue #2779 at 07:27 UTC, likely intending to get a triage analysis. The triage agent completed at 07:33 and autonomously applied the ready-to-code label. This triggered the code agent, which ran for ~14 minutes and opened PR #2833. The human closed the PR 2 minutes later with "Didn't mean to get this autocoded."

Wasted work: ~14 minutes of code agent compute (266 additions across 6 files) plus review/retro dispatches — all discarded.

Existing related issues: #2314 (require confirmation for bot-created issues) and #1536 (guardrail for retro-filed issues) cover narrower scenarios. The proposal below addresses the general case of /fs-triage auto-applying ready-to-code.

1 proposal filed targeting fullsend-ai/fullsend.

Proposals filed

dhshah13 added a commit to dhshah13/fullsend that referenced this pull request Jul 2, 2026
When a parent process exports TRACEPARENT (nested or instrumented
invocation), fullsend now continues that trace instead of starting its
own: the inbound trace-id becomes the unified security/W3C trace id, the
inbound span-id is recorded as the root span's remote parent, and the
inbound trace-flags are preserved through child-script TRACEPARENT, the
recorder, and run-summary.json (previously hardcoded to sampled).

childScriptEnv now filters any TRACEPARENT already present — inherited
from the process environment or set in runner_env — so exactly one
entry, fullsend's own, is seen by child scripts; env lookups resolve the
first match, so a stale value used to shadow it. TRACESTATE passes
through untouched. The shell-safety call sites switch to
IsShellSafeTraceID since adopted ids are not UUID v4.

The adoption logic lives in resolveTraceIdentity, a pure helper, so the
behavior is unit-testable outside runAgent.

Supersedes and ports fullsend-ai#2833 (closed unmerged for process reasons), adding
the remote-parent record, summary flag fidelity, and W3C
forward-compatible version parsing that the original missed.

Signed-off-by: Dharit Shah <dhshah@redhat.com>
dhshah13 added a commit to dhshah13/fullsend that referenced this pull request Jul 2, 2026
When a parent process exports TRACEPARENT (nested or instrumented
invocation), fullsend now continues that trace instead of starting its
own: the inbound trace-id becomes the unified security/W3C trace id, the
inbound span-id is recorded as the root span's remote parent, and the
inbound trace-flags are preserved through child-script TRACEPARENT, the
recorder, and run-summary.json (previously hardcoded to sampled).

childScriptEnv now filters any TRACEPARENT already present — inherited
from the process environment or set in runner_env — so exactly one
entry, fullsend's own, is seen by child scripts; env lookups resolve the
first match, so a stale value used to shadow it. TRACESTATE passes
through untouched. The shell-safety call sites switch to
IsShellSafeTraceID since adopted ids are not UUID v4.

The adoption logic lives in resolveTraceIdentity, a pure helper, so the
behavior is unit-testable outside runAgent.

Supersedes and ports fullsend-ai#2833 (closed unmerged for process reasons), adding
the remote-parent record, summary flag fidelity, and W3C
forward-compatible version parsing that the original missed.

Signed-off-by: Dharit Shah <dhshah@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Triggers review agent dispatch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Respect a pre-existing TRACEPARENT in the security trace chain

1 participant