Enhance limit reached message for better context and display in the UI

This commit is contained in:
Corey Cauble
2026-01-09 14:30:34 -08:00
committed by GitHub
parent 7f436a467b
commit 2b2e28a2c5

View File

@@ -200,8 +200,9 @@ async def run_autonomous_agent(
if status == "continue": if status == "continue":
delay_seconds = AUTO_CONTINUE_DELAY_SECONDS delay_seconds = AUTO_CONTINUE_DELAY_SECONDS
target_time_str = None target_time_str = None
if response.lower().strip().startswith("limit reached"): if response.lower().strip().startswith("limit reached"):
print("Agent indicated limit reached.") print("Claude Agent SDK indicated limit reached.")
# Try to parse reset time from response # Try to parse reset time from response
match = re.search( match = re.search(
@@ -241,7 +242,7 @@ async def run_autonomous_agent(
if target_time_str: if target_time_str:
print( print(
f"\nAgent will auto-continue in {delay_seconds:.0f}s ({target_time_str})...", f"\nClaude Code Limit Reached. Agent will auto-continue in {delay_seconds:.0f}s ({target_time_str})...",
flush=True, flush=True,
) )
else: else:
@@ -249,8 +250,8 @@ async def run_autonomous_agent(
f"\nAgent will auto-continue in {delay_seconds:.0f}s...", flush=True f"\nAgent will auto-continue in {delay_seconds:.0f}s...", flush=True
) )
sys.stdout.flush() # this should allow the pause to be displayed before sleeping
print_progress_summary(project_dir) print_progress_summary(project_dir)
sys.stdout.flush()
await asyncio.sleep(delay_seconds) await asyncio.sleep(delay_seconds)
elif status == "error": elif status == "error":