feat(oab-mcp): add deploy_events — ECS control-plane event history - #16
Merged
Conversation
A 7th, read-only MCP tool that surfaces the ECS lifecycle timeline DescribeTasks cannot show: task stops + stoppedReason, service impairment, and deployment transitions. Events are read back (pull) from a CloudWatch Logs group that an EventBridge rule archives ECS events into. The MCP server is a short-lived stdio process with nowhere to receive a live push, so the event source is decoupled into a store and this tool queries it — the MCP boundary stays pull. - oabctl: new `events` module — CloudWatch Logs FilterLogEvents + EventBridge-envelope normalization into EcsEvent (4 unit tests) - studio-cp: observe_events() passthrough + re-exports - oab-mcp: deploy_events tool + handler + dispatch + event_json (+ catalog/event_json tests; catalog assertion 6 -> 7) Caveat (documented in the tool + module docs): a container healthStatus flip while a task stays RUNNING is NOT emitted by ECS as an event (the field is absent from Task State Change events); that signal stays poll-only via DescribeTasks. Infra (separate, work-block B): an EventBridge rule -> CloudWatch Logs group (default /oab/ecs-events, override $OAB_EVENTS_LOG_GROUP) plus logs:FilterLogEvents on the oab-mcp task role. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds a 7th, read-only MCP tool —
deploy_events— tooab-mcp, so an agent can read the ECS lifecycle timeline thatDescribeTasks(a point-in-time snapshot) cannot show: task stops +stoppedReason, service-impairment, and deployment transitions.Why / design
oab-mcpis a short-lived stdio server spawned per session — it has nowhere to receive a live push. So "receive ECS events" is implemented as event-sourcing: an EventBridge rule archives ECS events into a CloudWatch Logs group, and this tool reads that store on demand. The MCP boundary stays pull; what changes is that you can now query history (a timeline), not just now.Tool
log_groupdefaults to$OAB_EVENTS_LOG_GROUP, else/oab/ecs-events.Changes (3 crates, additive, read-only)
src/events.rs(new): CloudWatch LogsFilterLogEvents+ normalize each EventBridge envelope →EcsEvent; newest-first; bounded pagination; per-service / per-cluster filtering. 4 unit tests (parse task-stop, parse service-action viaresources[]ARN, skip non-ECS/garbage, name normalization).observe_events()passthrough + re-exportsEcsEvent/DEFAULT_EVENTS_LOG_GROUP.deploy_eventstool registration +t_eventshandler + dispatch +event_json; catalog test updated 6 → 7, plus anevent_jsontest.Caveat (documented in the tool description + module docs)
A container
healthStatusflip while a task staysRUNNING(e.g. an agent goingUnhealthywithout restarting) is not emitted by ECS as an event — the field is absent from Task State Change events. That signal remains poll-only viaDescribeTasks; only lifecycle/stop/service/deployment transitions land here.Requires (separate — infra, not in this PR)
source: aws.ecs, scoped to theoabcluster) → target the CloudWatch Logs group/oab/ecs-events.logs:FilterLogEvents(+GetLogEvents) on theoab-mcptask role.Until that exists, the tool returns cleanly against an empty/absent group (it surfaces the read error rather than crashing the server).
Test status
Full workspace
cargo test(oabctl 83 + studio-cp 5 + oab-mcp 3 + new events 4) passed green locally before a small clippy autofix (split_once/sort_by_key);cargo clippyis clean after the fix (which compiles the whole crate). The post-fix test binary re-link hit a local disk-space wall (the statically-linked test binary pulls the full AWS SDK); the fix is a mechanical, semantics-preserving clippy suggestion, so I'm relying on CI here for the authoritative test+clippy+fmt run.🤖 Generated with Claude Code