-
Notifications
You must be signed in to change notification settings - Fork 2
Improve Codex branding and prompt fetch resilience #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
riatzukiza
merged 3 commits into
staging
from
chore/handle-missing-codex-prompt-warming
Nov 19, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Handle missing codex prompt warming | ||
|
|
||
| ## Scope | ||
| - Review uncommitted changes on branch `chore/handle-missing-codex-prompt-warming` for plugin log prefix and fallback prompt fetch handling. | ||
|
|
||
| ## Relevant files & line notes | ||
| - `lib/constants.ts`:6-8 rename `PLUGIN_NAME` to `openhax/codex` for logging identity. | ||
| - `lib/logger.ts`:144-158 log gating simplified to always mirror warn/error/info when enabled; removes test-env suppression. | ||
| - `lib/prompts/opencode-codex.ts`:15-131 adds dev+main fallback URLs, stores `sourceUrl`, handles 304/etag per-source, logs last error, caches when available. | ||
| - `lib/request/response-handler.ts`:36-79 updates empty-body error prefix to new plugin name. | ||
| - Tests updated for new prefixes and caching behavior: `test/auth.test.ts`, `test/constants.test.ts`, `test/logger.test.ts`, `test/prompts-codex.test.ts`, `test/prompts-opencode-codex.test.ts` (new legacy URL fallback test). | ||
| - Docs updated to reflect new logging prefix: `docs/configuration.md`, `docs/development/ARCHITECTURE.md`, `docs/development/TESTING.md`. | ||
|
|
||
| ## Existing issues / PRs | ||
| - No linked issues or PRs referenced in the changes. | ||
|
|
||
| ## Requirements | ||
| - Ensure logging prefix consistently uses `openhax/codex` across code, tests, docs. | ||
| - OpenCode prompt fetcher should fall back to main branch when dev URL fails, preserving cache metadata including source URL. | ||
| - Maintain ETag-based caching and cache-hit/miss metrics with session/file caches. | ||
| - Tests should cover prefix changes and new fallback path. | ||
|
|
||
| ## Definition of done | ||
| - All modified files aligned on new plugin identifier. | ||
| - OpenCode codex prompt fetch resilient when dev URL missing; cache metadata persists `sourceUrl` and uses correct conditional requests. | ||
| - Unit tests updated/passing; docs reflect logging prefix. | ||
| - Branch ready with meaningful commit(s) and PR targeted to staging. | ||
|
|
||
| ## Notes | ||
| - Untracked spec files present (`spec/opencode-prompt-cache-404.md`, `spec/plugin-name-rename.md`); keep intact. | ||
| - Build/test commands: `npm test`, `npm run build`, `npm run typecheck` per AGENTS.md. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # OpenCode Prompt Cache 404 | ||
|
|
||
| ## Context | ||
| - Timestamped warnings during startup show `getOpenCodeCodexPrompt` failing to seed cache due to 404 on codex.txt (logs at 2025-11-19, default config path missing). | ||
| - Current fetch URL targets `sst/opencode` on the `main` branch, which no longer hosts `packages/opencode/src/session/prompt/codex.txt`. | ||
|
|
||
| ## Existing Issues / PRs | ||
| - No related issues/PRs reviewed yet; check backlog if needed. | ||
|
|
||
| ## Code Files & References | ||
| - lib/prompts/opencode-codex.ts:15 – `OPENCODE_CODEX_URL` points to raw GitHub main branch and returns 404. | ||
| - lib/cache/cache-warming.ts:41-99 – startup warming logs errors when `getOpenCodeCodexPrompt` fails. | ||
| - lib/utils/file-system-utils.ts:15-23 – cache path under `~/.opencode/cache` used for prompt storage. | ||
| - test/prompts-opencode-codex.test.ts:82-297 – coverage for caching, TTL, and fetch fallback behavior. | ||
|
|
||
| ## Definition of Done | ||
| 1. Update OpenCode prompt fetch logic to use a valid source and avoid 404s. | ||
| 2. Preserve caching semantics (session + disk + TTL) and existing metrics behavior. | ||
| 3. Ensure cache warming no longer logs repeated OpenCode fetch errors when network is available. | ||
| 4. Tests cover the new fetch path/fallback path and continue to pass. | ||
|
|
||
| ## Requirements | ||
| - Add a resilient fetch strategy (e.g., prefer current branch/file path with fallback to legacy path) without breaking existing interfaces. | ||
| - Keep cache directory/filenames unchanged to avoid disrupting existing users. | ||
| - Maintain log levels (warn on failures) but succeed when a fallback fetch works. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Plugin name rename to npm package name | ||
|
|
||
| ## Context | ||
| - Update plugin/service identifier to use the npm package name `openhax/codex`. | ||
|
|
||
| ## Relevant code | ||
| - lib/constants.ts:7 exports `PLUGIN_NAME` that is used for logging. | ||
| - test/constants.test.ts:18-21 asserts the current plugin identity string. | ||
|
|
||
| ## Tasks / Plan | ||
| 1. Change `PLUGIN_NAME` to `openhax/codex` in `lib/constants.ts`. | ||
| 2. Update tests and any string expectations to the new identifier. | ||
| 3. Keep docs/examples consistent if they explicitly show the service name. | ||
|
|
||
| ## Definition of done | ||
| - Plugin logs use `openhax/codex` as the service name. | ||
| - Tests updated to match the new identifier and pass locally if run. | ||
| - No references to the legacy identifier remain in code/tests relevant to logging. |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.