feat: propagate W3C trace context to spawned agents - #3
Merged
Conversation
Apply only the isolated upstream PR-995 trace-context feature delta on top of the current fork main, which already carries canonical Firstmate content from the fork-sync merge. This makes the already-validated, default-off W3C trace-context capability available on the captain's integration fork without waiting for the canonical upstream merge of PR 995. The change is the exact PR-995 feature delta (a53ffc1..2ff8ab8, the validated integration merge of PR-995 head 2fbe2fd), applied with cherry-pick -m1 so the trace-context implementation is preserved with no semantic delta; every feature-only file is byte-identical to the PR-995 head. Three genuine overlaps with the newer canonical commit kunchenguid#1303 (bound and consolidate startup memory during stow) are resolved by preserving both behaviors: the inheritable-config set in bin/fm-config-inherit-lib.sh, the config-push list in docs/configuration.md, and the inheritance comment in tests/fm-secondmate-harness.test.sh now declare both startup-memory-budget and trace-context. No canonical kunchenguid#1303 content is dropped and no unrelated upstream content is reintroduced. Focused suites pass: fm-trace-context-lib, fm-trace-context-spawn, fm-session-start, fm-documentation-audiences, fm-secondmate-harness, and bin/fm-lint.sh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Intent
Make the already-validated upstream PR-995 native W3C trace-context capability available on the captain's integration fork (allstargg/firstmate) without waiting for the canonical upstream merge of PR 995. This is a deliberate, exact port: the trace-context implementation is preserved byte-for-byte from PR-995 head 2fbe2fd (every feature-only file is byte-identical), applied as the isolated feature delta (a53ffc1..2ff8ab8) via cherry-pick -m1 onto current fork main. Fork main already carries canonical Firstmate content from an earlier squash fork-sync, so this change is intentionally scoped to ONLY the trace-context feature: the 22 changed files are exactly PR 995's files. Three genuine overlaps with the newer canonical commit kunchenguid#1303 (bound and consolidate startup memory during stow) were resolved BY DESIGN to preserve BOTH behaviors - bin/fm-config-inherit-lib.sh, docs/configuration.md, and tests/fm-secondmate-harness.test.sh now declare both startup-memory-budget and trace-context in their shared config lists/comments; no canonical content was dropped and no old upstream content reintroduced. The capability is default-off (presence flag config/trace-context plus FM_TRACE_CONTEXT override), propagates a W3C traceparent to spawned agents, freezes its decision at locked session start, and inherits into secondmate homes. PR 995 passed 10/10 upstream checks and the focused suites (trace-context lib/spawn, session-start, documentation-audiences, secondmate-harness, lint) pass locally. The exact integrated trace-context tree is required and must not be altered; the cherry-pick merge strategy and the kunchenguid#1303 overlap resolutions were explicitly captain-approved.
What Changed
traceparentpropagation and metadata recording for spawned agents, including inherited child traces and stable relaunch context.Risk Assessment
✅ Low: The trace-context port is well-bounded and source evidence shows the required default-off behavior, locked-session decision, spawn propagation, metadata agreement, secondmate inheritance, and approved overlap resolutions remain intact.
Testing
The required startup check was clean; focused library, real spawn-path, locked-session, secondmate-inheritance, documentation, backend-carrier, and test-run fixtures all passed, with transcripts demonstrating default-off behavior, identical recorded/injected W3C carriers, safe failure handling, frozen decisions, relaunch identity, and primary-to-secondmate-to-worker propagation. This is a shell capability with no rendered UI, so visual screenshots were not applicable.
Evidence: End-to-end trace-context spawn transcript
Evidence: Secondmate inheritance transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
git diff --stat --name-only a1f63638e5c5f87b12d5ab81d1eac72d4bbedea5..5bd5bb7d60f4dd0da467ef5871e0f6d3926a1171bin/fm-session-start.shbash tests/fm-trace-context-lib.test.shbash tests/fm-trace-context-spawn.test.shbash tests/fm-session-start.test.shbash tests/fm-secondmate-harness.test.shbash tests/fm-documentation-audiences.test.shbash tests/fm-backend-cmux.test.shbash tests/fm-backend-zellij.test.shbash tests/fm-test-run.test.shInspected the three #1303 overlap surfaces withrg -n 'startup-memory-budget|trace-context' bin/fm-config-inherit-lib.sh docs/configuration.md tests/fm-secondmate-harness.test.shChecked evidence logs for failure markers and confirmedgit status --shortremained cleandocs/trace-context.md:25-docs/trace-context.mdclaims coverage across every harness but omits the fork's verifiedpi-signedharness. Addingpi-signedwould fix the authoritative trace-context guide, but would violate the explicit requirement that every feature-only PR-995 file remain byte-identical. Recommend preserving the required exact port unless the captain authorizes this one-word documentation divergence; declining leaves this sentence inaccurate forpi-signed.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.