feat: improve frontmatter hash checker with debug logging and failure propagation to conclusion job#25571
feat: improve frontmatter hash checker with debug logging and failure propagation to conclusion job#25571
Conversation
…hecker
- Add verbose debug mode to computeFrontmatterHash() in frontmatter_hash_pure.cjs
- New `verbose: true` option logs every step of the hash computation via core.info()
- Helps diagnose unexpected hash mismatches by showing raw frontmatter text,
canonical JSON, imported files, and intermediate values
- Update check_workflow_timestamp_api.cjs:
- When hash validation fails (mismatch or unverifiable), run a second pass
with verbose: true to emit step-by-step debug info to the workflow logs
- Set core.setOutput('stale_lock_file_failed', 'true') on any failure so the
conclusion job can surface a specialised failure issue/comment
- Add id: check-lock-file to the 'Check workflow lock file' step in
compiler_activation_job.go and expose stale_lock_file_failed as an
activation job output
- Propagate GH_AW_STALE_LOCK_FILE_FAILED to the conclusion job in
notify_comment.go; also expand the conclusion job if-condition to run
when the stale lock file check fails (agent is skipped in that case)
- Create actions/setup/md/stale_lock_file_failed.md with a delightful,
progressive-disclosure message covering how to fix, how to investigate
using [hash-debug] log lines, and how to disable the check
- Add stale_lock_file_failed_context to both issue and comment failure
templates (agent_failure_issue.md, agent_failure_comment.md)
- Add buildStaleLockFileFailedContext() to handle_agent_failure.cjs and
wire it into hasLockFileCheckFailed condition + both template contexts
- Update golden test files; add new tests for stale_lock_file_failed output
and debug recomputation logging in check_workflow_timestamp_api.test.cjs,
and buildStaleLockFileFailedContext tests in handle_agent_failure.test.cjs
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/8cad91a6-b26c-4fe7-8e2d-0abe3068e8f1
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves the “stale lock file” (frontmatter hash) checker used in activation workflows by adding targeted debug logging on failures and ensuring stale-lock failures propagate to the conclusion job, where a specialized issue/comment context can be rendered.
Changes:
- Add a
verboseoption tocomputeFrontmatterHashand trigger a second, verbose recomputation pass only when validation fails to emit[hash-debug]logs. - Propagate stale lock file failures via activation job output
stale_lock_file_failedand forward it into the conclusion job environment (GH_AW_STALE_LOCK_FILE_FAILED). - Add a dedicated stale-lock failure issue/comment context template and wire it into the existing failure reporting templates; update compiler outputs/step IDs and recompile generated
.lock.ymlworkflows + golden fixtures.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/frontmatter_hash_pure.cjs | Adds options.verbose and detailed [hash-debug] logging to aid diagnosis of hash mismatches. |
| actions/setup/js/check_workflow_timestamp_api.cjs | Runs a verbose recomputation pass on failure and sets stale_lock_file_failed output on stale/unverifiable lock detection. |
| actions/setup/js/handle_agent_failure.cjs | Reads GH_AW_STALE_LOCK_FILE_FAILED and injects stale_lock_file_failed_context into rendered failure templates. |
| actions/setup/md/stale_lock_file_failed.md | New progressive-disclosure template with remediation and investigation guidance. |
| actions/setup/md/agent_failure_comment.md | Adds {stale_lock_file_failed_context} placeholder. |
| actions/setup/md/agent_failure_issue.md | Adds {stale_lock_file_failed_context} placeholder. |
| pkg/workflow/compiler_activation_job.go | Adds id: check-lock-file and conditionally exposes activation output stale_lock_file_failed. |
| pkg/workflow/notify_comment.go | Forwards GH_AW_STALE_LOCK_FILE_FAILED and expands conclusion job condition to run when stale-lock failure occurs. |
| pkg/workflow/testdata/TestWasmGolden_CompileFixtures/*.golden | Updates golden fixtures to reflect new output and step id. |
| .github/workflows/*.lock.yml (many files) | Recompiled lock workflows to include the new step id, output wiring, and conclusion job condition/env forwarding. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 199/199 changed files
- Comments generated: 0
|
@copilot merge main and recompile |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/eb58234d-1ee6-45c6-a93d-513f979a597e Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done — merged main (commit Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot merge main, recompile, resolve conflicts |
The branch is already fully merged with Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Summary
Updates the frontmatter hash checker (
check_workflow_timestamp_api.cjs) that runs in the compiled lock file's activation job to be more helpful when a hash mismatch is detected.Changes
Debug logging on failure
When hash validation fails (mismatch or hash unverifiable), a second execution of
computeFrontmatterHashruns withverbose: true. This emits step-by-step[hash-debug]lines to the workflow logs showing:The verbose mode is implemented in
frontmatter_hash_pure.cjsvia a newoptions.verboseparameter; the debug pass only runs on failure so healthy runs are unaffected.Failure propagation to conclusion job
The check now sets
core.setOutput("stale_lock_file_failed", "true")on any failure. This is:stale_lock_file_failed(newid: check-lock-fileon the step)GH_AW_STALE_LOCK_FILE_FAILEDenv varSpecialised failure issue/comment
handle_agent_failure.cjsreadsGH_AW_STALE_LOCK_FILE_FAILEDand callsbuildStaleLockFileFailedContext()which rendersstale_lock_file_failed.md— a delightful, progressive-disclosure message with:gh aw compile)<details>section on how to investigate using[hash-debug]logs<details>section on how to disable the check (stale-check: falsewith caution)Conclusion job condition expanded
The conclusion job
ifcondition now also triggers whenstale_lock_file_failed == 'true'(previously only ran for lockdown failures or agent failures). This ensures an issue/comment is created even when the agent was skipped due to a stale lock file.Files changed
actions/setup/js/frontmatter_hash_pure.cjsverbose: trueoption with step-by-step debug loggingactions/setup/js/check_workflow_timestamp_api.cjsstale_lock_file_failedoutputactions/setup/js/handle_agent_failure.cjsbuildStaleLockFileFailedContext()+ wiringactions/setup/md/stale_lock_file_failed.mdactions/setup/md/agent_failure_comment.md{stale_lock_file_failed_context}actions/setup/md/agent_failure_issue.md{stale_lock_file_failed_context}pkg/workflow/compiler_activation_job.goid: check-lock-file+stale_lock_file_failedoutputpkg/workflow/notify_comment.gopkg/workflow/testdata/TestWasmGolden_CompileFixtures/*.golden.github/workflows/*.lock.yml(187 files)Tests
check_workflow_timestamp_api.test.cjs: 49 tests (6 new —stale_lock_file_failedoutput + debug logging)handle_agent_failure.test.cjs: 70 tests (5 new —buildStaleLockFileFailedContext)pkg/workflow/: all golden tests updated and passing