Skip to content

v1.27.4

Choose a tag to compare

@luk384090-cloud luk384090-cloud released this 04 Sep 12:08
· 284 commits to main since this release
39c16c7

✨ Features

Agent Studio — Webhook Endpoint APIs

Complete webhook lifecycle management for event-driven architectures:

  • New resources: client.webhook_endpoints (sync) and async_client.webhook_endpoints (async)
  • Operations: create, list, get, update, delete webhook endpoints
  • Event filtering: subscribe to specific event types (WebhookEventType enum: AGENT_RUN_COMPLETED, SESSION_COMPLETED, etc.)
  • Status management: endpoints can be ACTIVE or DISABLED (WebhookStatus enum)
  • Disabled reason tracking: understand why an endpoint was disabled via WebhookDisabledReason enum (MANUAL, CONSECUTIVE_DELIVERY_FAILURES, REDIRECT_RESPONSE, SSRF_VALIDATION_FAILED, TLS_VALIDATION_FAILED)
  • Delivery status: track webhook delivery outcomes via WebhookDeliveryStatus enum (SUCCESS, FAILED, PENDING)
  • Type-safe params: WebhookEndpointCreateParams, WebhookEndpointUpdateParams, WebhookEventListParams for structured request building
  • Removed wildcard subscription: explicit event type selection required (no more *)

CLI — Async Task Management Commands

Full async task lifecycle support for image generation, speech synthesis, and transcription:

  • dashscope image-gen fetch <task_id>: query task status or retrieve results
  • dashscope image-gen wait <task_id>: block until task completes (success/failure/cancellation)
  • dashscope image-gen cancel <task_id>: cancel a pending task with success confirmation
  • dashscope image-gen list: list tasks with filtering (--limit, --after, --before, --status)
  • Same commands available for synthesis and transcription subcommands
  • Workspace support via -w / --workspace flag

SDK Core — Unified Client Identification Header

Consolidated SDK telemetry into a single structured header for backend analytics:

  • Merged headers: replaced x-dashscope-sdk-client + x-dashscope-sdk-version with single x-dashscope-sdk-client: python-sdk/<version>[/<module>]
  • Module tagging: get_sdk_headers(module="agentstudio") → python-sdk/1.27.4/agentstudio
  • Applied to all request paths: HTTP/HTTPS/WebSocket sync/async, Agent Studio transport, acli TongyiProvider
  • Backward compatible: set DASHSCOPE_DISABLE_SDK_HEADERS=1 to opt out
  • Session tracking: x-dashscope-sdk-session-id remains unchanged for correlation

SDK Core — SDK Client Identifier Override

  • sdk_client parameter: override the SDK client identifier in API calls for custom integrations
  • Deployment plan parameters: deployment_id, deployment_version for tracking deployment-specific usage

🐛 Bug Fixes

HTTP — TCP Keepalive on Shared Sync Session Pool (#187)

Problem: Pooled connections silently dropped by NAT gateways or load balancers (no FIN/RST) would stall until the 300-second read timeout expired, causing intermittent hangs in long-running applications.

Solution:

  • Enabled TCP keepalive socket options on the shared sync session's connection pool:
    • SO_KEEPALIVE: enable keepalive at the socket level
    • TCP_KEEPIDLE (Linux) / TCP_KEEPALIVE (macOS): idle time before first probe (60s)
    • TCP_KEEPINTVL: interval between probes (30s)
    • TCP_KEEPCNT: max probes before declaring connection dead (3)
  • Kernel now detects stale connections in ~150s (60 + 3×30) instead of 300s, failing fast with ConnectionError (retried once)
  • New public API: dashscope.close_shared_sync_session() — reset the SDK-managed connection pool for long-running apps
  • Auto-cleanup: pooled connections closed at interpreter exit via atexit.register()
  • Preserved TCP_NODELAY (urllib3 replaces default options when custom options are supplied)

acli — Windows TUI Fixes (#188)

Problem 1: run_command failed with AttributeError: 'Capture' object has no attribute 'encoding' inside the TUI.

  • Root cause: sys.stdout.encoding was read at runtime, but the TUI replaces sys.stdout with Textual's capture object (no .encoding attribute)
  • Fix: encoding resolved at import time, not runtime

Problem 2: Mouse wheel scroll translated to arrow keys or screen drag on Windows Terminal / conhost.

  • Root cause: terminal never received mouse capture signal, so wheel events were interpreted as navigation
  • Fix: enable mouse capture in the TUI on Windows

Additional improvements:

  • PowerShell preference: pwsh preferred over cmd.exe, commands passed as argv elements (no re-quoting), -NoProfile flag added
  • Markdown table rendering: tables now render correctly in the TUI output
  • Input draft preservation: user input restored around confirmation prompts
  • Confirm mode: new confirm_mode config option — "dangerous" (default) auto-passes CONFIRM-level tools (run_command, write_file), only DANGEROUS tools (delete_file, delete_directory) prompt; "all" prompts for everything

acli — Agentic CLI Sync (v0.6.3 → v0.6.4)

Synced upstream agenticCLI improvements:

  • Stagnation tracker: read-only hard cap for oneshot runs (prevents infinite loops)
  • Auto-approve: auto_approve config + ACLI_AUTO_APPROVE env override for non-interactive runs
  • Budget-aware convergence nudge: nudge logic considers remaining budget in autonomous runs
  • HardenedProvider: capped exponential backoff (3 retries, 4s base, 16s cap) to survive transient model-API failures
  • Post-change verification rule: rule 18 — run tests covering the change, or add a focused test when nothing covers it, report command + pass/fail
  • Plan wiring: multi-step work uses create_plan/complete_step, echoed as "## Current plan"
  • Oneshot flag fix: -c now correctly applies --protocol/--max-turns overrides (previously returned before overrides were applied)
  • Default model: qwen3.8-max becomes the factory default (was qwen3.7-max)

Agent Studio — Webhook Model Merge Issue

  • Problem: webhook update operations incorrectly merged the entire model object instead of updating specific fields
  • Fix: explicit field-level updates in WebhookEndpointUpdateParams

🧪 Testing

  • Unit tests: x-dashscope-sdk-client header format validation
  • Unit tests: TCP keepalive socket options and session lifecycle
  • Unit tests: CLI async task commands (fetch, wait, cancel, list) for image generation, synthesis, transcription
  • Unit tests: acli reflection.py — 100+ test cases covering is_readonly_tool_call (67 cases), ReflectionTracker (11 cases), StagnationTracker (10 cases), convergence_hint (12 cases)

👥 Contributors

  • @lzsweb — acli Windows TUI fixes, agentic CLI sync, stagnation tracker, confirm mode, unit tests, pre-commit hooks, SDK client module tagging
  • @luk384090-cloud — TCP keepalive, CLI async commands, SDK client header consolidation, deployment plan parameters
  • @coolsky99 — Agent Studio webhook APIs, webhook model merge fix

Full Changelog: v1.27.3...v1.27.4

Upgrade: pip install --upgrade dashscope