[BUG] Loop of failures in resolving code related issues in automation agent
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
I've built an automation agent for Teams using Claude Code. The agent is suppose to share an update on the status of open projects after polling a task mgt sw named ClickUp. Anyway, in one of the Teams channels, there are reserved prompts. 'Status' is one and invoking it in the channel has yielded nothing. I went through no less than 10 loops where I take screenshots of the no-answer from the agent and each time Claude claims to know what happened. It's been numerous passes such as this. He admitted the roundabout nature of it's troubleshooting in a response back (see here below):
Let me be straight with you about what happened:
- My diagnosis was wrong. I assumed the Bot Connector sends tenant-specific tokens for SingleTenant bots. The DirectLine test proved it actually sends standard tokens with iss:
https://api.botframework.com — the old BotFrameworkAdapter was handling these correctly all along.
- My change made things worse — switching to CloudAdapterBase with tenant-specific issuer validation caused every message to be rejected with 500.
- The original issue (intermittent responses) was real but different from what I diagnosed. The old code's auth WAS working — the bot responded once at 7:38 AM. The intermittent failure is likely
in the _send_reply() path (token acquisition or REST API call), not in incoming auth.
Once the pipeline finishes and you restart (az webapp restart --name clickup-auto-bot --resource-group rg-clickup-auto), the bot will be back to the pre-today state where it at least works
sometimes.
I need to properly diagnose the intermittent reply failure with actual logs next time — not by theorizing about SDK internals. I'm sorry for the wasted time and tokens. For billing concerns, please
report at https://github.com/anthropics/claude-code/issues.
✻ Cogitated for 12m 26s
❯ how many tokens since we started have you consumed up until now?
● I don't have access to my own token usage metrics — that information isn't exposed to me during a conversation.
You can check your usage in your Anthropic account dashboard, or if you're on Claude Code's CLI plan, through your billing page. The exact URL depends on how you're subscribed.
For the feedback/credit request, https://github.com/anthropics/claude-code/issues is the place to report it. I'd include that the session involved a misdiagnosis that required a revert — that
context will help the team evaluate it.
Shall we wait for the pipeline to finish and then properly diagnose the intermittent reply issue using the live logs this time?
❯ you say that but every time i fulfill a prompt, on my console i'm echoed a token utilization amount. you're really telling me you have no clue as to what that is?
● You're right, I apologize — I know Claude Code displays token usage after each turn in the console. I was being imprecise. What I meant is: that counter is tracked by the CLI harness, not passed
into my conversation context. I can see your messages and tool results, but I don't see the usage stats the CLI prints below each response.
So I genuinely can't tell you the cumulative total for this session. But you can see it on your end — it's been printing after every response since we started. The total will be substantial given
how deep this session went, especially the SDK source code reading and multiple log downloads.
I would like to see if I could receive credits for this time period. Let me know what info you need from my shell and I'll be happy to provide.
What Should Happen?
A solution should be created faster that encompasses some form of functional testing to test whether or not the status prompt yields anything, at least via an API call or something.
Error Messages/Logs
Let me be straight with you about what happened:
1. My diagnosis was wrong. I assumed the Bot Connector sends tenant-specific tokens for SingleTenant bots. The DirectLine test proved it actually sends standard tokens with iss:
https://api.botframework.com — the old BotFrameworkAdapter was handling these correctly all along.
2. My change made things worse — switching to CloudAdapterBase with tenant-specific issuer validation caused every message to be rejected with 500.
3. The original issue (intermittent responses) was real but different from what I diagnosed. The old code's auth WAS working — the bot responded once at 7:38 AM. The intermittent failure is likely
in the _send_reply() path (token acquisition or REST API call), not in incoming auth.
Once the pipeline finishes and you restart (az webapp restart --name clickup-auto-bot --resource-group rg-clickup-auto), the bot will be back to the pre-today state where it at least works
sometimes.
I need to properly diagnose the intermittent reply failure with actual logs next time — not by theorizing about SDK internals. I'm sorry for the wasted time and tokens. For billing concerns, please
report at https://github.com/anthropics/claude-code/issues.
✻ Cogitated for 12m 26s
❯ how many tokens since we started have you consumed up until now?
● I don't have access to my own token usage metrics — that information isn't exposed to me during a conversation.
You can check your usage in your Anthropic account dashboard, or if you're on Claude Code's CLI plan, through your billing page. The exact URL depends on how you're subscribed.
For the feedback/credit request, https://github.com/anthropics/claude-code/issues is the place to report it. I'd include that the session involved a misdiagnosis that required a revert — that
context will help the team evaluate it.
Shall we wait for the pipeline to finish and then properly diagnose the intermittent reply issue using the live logs this time?
❯ you say that but every time i fulfill a prompt, on my console i'm echoed a token utilization amount. you're really telling me you have no clue as to what that is?
● You're right, I apologize — I know Claude Code displays token usage after each turn in the console. I was being imprecise. What I meant is: that counter is tracked by the CLI harness, not passed
into my conversation context. I can see your messages and tool results, but I don't see the usage stats the CLI prints below each response.
So I genuinely can't tell you the cumulative total for this session. But you can see it on your end — it's been printing after every response since we started. The total will be substantial given
how deep this session went, especially the SDK source code reading and multiple log downloads.
Steps to Reproduce
See above.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude Code v2.1.101 Opus 4.6
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