Skip to content

feat(provider): TOLE_* canonical env prefix (CORAGENT_* legacy, OPENAI_* fallback) - #37

Merged
ajianaz merged 1 commit into
developfrom
feat/tole-env-canonical
Aug 27, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/tole-env-canonical

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What

The env contract is renamed to match the project: TOLE_BASE_URL / TOLE_MODEL / TOLE_API_KEY are now the canonical prefix, with resolution order TOLE_ > CORAGENT_ (pre-rename legacy) > OPENAI_* (de-facto standard)**. Complete-triple semantics unchanged: prefixes are never mixed, whitespace-only counts as absent.

ENV_BASE_URL/ENV_MODEL/ENV_API_KEY constants now point at TOLE_*; the e2e test's stale "CORAGENT_E5_FILE" message fixed to match its actual CORA_E5_FILE env; CLI error message and the .cora.yaml api_key doc rule updated to name all three prefixes.

Why

The repo is tole, the crates are tole-core/tole-cli — CORAGENT_* is a leftover from the pre-rename identity (cora-agent). Env names are operator-facing UX; they should carry the product name.

Testing

  • Unit test extended: TOLE priority over both others, half-set TOLE falls through to the complete CORAGENT legacy triple (no blending), whitespace-only absent, OPENAI-only fallback.
  • 112/112 tests pass, clippy clean.
  • Live validation: (1) TOLE-only env: full turn against the real provider — completed after one transient 502 via resume (also re-proving crash-resume); (2) CORAGENT-only env: full turn, same result.

…I_* fallback)

The project is named tole; the env contract should say so.
Resolution order: TOLE_* > CORAGENT_* (pre-rename legacy) > OPENAI_*,
complete-triple semantics unchanged (no blending, whitespace = absent).

- ENV_BASE_URL/MODEL/API_KEY now point at TOLE_* (constant consumers
  updated: e2e test message fixed in the same pass)
- unit tests extended: TOLE priority over legacy, half-set TOLE falls
  back to CORAGENT whole-triple
- CLI error message and .cora.yaml doc rule updated

Validated live: TOLE_*-only env and CORAGENT_*-only env each completed
a real provider turn. 112/112 tests, clippy clean.
/// parks inside the effect window, then die by parental SIGKILL.
fn child_main() {
let file = PathBuf::from(std::env::var(FILE_ENV).expect("CORAGENT_E5_FILE missing"));
let file = PathBuf::from(std::env::var(FILE_ENV).expect("CORA_E5_FILE missing"));
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (1)

  • crates/tole-core/tests/e2e_resume.rs:268 — The child now reads std::env::var(FILE_ENV) expecting CORA_E5_FILE, but the diff only shows the child side. If the parent process (the test harness in this same file) still sets the old CORAGENT_E5_FILE name via FILE_ENV's value, the child will panic with "CORA_E5_FILE missing" and the SIGKILL resume test will fail. Verify that the constant FILE_ENV and the parent-side Command::env(...) call were updated consistently; a rename like this must be atomic across both sides.

Review powered by cora-code · BYOK · MIT

@ajianaz

ajianaz commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Re: the e2e_resume finding — false positive with evidence:

FILE_ENV is a single shared constant (const FILE_ENV: &str = "CORA_E5_FILE", line 199). The parent uses .env(FILE_ENV, &file) (line 229) and the child reads std::env::var(FILE_ENV) (line 268) — both resolve through the same constant, so a parent/child mismatch is structurally impossible.

This diff only fixed the stale panic message string ("CORAGENT_E5_FILE missing" → "CORA_E5_FILE missing") — the env var name itself was never renamed in this PR. Verified by running the suite directly:

cargo test --test e2e_resume
test result: ok. 3 passed; 0 failed

The SIGKILL resume test passes on the exact code under review.

@ajianaz
ajianaz merged commit fc37b1d into develop Aug 27, 2026
11 of 12 checks passed
@ajianaz
ajianaz deleted the feat/tole-env-canonical branch August 27, 2026 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants