Skip to content

Convert Atomic sessions to the unified session format - #77052

Merged
pelikhan merged 4 commits into
mainfrom
atomic-session-converter
Nov 13, 2026
Merged

pelikhan merged 4 commits into
mainfrom
atomic-session-converter

Conversation

@lavaman131

@lavaman131 lavaman131 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

cc @pelikhan

Convert Atomic CLI output into gh-aw's unified agent session format and step summaries by running Atomic with --mode json and sharing the Pi v3 JSONL parser.

What changed

  • Switch .github/workflows/shared/atomic.md from --mode text to --mode json, declare behaviors.log-parser calling parseAtomicLog, and run line-aware JSONL secret redaction followed by a textMode pass on captured stdout so both JSON-escaped and multi-line raw secrets are masked while keeping JSONL valid.
  • Add parseAtomicLog to actions/setup/js/parse_pi_log.cjs and register atomic in actions/setup/js/engine_log_parser.cjs (sessionParsers and declaredFirstParserPolicies) without duplicating the Pi parser. Session events, step summaries, and reconstructed unified sessions record sourceEngine: "atomic" and retain createdAt timestamps from Atomic v4 session headers.
  • Fix a cross-turn collision in actions/setup/js/pi_session.cjs (transformPiV3Entries and computePiV3Stats) when an OpenAI-compatible proxy reuses the same responseId across turns. Turn boundaries now reset active message-state and stats maps, and agent_end reconciles transcript snapshots in turn order instead of overwriting earlier turns or duplicating the final assistant message.
  • Move the Atomic stdout/stderr redaction policy into actions/setup/js/atomic_output_redaction.cjs (createAtomicOutputSanitizers), which the harness loads, and add it to the files actions/setup/setup.sh installs. The sample keeps --no-session; Atomic still emits its v4 session header in JSON mode.
  • Recompile smoke-atomic.lock.yml and engine-conformance-atomic.lock.yml, update the Atomic row in docs/src/content/docs/reference/third-party-agent.md, and add a patch changeset.

Compatibility

  • Safe-output ingestion (GH_AW_SAFE_OUTPUTS -> collect_ndjson_output.cjs -> agent_output.json), BinEval grading, threat detection, conformance post-steps, and non-zero failure exits continue to work unchanged.
  • Existing Pi v3 logs (which supply timestamp or omit it on session headers) and legacy flat logs keep sourceEngine: "pi" and identical event projections; session headers that carry createdAt without a primary timestamp now also project createdAt onto session.init.timestamp for both pi and atomic, and the responseId collision fix benefits both engines.

Validation

  • make build and ./gh-aw compile smoke-atomic engine-conformance-atomic daily-declarative-engine-improver --validate: 3 workflows compiled.
  • go test ./pkg/workflow -run Atomic and go test ./pkg/cli -run Session: passed.
  • GH_AW_ATOMIC_TEST_CLI=<@bastani/[email protected] cli> go test ./pkg/workflow -run Atomic -count=1: passed. This includes the live --mode json native MCP and provider stream tests, plus unified session verification of the captured output.
  • cd actions/setup/js && npx vitest run atomic_session_pipeline atomic_output_redaction pi_session parse_pi_log rendering_scripts_verifier: 9 files, 149 passed, 1 skipped.
  • make agent-report-progress (Go lint, custom linters, JavaScript lint, impacted tests, full lock-file drift check): passed.
  • Live GitHub Actions runs of smoke-atomic and engine-conformance-atomic were not dispatched from this local checkout.

Base automatically changed from atomic-tools-schedule-storage to main November 12, 2026 04:33
@lavaman131
lavaman131 force-pushed the atomic-session-converter branch from d7c6e0a to a77db04 Compare November 12, 2026 05:09
@lavaman131
lavaman131 changed the base branch from main to atomic-durable-storage November 12, 2026 05:09
@lavaman131
lavaman131 marked this pull request as ready for review November 12, 2026 05:09
@lavaman131
lavaman131 added this pull request to stack #77068 November 12, 2026 05:09
Copilot AI adaptive review requested due to automatic review settings November 12, 2026 05:09
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #77052

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions github-actions 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.

