feat: DELEGA_AGENT_KEY env fallback + async test coverage → 0.2.1#7
Merged
ryanmcmillan merged 1 commit intomainfrom Apr 14, 2026
Merged
Conversation
Two small additions shipped together as a patch.
1. Env var tolerance (T2.4)
- Accept DELEGA_AGENT_KEY as fallback for DELEGA_API_KEY so agents
configuring @delega-dev/mcp (primary: DELEGA_AGENT_KEY) and this
SDK (primary: DELEGA_API_KEY) in one shell don't need to set both.
- DELEGA_API_KEY still wins when both are set.
- Applied to both Delega and AsyncDelega.
- 2 new sync tests, 1 new async test cover the env fallback.
2. Async test coverage (T3.1)
- New tests/test_async_client.py with 11 tests using httpx.MockTransport
to mirror the sync coverage added in 0.2.0 — delegate/assign/chain/
update_context/find_duplicates each covered with both hosted and
self-hosted response shapes where the shape differs. Also covers the
hosted-only usage() gate with a "mock transport never called" assertion.
- .github/workflows/ci.yml gains pytest-asyncio so CI actually runs
the new file across the Python 3.9-3.13 matrix.
Full test suite: 76 passed (65 sync + 11 async).
Sibling patches: @delega-dev/mcp@1.2.1 and @delega-dev/cli@1.2.1 both
shipped. The three packages are now consistent on env var handling.
T2.4 + T3.1 from followups-after-1.2.0-night.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
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
Two small additions shipped together as a patch.
T2.4 — env var tolerance
Accept `DELEGA_AGENT_KEY` as a fallback for `DELEGA_API_KEY` so agents configuring @delega-dev/mcp (primary: `DELEGA_AGENT_KEY`) and this SDK (primary: `DELEGA_API_KEY`) in one shell don't need to set both. `DELEGA_API_KEY` still wins when both are set.
Sibling patches: @delega-dev/mcp@1.2.1 and @delega-dev/cli@1.2.1 already shipped.
T3.1 — async test coverage
New `tests/test_async_client.py` with 11 tests using `httpx.MockTransport` to mirror the sync 0.2.0 coverage — `delegate/assign/chain/update_context/find_duplicates` each covered with both hosted and self-hosted response shapes where they diverge. Also covers the hosted-only `usage()` gate with a "mock transport never called" assertion.
`.github/workflows/ci.yml` gains `pytest-asyncio` so the matrix (Python 3.9-3.13) actually runs the new file.
Test plan
T2.4 + T3.1 from followups-after-1.2.0-night.md
🤖 Generated with Claude Code