chore(agent): expose or remove the _debug_cw_failures counter — incremented, never read
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- aws, python
- Domain
- backend, cloud, observability
Research direction
Start in agent/src/server.py around the _debug_cw_failures increments at lines 197 and 226, then inspect the /ping and /validate responses and the _aws_silent_log ordering rule. Decide whether the counter should be exposed, emitted, or removed, and verify the relevant failure path and docstrings. Done means the counter's behavior matches the chosen option and no documentation promises an unavailable alarm surface.
Written by the indexing model from the issue text.
Description
Problem
agent/src/server.py maintains a module-global _debug_cw_failures counter, incremented under a lock on every failed CloudWatch write (:197, :226). Nothing ever reads it.
Three docstrings describe it as an operator-facing signal — :145 and :176 call it "a single alarm surface" — but there is no metric emission, no CloudWatch alarm, and no /ping or /validate exposure. The value dies with the process.
Why it matters
The counter exists to answer "is the debug/diagnostic path blind?" — i.e. is the agent failing to write the very lines an operator would use to diagnose a task. That is a genuinely useful signal on a substrate where the guest is otherwise unobservable, and it is currently unobtainable. Worse, the docstrings promise it, so a reader debugging a silent task may go looking for an alarm that does not exist.
Surfaced during the ADR-021 P2 review (PR #733, non-blocking item 6). Pre-existing, not introduced by that PR. Note that #733 removed the one place that depended on the counter rhetorically: _build_hook_log's reason #1 previously argued a build-role write would "poison the signal", and now argues from IAM namespace scoping instead. So there is no longer anything blocking a decision either way.
Options
- Expose it (smallest useful change): include it in the
/pingand/or/validateresponse body./validatealready has awarningsarray and, as of #733, logs named warnings to the build log group — the same shape would work here. - Emit it as a metric (most useful): an EMF line or a
PutMetricDatacall at task finalize, which gives operators something alarmable. Note the ordering constraint: the emitter must not itself be a CloudWatch write on the path it is measuring, and it must respect the pre-platform_configAWS-silence rule (see_aws_silent_log). - Remove it and correct the three docstrings. Legitimate if nobody wants the signal — the failures are already logged individually to stdout.
Acceptance criteria
_debug_cw_failuresis either read by something an operator can observe, or removed.- The docstrings at
server.py:145and:176describe what actually exists. - If exposed: a test asserts a non-zero counter is visible after a forced write failure, and that the exposure path does not itself perform a CloudWatch write.
- If removed: no docstring anywhere references an alarm surface.
- Dominant language
- TypeScript
- Stars
- 146
- Forks
- 46
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 26
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws-samples/sample-autonomous-cloud-coding-agents
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug v1
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
bug v1
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
-
documentation P2 security
Difficulty 2/5 1-2 days Newbie friendliness 74/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aws-samples/sample-autonomous-cloud-coding-agents#767 · 2 comments ·
All issues in aws-samples/sample-autonomous-cloud-coding-agents
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mksglu/context-mode#1200 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
AOSSIE-Org/DebateAI#582 · 2 comments ·