Skip to content

Pre/post scripts get no spans in the run trace #9749

Open

Description

@ascerra

What happens

ADR 0050 deferred pre/post script span instrumentation to implementation. It says pre-scripts, post-scripts and validation scripts "do significant work but aren't addressed in span structure", and leaves open whether the framework instruments them or gives scripts a contract to emit spans. Neither has been built yet.

A post-script that exits 0 leaves no record of what it did. The code agent's post-script pushes the branch and opens the pull request, or posts "No PR created" and exits 0 when the agent made no changes. Scoring reads the run's run-telemetry.jsonl, so it can't tell those two runs apart. Triage on #9745 found the same, that no commit-count or PR attributes are emitted today.

What should happen

Each pre-script, post-script and validation script that runs gets a span in the run trace with its exit code. Scripts get a supported way to add records to it, for example the pull request a post-script opened or why it opened none. These records reach run-telemetry.jsonl and the OTLP export like the runner's own spans.

Records that can hold private text, such as an issue's text or a pull request body, are dropped from the published telemetry file at the metadata artifact level, as the pre-script skip reason already is.

Related

  • #9745 asks trace_fitness to score what a run delivered, and its triage notes the PR information may only come from the post-script. This issue is the general way for a script to add that kind of record.
  • #7413 proposes a post-outcome.json that post-scripts write to report what they did. That could be one source for these records.
  • ADR 0165 (open PR #9264) has the journal called from pre/post scripts. Those calls could add their records the same way. This issue doesn't depend on it.
  • #9060 (ADR 0154) and #6433 are about joining related runs. This issue is about what one run's trace contains.

Activity

  1. fullsend-ai-triage commented on Nov 20, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 2:59 PM UTC · Completed 3:01 PM UTC

    Commit: 227f3cb · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.16

  2. added
    feature
    triaged
    type/feature
    component/runner
    on Nov 20, 2026
  3. fullsend-ai-triage commented on Nov 20, 2026

    @fullsend-ai-triage

    Triage found this actionable as a feature request. It is the pre/post/validation-script item that ADR 0050 explicitly deferred to implementation. The code locations the issue points to still exist: script handling in internal/cli/run.go, the span and export code in internal/telemetry/, and the metadata-level stripping in internal/artifacts/telemetry.go.

    Related work (checked): no open PR addresses this issue. #9745 (trace_fitness deliverables) would consume these records. #7413 (post-outcome.json) and ADR 0165 (PR #9264) are possible sources for records, but they are not prerequisites, as the issue says.

    Open design point for maintainers (not the reporter): the exact contract for scripts to emit records (a file or env-var channel the runner reads after the script exits, or reuse of #7413's artifact) is not settled in the repo. It should be decided in the implementation or a short ADR update. Records from scripts are untrusted input, so the contract should cap their size and count and tag which keys are private text so StripTelemetry can drop them.

    Suggested test:

    Run a harness with a post-script that exits 0 and emits a record via the contract.
    Assert run-telemetry.jsonl has a child span of the run span for the post-script with exit code 0 and the record.
    Repeat for a failing script and a pre-script skip.
    Apply the metadata-level strip and assert private-text records are removed while the exit code remains.
    Assert oversized or malformed script records are bounded or rejected without failing the run.
    

    This is a feature, so it is not auto-promoted to code and will wait for human prioritization.


    Labels: This is a new-capability request in the agent runner's tracing and telemetry behavior.


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/runnerfeaturetriagedtype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions