feat(github): auto-extract issue prompt on assignment and opened events#19934
feat(github): auto-extract issue prompt on assignment and opened events#19934dzianisv wants to merge 2 commits intoanomalyco:devfrom
Conversation
When an issues event fires with action 'assigned' or 'opened', the handler now automatically constructs the prompt from the issue title, body, and labels instead of requiring the PROMPT env var. This enables a natural workflow: assign an issue to the opencode bot and it picks up the work automatically without needing a /opencode comment. The PROMPT env var is still respected as an override, and is still required for other issue actions (e.g. labeled, closed). Refs: anomalyco#19926
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Extract the issue prompt building logic into an exported pure function buildIssuePrompt() and add 11 unit tests covering: - title + body formatting - null/undefined/empty body fallback - string labels, object labels, mixed label types - empty/undefined/partial labels handling - markdown body preservation Refactor getUserPrompt() to delegate to buildIssuePrompt().
Test ResultsExtracted the issue prompt building logic into a pure, exported
Run outputAll 28 tests pass (17 existing Typecheck also passes across all 13 packages in the monorepo (confirmed by pre-push hook). |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
E2E Test Results — Issue Assignment TriggerSummaryThe issue assignment trigger works end-to-end. When an issue is assigned in a repo with the opencode workflow, opencode automatically picks up the issue, extracts the prompt from the issue title/body (via Test Setup
Test Issue
Workflow Run
Key Log Lines (from the successful run)ResultThe
What This Proves
Previous Failure (for comparison)
|
E2E Test Results — ALL CHECKS PASS ✅Test Setup
Fix Applied
Full Flow Evidence (run 23723123435)
Acceptance Criteria
All 7/7 acceptance criteria passed in the same evaluation run. |
Summary
issuesevents fire withassignedoropenedactionsPROMPTenv var on these issue actionsChanges
packages/opencode/src/cli/cmd/github.tsThe
getUserPrompt()function previously required thePROMPTenvironment variable for allissuesevents. Now:PROMPTis set, it's used as an override (backward compatible)assignedandopenedactions: auto-constructs prompt fromissue.title,issue.body, andissue.labelslabeled,closed): still requiresPROMPTThe downstream issue handling flow (branch creation, work, PR/comment) is unchanged.
Testing
getUserPrompt()and doesn't affect any other code pathsPROMPTenv var override still works for all event types (backward compatible)assignedandopenedpaths construct the same prompt format thatPROMPTusers would provide manuallyRefs #19926