Reviewed the changed lines and found no actionable correctness, regression, performance, or security issues. The responseId collision handling and Atomic unified-session integration are covered by the added tests. Specialist pass was unavailable because its file access was denied; this review is based on the pre-fetched diff and source inspection.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

@github-actions github-actions 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.

What this change does: Atomic emits JSONL and uses the Pi parser to produce unified sessions. The parser also separates turns when response IDs repeat.

Should fix: 1. Reuse the captured stream in the Pi regression test; it satisfies the existing assertions and removes duplicate setup.

Verdict: Ship.
Lean: -43 lines possible.

Generated by ✂️ Ponytail Reviewer for #77052 · codex · routed: gpt61 medium · ~9 AIC · ⌖ ~1 AIC · ⊞ 181
Comment /ponytail to run again

stopReason: "stop",
usage: { input: 5, output: 2, cacheRead: 0, cacheWrite: 0, reasoning: 0, totalTokens: 7, cost: { total: 0 } },
};
const records = [

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.

Should fix: This recreates the same two-turn reused-response-ID stream already in fixtures/atomic_ci_stream.cjs; import atomicWorkflowStream and keep these assertions, which all pass with that fixture, to remove 44 lines of duplicate setup and avoid maintaining two copies of the same case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in dcd590e839 to import and reuse atomicWorkflowStream from fixtures/atomic_ci_stream.cjs with the same assertions.

@github-actions github-actions 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs, /tdd, and /codebase-design. Requesting changes because stdout redaction regressed for multi-line secrets.

📋 Key Themes and Highlights

Key Themes

  • Redaction regression (blocking): sanitizeStdout no longer uses textMode. A multi-line raw secret leaks. I reproduced this with a Node probe. Adding a textMode pass after the line-aware pass closes the leak and keeps JSONL valid.
  • Pi output change (question): session.init now carries timestamp from createdAt. This contradicts the claim that existing Pi projections are identical. I could not confirm against the base commit in this sandbox.
  • Reconciliation path (suggestion): the agent_end identity-vs-position fallback needs a comment and a test.

Positive Highlights

  • ✅ The responseId reuse fix in pi_session.cjs has a clear regression test.
  • ✅ The end-to-end atomic_session_pipeline.test.cjs covers the new parser path.
  • ✅ The captured JSONL fixture gives realistic coverage.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

continue;
}
const messageID = messageIdentity(message);
const byIdentity = messageID !== undefined ? identityStates.get(messageID)?.find(candidate => !consumedStates.has(candidate)) : undefined;

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.

[/codebase-design] The agent_end path adds a second reconciliation route. It picks byIdentity when available, otherwise it falls back to a position-based state. The fallback is reasonable, but the choice is not documented or tested.

💡 Suggested change

Add a short comment on why identity matching is preferred and when the position fallback applies. Add a test where responseId is absent on the agent_end message.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Documented and tested in dcd590e839. Added a comment explaining why identity matching in turn order runs first and when the position fallback applies, added a regression test where the trailing partial agent_end assistant message has no responseId, and preserved openAssistantState before iterating agent_end.messages so reconciling earlier turns does not overwrite the open partial turn.

else if (raw.type === "turn_start") {
} else if (raw.type === "session") {
const init = emit(raw, "session.init", { sourceEngine, sessionId: raw.id, cwd: raw.cwd, model: raw.model });
retainMessageTimestamp(init, { timestamp: raw.createdAt });

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.

[/tdd] session.init now takes createdAt as its top-level timestamp. The PR says existing Pi projections are identical, so this looks like a behavior change for Pi logs too.

💡 Suggested test

Add a Pi-regression assertion that pins the session.init projection, or note in the PR description that this field is intentionally added for Pi. I could not confirm the base output because the sandbox could not fetch the base commit.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kept this intentionally for both pi and atomic in dcd590e839, added a Pi regression test in pi_session.test.cjs, and updated the PR description. Existing Pi v3 session headers use timestamp (which createSessionEvent already copied onto session.init.timestamp on main) or omit both fields; retainMessageTimestamp only populates session.init.timestamp from createdAt when timestamp, ts, time, and created_at are all absent.

Comment thread .github/workflows/shared/atomic.md Outdated
}
const stdout = sanitize(result.stdout);
const stderr = sanitize(result.stderr);
const stdout = sanitizeStdout(result.stdout);

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.

