Skip to content

fix(manager): allow container API helpers in strict mode#190

Open
samzong wants to merge 1 commit intoalibaba:mainfrom
samzong:fix/container-api-strict-mode
Open

fix(manager): allow container API helpers in strict mode#190
samzong wants to merge 1 commit intoalibaba:mainfrom
samzong:fix/container-api-strict-mode

Conversation

@samzong
Copy link

@samzong samzong commented Mar 10, 2026

Summary

Fix manager/scripts/lib/container-api.sh so _api and _api_code can be called without a request body when sourced from scripts running with set -u.

Previously, calls like _api GET /version or _api_code POST /containers/<name>/start could fail with an unbound variable error because $3 was accessed directly.

Fixes #188

Changes

  • default the optional data argument in _api and _api_code with ${3-}
  • add a regression test covering strict-mode usage without a request body
  • record the manager-side change in changelog/current.md

Why

Several container API helpers intentionally omit the request body argument. That works in normal shell mode, but breaks in bash strict mode (set -u), which some manager scripts use.

Testing

  • bash manager/tests/test-container-api-strict-mode.sh
  • bash -n manager/scripts/lib/container-api.sh
  • bash -n manager/tests/test-container-api-strict-mode.sh
  • bash -n manager/agent/skills/worker-management/scripts/lifecycle-worker.sh

@CLAassistant
Copy link

CLAassistant commented Mar 10, 2026

CLA assistant check
All committers have signed the CLA.

@samzong
Copy link
Author

samzong commented Mar 11, 2026

@johnlanni it's seem not PR reason.

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.

Bug: container_api_available fails in strict mode (set -euo pipefail)

2 participants