fix(bazel): replace askama templates with include_str! in memories#11778
Open
rupurt wants to merge 1 commit intoopenai:mainfrom
Open
fix(bazel): replace askama templates with include_str! in memories#11778rupurt wants to merge 1 commit intoopenai:mainfrom
rupurt wants to merge 1 commit intoopenai:mainfrom
Conversation
4f46276 to
a95476b
Compare
Askama resolves template paths relative to CARGO_MANIFEST_DIR, which points outside the Bazel sandbox. This caused the experimental Bazel CI to fail with "No such file or directory" errors for the three memories templates (consolidation.md, stage_one_input.md, read_path.md). Replace askama's #[derive(Template)] with include_str! + str::replace() which resolves paths relative to the source file — working correctly in both Cargo and Bazel builds. The templates only use simple variable substitution so no askama features are lost. This also removes the askama dependency from codex-core since it was the only crate using it.
a95476b to
c78e73b
Compare
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
CARGO_MANIFEST_DIR, which points outside the Bazel sandbox. This produces errors like:#[derive(Template)]+#[template(path = "...")]withinclude_str!+str::replace()for the three affected templates (consolidation.md,stage_one_input.md,read_path.md).include_str!resolves paths relative to the source file, which works correctly in both Cargo and Bazel builds.{{ variable }}substitution with no control flow or filters, so no askama functionality is lost.askamadependency fromcodex-coresince it was the only crate using it. The workspace-level dependency definition is left in place.codex-rs/core/src/memories/mod.rsalready usesinclude_str!("../../templates/memories/stage_one_system.md")for the fourth template file.Test plan
cargo test -p codex-corepasses locally