Skip to content

🌟 Nova: Yaml Exporter for Trajectories#612

Open
madmax983 wants to merge 1 commit into
trunkfrom
yaml-exporter-4815380765560303509
Open

🌟 Nova: Yaml Exporter for Trajectories#612
madmax983 wants to merge 1 commit into
trunkfrom
yaml-exporter-4815380765560303509

Conversation

@madmax983
Copy link
Copy Markdown
Owner

💡 The Spark: "We have CSV, Markdown, HTML, and Mermaid exporters, but a structured human-readable data format like YAML is missing."
🚀 The Feature: "Implemented YamlExporter and the yaml-export feature for exporting trajectories."
🔮 The Potential: "Could be used to quickly inspect trajectories in the terminal with syntax highlighting (e.g. using bat) or to integrate with YAML-based tools."
⚠️ Risk: "Low. Isolated in src/trajectory/export.rs and CLI routing behind a feature flag."


PR created automatically by Jules for task 4815380765560303509 started by @madmax983

Implemented `YamlExporter` and the `yaml-export` feature for exporting trajectories to YAML format. Updated `bench inspect` to route `--format yaml` appropriately, and adjusted CLI help text and fallback paths.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new yaml-export feature and adds support for exporting trajectories in YAML format via the inspect command. It updates the CLI arguments, implements the YamlExporter with content redaction, and adds corresponding unit tests. The review feedback points out a potential security risk where exporting the entire Trajectory struct directly to YAML could leak sensitive metadata (such as local_workdir or manifest), and suggests clearing these fields before serialization.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/trajectory/export.rs
Comment on lines +253 to +271
fn export(trajectory: &Trajectory) -> String {
let redactor = Redactor::default_enabled();
let mut redacted_traj = trajectory.clone();

if let Some(task) = &mut redacted_traj.info.task {
*task = redactor.redact_text(task, surface::EXPORT).text;
}

if let Some(outcome) = &mut redacted_traj.info.outcome {
*outcome = redactor.redact_text(outcome, surface::EXPORT).text;
}

for msg in &mut redacted_traj.messages {
msg.content = redactor.redact_text(&msg.content, surface::EXPORT).text;
}

serde_yml::to_string(&redacted_traj)
.unwrap_or_else(|_| "Failed to export as YAML".to_string())
}
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.

security-medium medium

Exporting the entire Trajectory struct directly to YAML can accidentally expose sensitive metadata, such as local system paths in local_workdir or command-line history/git details in manifest. Other exporters (like Markdown or HTML) only export the conversation messages and basic info.

To prevent accidental data leaks when sharing exported YAML files, consider clearing these sensitive metadata fields before serialization.

    fn export(trajectory: &Trajectory) -> String {
        let redactor = Redactor::default_enabled();
        let mut redacted_traj = trajectory.clone();

        if let Some(task) = &mut redacted_traj.info.task {
            *task = redactor.redact_text(task, surface::EXPORT).text;
        }

        if let Some(outcome) = &mut redacted_traj.info.outcome {
            *outcome = redactor.redact_text(outcome, surface::EXPORT).text;
        }

        for msg in &mut redacted_traj.messages {
            msg.content = redactor.redact_text(&msg.content, surface::EXPORT).text;
        }

        // Clear sensitive or verbose metadata before exporting to prevent accidental leaks
        redacted_traj.info.manifest = None;
        redacted_traj.info.local_workdir = None;

        serde_yml::to_string(&redacted_traj)
            .unwrap_or_else(|_| "Failed to export as YAML".to_string())
    }

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

❌ Patch coverage is 21.42857% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.24%. Comparing base (472ab09) to head (a19b2b3).

Files with missing lines Patch % Lines
src/cli/mod.rs 21.42% 11 Missing ⚠️

❌ Your patch check has failed because the patch coverage (21.42%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk     #612      +/-   ##
==========================================
- Coverage   85.26%   85.24%   -0.02%     
==========================================
  Files         115      115              
  Lines       65856    65867      +11     
==========================================
+ Hits        56150    56151       +1     
- Misses       9706     9716      +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a19b2b3737

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/trajectory/export.rs
Comment on lines +269 to +270
serde_yml::to_string(&redacted_traj)
.unwrap_or_else(|_| "Failed to export as YAML".to_string())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Redact all serialized trajectory strings

When --format yaml is enabled, this serializes the entire trajectory after only redacting info.task, info.outcome, and messages[].content; fields that are now included only by the YAML exporter, such as info.other, verification_results, fork_lineage.tail_overrides, and message.extra.response/other, can still contain secret-looking strings in imported or legacy trajectories. Because the other exporters do not emit these nested fields, enabling YAML can expose unredacted API keys or tokens unless the exporter recursively redacts the whole structure before serde_yml::to_string.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant