[dreamwidth/dreamwidth] 74b8d9: ecs-shell + dwtool: pick the worker container, ded...
Branch: refs/heads/main Home: https://github.com/dreamwidth/dreamwidth Commit: 74b8d9586e2a47978ec4faae27b184e25425a788 https://github.com/dreamwidth/dreamwidth/commit/74b8d9586e2a47978ec4faae27b184e25425a788 Author: Mark Smith mark@dreamwidth.org Date: 2026-04-27 (Mon, 27 Apr 2026)
Changed paths: M bin/ecs-shell M src/dwtool/internal/aws/ecs.go
Log Message:
ecs-shell + dwtool: pick the worker container, dedupe selection logic
The container-resolution logic in bin/ecs-shell and dwtool was duplicated across four spots and missed log_router as a sidecar. For worker tasks where the first container in the list happened to be log_router, both tools picked it — bin/ecs-shell got TargetNotConnected because log_router has no shell, and dwtool's dashboard CONTAINER column showed log_router instead of the actual worker container.
Centralized to one source of truth per language, with cross-references:
bin/ecs-shell — single $APP_CONTAINER JMESPath fragment defined once at the top, used by both list_tasks (display) and resolve_container (connect/exec). connect_to_task now just calls resolve_container instead of inlining the same query.
src/dwtool/internal/aws/ecs.go — single pickAppContainerIndex helper. ecsTaskToModel (which fills task.ContainerName) and findAppContainer (which feeds FetchServiceImages) both delegate via a containerNames adapter. The unused exported ResolveContainer is removed.
Selection policy in both: prefer "web" (web tasks) or "worker" (worker tasks); fall back to anything that isn't cloudwatch-agent or log_router; final fallback to the first container.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
To unsubscribe from these emails, change your notification settings at https://github.com/dreamwidth/dreamwidth/settings/notifications