[/diagnosing-bugs] Stdout redaction regression: sanitizeStdout now runs the line-aware path without textMode. A multi-line secret that appears as raw (non-JSON-escaped) text is not matched per line and leaks. I reproduced this with a Node probe, while the old textMode path redacted it.

💡 Suggested fix and test

Run the line-aware pass, then a textMode: true pass over its output. The second pass closes the leak and keeps JSONL lines valid. Add a regression test in atomic_session_pipeline.test.cjs with a multi-line raw secret on the stdout path.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in dcd590e839. Both harness-script and durable.harness-script in shared/atomic.md now run the line-aware JSONL pass followed by sanitizeText (textMode: true), and the Atomic workflows are recompiled. Added a red-first regression test in atomic_session_pipeline.test.cjs covering both harness scripts with a multi-line raw secret and JSON-escaped secrets on stdout, verifying that every JSONL line remains valid and passes unified session validation.

Copilot AI 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.

🟡 Changes recommended

Registered credentials split across JSONL delta records remain reconstructable in stdout and logs, exposing secrets even when final snapshots are redacted.

3 open issues
What changed in this PR

Adds unified-session conversion and step summaries for the experimental Atomic engine, building on its durable-session support.

Changes:

  • Switch Atomic to JSON output with JSON-aware stdout redaction and declared log parsing.
  • Reuse the Pi parser while preserving Atomic identity and timestamps, and fix cross-turn response-ID collisions.
  • Add regression and pipeline coverage, regenerate workflow locks, and update documentation and release notes.
File Description
pkg/​workflow/​atomic_workflow_test.go Verify JSON invocation, parser wiring, and captured CLI sessions.
pkg/​cli/​session_parser_test.go Add Atomic session reconstruction coverage.
docs/​src/​content/​docs/​reference/​third-party-agent.md Document Atomic’s structured session support.
actions/​setup/​js/​rendering_scripts_verifier.test.cjs Register Atomic for rendering verification.
actions/​setup/​js/​pi_session.test.cjs Cover response-ID reuse across turns.
actions/​setup/​js/​pi_session.cjs Separate turn state and accounting; preserve engine identity and timestamps.
actions/​setup/​js/​parse_pi_log.cjs Expose Atomic parsing through the shared Pi implementation.
actions/​setup/​js/​fixtures/​atomic_ci_stream.cjs Add a captured Atomic tool-call transcript.
actions/​setup/​js/​engine_log_parser.cjs Register Atomic parsing and parser-selection policy.
actions/​setup/​js/​atomic_session_pipeline.test.cjs Test summaries, unified sessions, and reconstruction end to end.
.github/​workflows/​smoke-atomic.lock.yml Regenerate smoke execution and summary parsing.
.github/​workflows/​shared/​atomic.md Declare JSON execution, stdout redaction, and log parsing.
.github/​workflows/​engine-conformance-atomic.lock.yml Regenerate conformance execution and summary parsing.
.changeset/​patch-atomic-unified-session-converter.md Record the conversion feature and collision fix.

Review effort: Max (auto)

Comment thread .github/workflows/shared/atomic.md Outdated
Comment on lines +157 to +159
const sanitizeStdout = output => redactArtifactMaskedValues(
output?.toString("utf8") || "", [...sensitiveValues], undefined, () => "[REDACTED]"
);
- --print
- --mode
- text
- json
Comment thread .github/workflows/shared/atomic.md Outdated
Comment on lines +157 to +159
const sanitizeStdout = output => redactArtifactMaskedValues(
output?.toString("utf8") || "", [...sensitiveValues], undefined, () => "[REDACTED]"
);
@lavaman131

Copy link
Copy Markdown
Contributor Author

