Skip to content

[plan] Move comment-memory preparation before user steps: in agent job #43944

Description

@github-actions

Objective

Prepare comment-memory files (/tmp/gh-aw/comment-memory/*.md) before the user's frontmatter steps: block runs in the compiled agent job, so deterministic steps can read prior comment-memory state without requiring an LLM turn.

Context

Issue #43924 identifies that comment-memory is currently prepared in generateEngineInstallAndPreAgentSteps (around line 449 of pkg/workflow/compiler_yaml_main_job.go), which runs after the user steps: block. This makes it impossible for a deterministic steps: block to read comment memory state.

Unlike cache-memory/repo-memory (which are pure restores), preparing comment-memory fetches comment content via GitHub API — so moving it earlier needs care around auth/token availability.

Implementation Plan

Implementation Plan

Files to Modify

  • pkg/workflow/compiler_yaml_main_job.go — move the "Prepare comment memory files" step generation to before emitCustomSteps in generateRuntimeAndWorkspaceSetupSteps (or immediately after the DIFC proxy starts, since a token is already available by that point)
  • Add/update tests verifying the comment-memory prepare step precedes custom user steps in generated YAML

Approach

  1. Determine the earliest point at which the GitHub token and the ${{ runner.temp }}/gh-aw/actions/ scripts are available (after the setup action and gh CLI configuration).
  2. Extract or refactor the comment-memory prepare step emission out of generateEngineInstallAndPreAgentSteps and call it in generateRuntimeAndWorkspaceSetupSteps, before emitCustomSteps.
  3. Ensure the activation artifact download (which populates /tmp/gh-aw/) has already happened or the comment-memory step does not depend on it.
  4. Add a test asserting the "Prepare comment memory files" step index is less than the first user custom step index in the generated YAML.

Acceptance Criteria

  • /tmp/gh-aw/comment-memory/*.md files are populated before any user steps: run
  • Existing comment-memory tests continue to pass (make test)
  • New or updated test asserts correct ordering vs. custom steps
  • make recompile passes for any affected workflow markdown files

Generated by 📋 Plan Command · 79.6 AIC · ⌖ 11.7 AIC · ⊞ 4.7K · ◷
Comment /plan to run again

  • expires on Jul 8, 2026, 10:39 PM UTC-08:00

Activity

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions