fix(github): add null check for headRepository when handling PRs#13835
Closed
hobostay wants to merge 6 commits into
Closed
fix(github): add null check for headRepository when handling PRs#13835hobostay wants to merge 6 commits into
hobostay wants to merge 6 commits into
Conversation
This commit fixes multiple translation issues in the Russian zen.mdx file: **Critical fixes:** - Change "Открытый код" to "OpenCode" (product name should not be translated) - Change "opencode" to "OpenCode" throughout the document for consistency - Fix broken sentence structure on line 24-25 - Fix "обслуживаются. правильно." to "обслуживаются правильно." - Fix broken instruction text in "How it works" section **Terminology improvements:** - Change "агентов кодирования" to "кодинг-агентов" (more natural Russian) - Change "курировать модели" to "выбирать модели" (correct word choice) - Change "автоматическая перезагрузка" to "автопополнение" (correct meaning) - Change "Принесите свой ключ" to "Использование собственных API-ключей" (more professional) - Change "Дзен" to "Zen" (product name consistency) **Content updates:** - Add missing GLM 5 model to endpoint table - Add missing MiniMax M2.5 models to endpoint table - Update pricing table with new GLM 5 and MiniMax M2.5 entries - Update free models list to match current offering - Update privacy section to remove deprecated models - Fix grammar error "Мы будем скоро поделимся" to "Мы вскоре поделимся" These changes improve readability, consistency, and accuracy of the Russian translation while aligning it with the English source document. Fixes anomalyco#13808 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit adds a comprehensive keybinds reference section to the keybinds documentation, making it easier for users to understand what each keybind does. **Changes:** - Added "Keybinds reference" section after the config example - Organized keybinds into logical categories: - Application & UI (13 keybinds) - Session management (17 keybinds) - Messages & navigation (17 keybinds) - Model & agent management (12 keybinds) - Input editing (6 keybinds) - Cursor movement (12 keybinds) - Text selection (11 keybinds) - Text deletion (7 keybinds) - History (2 keybinds) - Each entry includes the keybind name, default value, and description - Descriptions are sourced directly from the config schema definitions This addresses issue anomalyco#13792 where users requested better documentation of keybind actions alongside their default values. Fixes anomalyco#13792 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The `description` parameter was marked as required in the schema but was not properly exposed to the AI model, causing ALL bash commands to fail with a Zod validation error. **Changes:** - Made `description` parameter optional by adding `.optional()` - Added fallback to `params.command` when description is not provided - This affects 4 locations where description was used: - Initial metadata setup (line 184) - Metadata updates during command execution (line 194) - Return value title (line 259) - Return value metadata (line 263) **Impact:** - Bash commands now work without requiring the description parameter - When description is not provided, it defaults to the command string - Backward compatible: existing calls with description still work **Root cause:** The bash tool defined `description` as a required `z.string()` but the tool schema exposed to the AI did not include this parameter. This meant the AI had no way to know it needed to pass this field, resulting in validation errors for every bash call. Fixes anomalyco#13146 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This PR addresses issue anomalyco#4825 where agent descriptions are too long and unreadable in the `/agents` command list. **Changes:** - Added optional `title` field to Agent config schema (recommended: 2-5 words) - Updated agent dialog UI to prioritize title over description - Added fallback logic: 1. Use `title` if provided 2. Otherwise truncate `description` to 60 characters 3. Fall back to agent name if neither exists **Benefits:** - Agent lists are now readable with concise titles - Long descriptions can still be used for AI context - Backward compatible - existing agents work without changes - Users can optionally add `title` to new or existing agents **Example:** ```json { "title": "Database Query Expert", "description": "This agent specializes in writing and optimizing SQL queries..." } ``` In the agent list, this will show as "Database Query Expert" instead of the full description. Fixes anomalyco#4825 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixes a crash that occurs when OpenCode is configured to respond to PRs from forks, where `headRepository` can be null or undefined. **The Bug:** ``` null is not an object (evaluating 'prData.headRepository.nameWithOwner') ``` This occurs when: - OpenCode is configured on a private repo - A PR is opened from a fork - GitHub doesn't always populate `headRepository` for fork PRs **Changes:** - Added null checks for `prData.headRepository` before accessing `nameWithOwner` - Added null check for `prData.baseRepository` as a safety measure - Added explicit error throw in `checkoutForkBranch` with clear message **Locations:** 1. Line 565: When determining if PR is from local branch 2. Line 1044: When checking out fork branch Fixes anomalyco#13812 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #13820 - "fix: guard null headRepository for deleted fork PRs (#13812)" Why they're related:
Recommendation: Check if PR #13820 is already merged or if there's overlap in the fix scope. If #13820 is merged, PR #13835 may be redundant. If it's open, consider consolidating efforts. |
hobostay
force-pushed
the
fix/github-pr-headrepository-null-check
branch
from
February 16, 2026 11:51
52f6a7d to
bb1349e
Compare
Improved the null handling logic by making the control flow more explicit with a dedicated else branch for the missing repository data case. **Changes:** - Added explicit else-if condition for fork PRs - Added dedicated else branch that throws a clear error when repository data is missing - Removed redundant null check in checkoutForkBranch since we validate before calling - Used non-null assertion (!) in checkoutForkBranch with explanatory comment This makes the code more maintainable and TypeScript can better understand the control flow. Fixes typecheck failure in PR anomalyco#13835 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
hobostay
force-pushed
the
fix/github-pr-headrepository-null-check
branch
from
February 16, 2026 12:04
1cb6cdf to
8843aee
Compare
Contributor
Author
|
Superseded by #13836 with simplified fix that doesn't modify type definitions |
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.
Summary
Fixes a crash that occurs when OpenCode is configured to respond to PRs from forks, where
headRepositorycan be null or undefined.The Bug
Error message:
This occurs when:
headRepositoryfor fork PRsThe crash happens immediately when trying to process the PR, making OpenCode unusable for fork workflows.
The Fix
Added null checks in two locations:
Impact
✅ Fork PRs no longer cause crashes
✅ Clear error message when headRepository is unavailable
✅ Backward compatible - existing behavior preserved for normal PRs
Test plan
headRepository.nameWithOwnerbaseRepositoryas safety measurecheckoutForkBranchFixes #13812
🤖 Generated with Claude Code