fix(github): use canonical share URL from API instead of constructing it#26431
fix(github): use canonical share URL from API instead of constructing it#26431xxiaoxiong wants to merge 2 commits intoanomalyco:devfrom
Conversation
The SessionPromptData type was missing the 'format' field that exists in the OpenAPI spec. This field allows users to specify structured output formats (text or json_schema) when sending prompts. Added missing types: - OutputFormatText: for plain text output - OutputFormatJsonSchema: for JSON schema-based structured output - OutputFormat: union type of the above - format?: OutputFormat field in SessionPromptData.body This allows TypeScript users to use the format parameter without type errors, matching the actual API behavior. Fixes anomalyco#26408
GitHub Actions bot comments were using the old hardcoded URL format 'https://opencode.ai/s/<id>' which now 404s. The canonical share URL format is now 'https://opncd.ai/share/<id>' and is returned by the share API. Changes: - Capture the full share URL from sessionShare.share() result - Use the returned URL directly in comments and links - Extract share ID from URL for social card image generation - Update both packages/opencode/src/cli/cmd/github.ts and github/index.ts Before: shareId = session.id.slice(-8) link = `${shareBaseUrl}/s/${shareId}` After: shareUrl = result.url // e.g. 'https://opncd.ai/share/xxx' link = shareUrl Fixes anomalyco#26417
|
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. |
|
The following comment was made by an LLM, it may be inaccurate: Potential duplicate found:
This PR appears to be addressing the same issue: fixing broken share links in GitHub Actions bot comments. It's likely either a related fix or a duplicate attempt to resolve the same problem with the canonical share URL format change. |
|
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. |
Summary
Fixes GitHub Actions bot comments that were generating broken share links using the old URL format.
Problem
GitHub Actions bot comments append share links like:
These links now 404. The canonical share URL format has changed to:
Root Cause
The code was:
session.id.slice(-8)https://opencode.aiThis broke when:
opencode.aitoopncd.ai/s/to/share/Solution
Use the canonical share URL returned by the share API instead of constructing it manually.
Before:
After:
Changes
packages/opencode/src/cli/cmd/github.ts:
shareIdtoshareUrlto reflect that it now stores the full URLresult.urlfromsessionShare.share()instead of deriving from session IDshareUrldirectly in links and commentsgithub/index.ts:
result.data?.share?.urlTesting
Impact
Fixes #26417