fix: consolidate auth error handling and fix start.bat credential check

This commit addresses issues found during review of PRs #12 and #28:

## PR #12 (Auth Error Handling) Fixes

- Create shared auth.py module with centralized AUTH_ERROR_PATTERNS,
  is_auth_error(), and print_auth_error_help() functions
- Fix start.bat to use directory check instead of outdated
  .credentials.json file check (matching start.sh behavior)
- Update process_manager.py to import from shared auth module
- Update start.py to import from shared auth module
- Update documentation comments in autonomous_agent_demo.py and
  client.py to remove references to deprecated .credentials.json

## PR #28 (Feature Management) Improvements

- Add _priority_lock threading lock to feature_mcp.py to prevent
  race conditions when multiple features are created simultaneously
- Apply lock to feature_create, feature_create_bulk, and feature_skip
- Add checkAndSendTimeoutRef cleanup in useAssistantChat.ts to
  prevent memory leaks on component unmount
- Clear currentAssistantMessageRef on response_done

## Code Quality

- All Python files pass ruff linting
- All security tests pass (91/91)
- UI passes ESLint and TypeScript compilation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Auto
2026-01-10 12:19:32 +02:00
parent cd82a4cf46
commit a0f7e72361
10 changed files with 430 additions and 170 deletions

View File

@@ -18,6 +18,11 @@ from typing import Awaitable, Callable, Literal, Set
import psutil
# Add parent directory to path for shared module imports
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
from auth import AUTH_ERROR_HELP_SERVER as AUTH_ERROR_HELP # noqa: E402
from auth import is_auth_error
logger = logging.getLogger(__name__)
# Patterns for sensitive data that should be redacted from output
@@ -36,47 +41,6 @@ SENSITIVE_PATTERNS = [
r'aws[_-]?secret[=:][^\s]+',
]
# Patterns that indicate Claude CLI authentication errors
AUTH_ERROR_PATTERNS = [
r"not\s+logged\s+in",
r"not\s+authenticated",
r"authentication\s+(failed|required|error)",
r"login\s+required",
r"please\s+(run\s+)?['\"]?claude\s+login",
r"unauthorized",
r"invalid\s+(token|credential|api.?key)",
r"expired\s+(token|session|credential)",
r"could\s+not\s+authenticate",
r"sign\s+in\s+(to|required)",
]
def is_auth_error(text: str) -> bool:
"""Check if text contains Claude CLI authentication error messages."""
if not text:
return False
text_lower = text.lower()
for pattern in AUTH_ERROR_PATTERNS:
if re.search(pattern, text_lower):
return True
return False
AUTH_ERROR_HELP = """
================================================================================
AUTHENTICATION ERROR DETECTED
================================================================================
Claude CLI requires authentication to work.
To fix this, run:
claude login
This will open a browser window to sign in.
After logging in, try starting the agent again.
================================================================================
"""
def sanitize_output(line: str) -> str:
"""Remove sensitive information from output lines."""