[WIP] Fix missing OPENAI_API_KEY in GenAIScript smoke test#2146
Merged
[WIP] Fix missing OPENAI_API_KEY in GenAIScript smoke test#2146
Conversation
… workflow Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
Oct 22, 2025
Contributor
|
Agentic Changeset Generator triggered by this pull request. |
Copilot stopped work on behalf of
pelikhan due to an error
October 22, 2025 17:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✅ Fix GenAIScript OPENAI_API_KEY Missing Issue
Problem
The GenAIScript smoke test workflow was failing at run #18722204018 with error
OPENAI_API_KEY missingbecause the workflow uses theopenai:gpt-4.1model but doesn't validate or provide the required API key.Solution Implemented
Changes Made
1. Modified
.github/workflows/shared/genaiscript.md:OPENAI_API_KEYsecret is configured2. Recompiled workflow (
smoke-genaiscript.lock.yml):agentanddetectionjobsValidation Behavior
Before Fix:
After Fix:
The workflow will now:
Testing
make test-unit)make fmt)Files Changed
References
OPENAI_API_KEY_MISSING_GENAISCRIPTOriginal prompt
This section details on the original issue you should resolve
<issue_title>[smoke-detector] 🔍 Smoke Test Investigation - GenAIScript OPENAI_API_KEY Missing</issue_title>
<issue_description># 🔍 Smoke Test Investigation - Run githubnext/gh-aw#18722204018
Summary
The GenAIScript smoke test failed due to a missing OPENAI_API_KEY environment variable. The workflow is configured to use the
openai:gpt-4.1model, but the required API key is not provided in the workflow configuration, causing immediate failure during model resolution.Failure Details
Root Cause Analysis
Primary Failure: Missing API Key
The GenAIScript engine attempted to resolve the model
openai:gpt-4.1but failed because theOPENAI_API_KEYenvironment variable is not configured:This error occurred during the model resolution phase, before any actual AI work could begin.
Secondary Failure: Missing Output File
The
create_issuejob failed as a cascading failure because it expected an output file from the agent job:Since the agent job failed early in execution, it never created the expected output file.
Tertiary Error: Unhandled Exception in GenAIScript
Additionally, GenAIScript itself threw an unhandled exception when trying to set outputs:
This indicates that GenAIScript's error handling doesn't gracefully handle failed runs.
Failed Jobs and Errors
Job: agent
OPENAI_API_KEY missingenv.js:216:19in genaiscript coreJob: create_issue
ENOENT: no such file or directoryInvestigation Findings
Configuration Issue
The GenAIScript smoke test workflow has a model configured in the prompt file:
However, the workflow does not provide the necessary
OPENAI_API_KEYenvironment variable that this model requires.Error Handling Gap
GenAIScript's GitHub Action integration has insufficient error handling - when a run fails, it attempts to set outputs but encounters undefined values, causing a secondary error that masks the primary issue.
Recommended Actions
Immediate Fixes
OPENAI_API_KEYto GitHub repository secrets and configure the Smoke GenAIScript workflow to use itgithub:gpt-4o, or Azure OpenAI if configured)Code Improvements
githubActionSetOutputsfunction to handle failed runs gracefully (add null checks)Documentation
Prevention Strategies
Historical Context
This is the first recorded instance of this specific error pattern in the investigation database. The error signature
OPENAI_API_KEY_MISSING_GENAISCRIPThas been documented for future pattern matching.Pattern Severity: High
Is Flaky: No
External Dependency: Yes (OpenAI API)
Investigation completed by Smoke Detector 🔍
Pattern stored:
/tmp/gh-aw/cache-memory/patterns/openai_api_key_missing.jsonInvestigation record: `/tmp/gh-aw/cache-memor...
Fixes #2142
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.