Skip to content

fix: parse hosted context JSON + accept DELEGA_AGENT_KEY → 1.2.1#22

Merged
ryanmcmillan merged 1 commit into
mainfrom
fix/env-var-tolerance
Apr 14, 2026
Merged

fix: parse hosted context JSON + accept DELEGA_AGENT_KEY → 1.2.1#22
ryanmcmillan merged 1 commit into
mainfrom
fix/env-var-tolerance

Conversation

@ryanmcmillan
Copy link
Copy Markdown
Member

Summary

Two small fixes batched into one patch release.

T2.3 — `tasks show` context render

Hosted returns `context` as a JSON-encoded string (D1/SQLite text column). Self-hosted returns a dict. Previously `tasks show` against hosted printed `"{\"step\":\"done\"}"` with escape chars. Now both backends render as an indented JSON block.

Also surfaces `root_task_id` + `delegation_depth` when the task is part of a delegation chain (previously dropped).

`normalizeContext()` mirrors the logic in delega-mcp's formatters and delega-python's Task.from_dict.

T2.4 — env var tolerance

Accept `DELEGA_AGENT_KEY` as fallback for `DELEGA_API_KEY` so agents configuring the MCP (primary: `DELEGA_AGENT_KEY`) and CLI (primary: `DELEGA_API_KEY`) in the same shell don't need to set both. `DELEGA_API_KEY` still wins when both are set.

Sibling patches: @delega-dev/mcp@1.2.1 already shipped; delega==0.2.1 landing next.

Test plan

  • `npx tsc --noEmit` clean
  • `npm run build` clean
  • Live smoke after release: `delega tasks show ` — context renders as indented JSON, not escaped string
  • Confirm `DELEGA_AGENT_KEY=… delega whoami` works without `DELEGA_API_KEY`

T2.3 + T2.4 from followups-after-1.2.0-night.md

🤖 Generated with Claude Code

Two small fixes batched into one patch release.

1. tasks show: context render (T2.3)
   - Hosted API returns `context` as a JSON-encoded string (D1/SQLite
     text column). Self-hosted returns a dict. Previously `tasks show`
     against hosted printed the literal "{\"step\":\"done\"}" with
     escape chars visible.
   - Added normalizeContext() mirroring the logic in
     delega-mcp/src/formatters.ts and delega-python's Task.from_dict.
     Now both backends render the context block as indented JSON.
   - Also surfaces root_task_id + delegation_depth on tasks that are
     part of a chain (previously dropped).

2. 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
     @delega-dev/cli (primary: DELEGA_API_KEY) don't need to set both.
   - DELEGA_API_KEY still wins when both are set (historical primary).

Sibling patch already shipped in @delega-dev/mcp@1.2.1; companion
patch landing in delega==0.2.1.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@ryanmcmillan ryanmcmillan merged commit 7c4e99f into main Apr 14, 2026
2 checks passed
@ryanmcmillan ryanmcmillan deleted the fix/env-var-tolerance branch April 14, 2026 18:31
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.

1 participant