/matt

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions github-actions 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.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~12 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread .github/workflows/shared/atomic.md Resolved
Comment thread .github/workflows/shared/atomic.md Resolved
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest atomic-durable-storage using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (.github/workflows/shared/atomic.md:157): address unresolved feedback - Review comment
  3. Review (.github/workflows/shared/atomic.md:160): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "dcd590e839146a65ee19552c631b33590ba4ec2f",
  "kind": "requested",
  "schema_version": "1",
  "state": "a5df464c09162e6e3983a1e4594f9c1b51529def4ab9e616feb68a34a367cebb",
  "work": [
    "741d37030d263a1ae13bd54df36d8406ceaac58c51479cfb00c2ffb23ed394fa",
    "eb4781d22ceb50fdb7a86e2bde7b1a2eee7c788463ed82dbe1f0708777f1c387"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

@pelikhan

Copy link
Copy Markdown
Collaborator

@lavaman131 try to use indenpendt PRs. Stacks don't work well on the iOS app.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest atomic-durable-storage using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (.github/workflows/shared/atomic.md:157): address unresolved feedback - Review comment
  3. Review (.github/workflows/shared/atomic.md:160): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "6c1b0ef24f3794b0349eeace8f404ac0071e5bce",
  "kind": "requested",
  "schema_version": "1",
  "state": "9cc9a68a06a2e1c0c4e86f8de5cc8fad5df9e56e2ed73bfe6afd425f823c14b8",
  "work": [
    "741d37030d263a1ae13bd54df36d8406ceaac58c51479cfb00c2ffb23ed394fa",
    "eb4781d22ceb50fdb7a86e2bde7b1a2eee7c788463ed82dbe1f0708777f1c387"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

Copilot AI commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged the latest atomic-durable-storage base into this branch in merge commit 6f28e07785e1f9e077e7abe6f982b8414336b0e5, preserving the Atomic JSON mode, shared redaction fixes, and durable-storage updates. make agent-report-progress passed (365 workflows compiled; repository-wide warnings remain). Targeted Go/JS tests, lint, and Atomic workflow compilation also passed. No CI was dispatched, per the request.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest atomic-durable-storage using make merge-main, resolving any conflicts and preserving the intended changes.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "6f28e07785e1f9e077e7abe6f982b8414336b0e5",
  "kind": "requested",
  "schema_version": "1",
  "state": "7c0525ed2f1139d67b146c095ee61bc3085f05ac6844b2bd349f30f978ec8f1d",
  "work": [],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

Switch the Atomic sample to --mode json, declare its log parser, and register atomic on the shared Pi v3 session parser path with sourceEngine set to atomic and session v4 createdAt timestamps retained. Fix cross-turn message and usage collisions in pi_session.cjs when an OpenAI-compatible proxy reuses response IDs across turns.
Run a textMode redaction pass after line-aware JSONL redaction in the Atomic harness script so multi-line raw secrets on stdout are masked while keeping JSONL lines valid. Preserve the open assistant state across earlier agent_end messages, document the identity-vs-position fallback, pin session.init createdAt timestamp projection for Pi, and reuse atomicWorkflowStream in the shared Pi regression test.
@lavaman131
lavaman131 force-pushed the atomic-session-converter branch from 6f28e07 to f03e22b Compare November 13, 2026 00:14
@lavaman131
lavaman131 removed this pull request from stack #77068 November 13, 2026 00:14
@lavaman131
lavaman131 changed the base branch from atomic-durable-storage to main November 13, 2026 00:14
@pelikhan
pelikhan merged commit f61675e into main Nov 13, 2026
103 checks passed
@pelikhan
pelikhan deleted the atomic-session-converter branch November 13, 2026 03:01
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

lavaman131 added a commit that referenced this pull request Nov 13, 2026
Resolve conflicts with the JSONL event output harness (#77052): keep its
output sanitizers and --mode json, plus the drive sessions and runs.

Workflow runs now use atomic storage import/export <dir> --workflows
(Atomic 0.9.84+, detected from export --help offering --workflows), with
<dir>/workflows/<runId>.jsonl. The drive's workflows/ folder is replaced
only after a successful export, and saved runs the export lacks stay
unless the budget prunes them.
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.

5 participants