Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1910b96
fix: add robust SQLite connection handling to prevent database corrup…
Jan 23, 2026
d43095a
Merge upstream/master with robust database handling
Jan 24, 2026
e014b04
feat(ui): add custom theme override system
Jan 24, 2026
380aee0
feat: Twitter-style UI theme + Playwright optimization + documentation
Jan 24, 2026
8326937
fix: SQLAlchemy PendingRollbackError + MCP support for Expand/Assistant
Jan 24, 2026
cfd297b
Merge feat/twitter-ui-theme into main
Jan 25, 2026
4099cc5
Merge remote-tracking branch 'upstream/master'
Jan 26, 2026
468e59f
fix: handle 404 errors for deleted assistant conversations
Jan 26, 2026
c4531de
Merge branch 'fix/assistant-conversation-404-handling'
Jan 26, 2026
2b07625
fix: improve 404 detection for deleted conversations
Jan 26, 2026
6629624
Merge branch 'fix/assistant-conversation-404-handling'
Jan 26, 2026
9b62fb6
fix: add engine caching to prevent file descriptor leaks
Jan 26, 2026
cb9d9c1
Merge remote-tracking branch 'upstream/master'
Jan 26, 2026
be173a4
fix: security vulnerabilities and race conditions from code review
Jan 27, 2026
b83f8ad
Merge upstream/master to resolve conflicts
Jan 27, 2026
65f5efe
fix: UI TypeScript errors and missing dependencies
Jan 27, 2026
1cb5b02
feat: add attempt tracking, error logging, and code improvements
Jan 27, 2026
a0c9850
fix: remove trailing whitespace from blank lines (lint)
Jan 27, 2026
532d78b
fix: update CI to use tests/ directory for security tests
Jan 27, 2026
36a9a5b
fix: address CodeRabbit review feedback
Jan 27, 2026
6a5341a
fix: address remaining CodeRabbit review feedback
Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions .claude/templates/coding_prompt.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,24 @@ This is a FRESH context window - you have no memory of previous sessions.
Start by orienting yourself:

```bash
# 1. See your working directory
pwd
# 1. See your working directory and project structure
pwd && ls -la

# 2. List files to understand project structure
ls -la
# 2. Read recent progress notes (last 100 lines)
tail -100 claude-progress.txt

# 3. Read the project specification to understand what you're building
cat app_spec.txt

# 4. Read progress notes from previous sessions (last 500 lines to avoid context overflow)
tail -500 claude-progress.txt

# 5. Check recent git history
git log --oneline -20
# 3. Check recent git history
git log --oneline -10
```

Then use MCP tools to check feature status:
Then use MCP tools:

```
# 6. Get progress statistics (passing/total counts)
# 4. Get progress statistics
Use the feature_get_stats tool
```
Comment on lines 23 to 26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix markdown linting issue: add language specifier to fenced code block.

The fenced code block is missing a language identifier, which violates markdown linting rules. Since this block contains instructional comments rather than executable code, consider using text or markdown as the language specifier.

📝 Proposed fix
-```
+```text
 # 4. Get progress statistics
 Use the feature_get_stats tool

</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

23-23: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In @.claude/templates/coding_prompt.template.md around lines 23 - 26, The fenced
code block containing the lines "# 4. Get progress statistics" and "Use the
feature_get_stats tool" is missing a language specifier; update that
triple-backtick block to include a language (e.g., text or markdown) so the
block becomes ```text ... ``` to satisfy markdown linting rules, leaving the
content unchanged.


Understanding the `app_spec.txt` is critical - it contains the full requirements
for the application you're building.
**NOTE:** Do NOT read `app_spec.txt` - you'll get all needed details from your assigned feature.

### STEP 2: START SERVERS (IF NOT RUNNING)

Expand Down Expand Up @@ -305,6 +298,17 @@ This allows you to fully test email-dependent flows without needing external ema

---

## TOKEN EFFICIENCY

To maximize context window usage:

- **Don't read files unnecessarily** - Feature details from `feature_get_by_id` contain everything you need
- **Be concise** - Short, focused responses save tokens for actual work
- **Use `feature_get_summary`** for status checks (lighter than `feature_get_by_id`)
- **Avoid re-reading large files** - Read once, remember the content

---

**Remember:** One feature per session. Zero console errors. All data from real database. Leave codebase clean before ending session.

---
Expand Down
28 changes: 18 additions & 10 deletions .claude/templates/testing_prompt.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ Your job is to ensure that features marked as "passing" still work correctly. If
Start by orienting yourself:

```bash
# 1. See your working directory
pwd
# 1. See your working directory and project structure
pwd && ls -la

# 2. List files to understand project structure
ls -la
# 2. Read recent progress notes (last 100 lines)
tail -100 claude-progress.txt

# 3. Read progress notes from previous sessions (last 200 lines)
tail -200 claude-progress.txt

# 4. Check recent git history
# 3. Check recent git history
git log --oneline -10
```

Then use MCP tools to check feature status:
Then use MCP tools:

```
# 5. Get progress statistics
# 4. Get progress statistics
Use the feature_get_stats tool
```

Expand Down Expand Up @@ -176,6 +173,17 @@ All interaction tools have **built-in auto-wait** - no manual timeouts needed.

---

## TOKEN EFFICIENCY

To maximize context window usage:

- **Don't read files unnecessarily** - Feature details from `feature_get_by_id` contain everything you need
- **Be concise** - Short, focused responses save tokens for actual work
- **Use `feature_get_summary`** for status checks (lighter than `feature_get_by_id`)
- **Avoid re-reading large files** - Read once, remember the content

---

## IMPORTANT REMINDERS

**Your Goal:** Verify that passing features still work, and fix any regressions found.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Lint with ruff
run: ruff check .
- name: Run security tests
run: python test_security.py
run: python -m pytest tests/test_security.py tests/test_security_integration.py -v

ui:
runs-on: ubuntu-latest
Expand Down
33 changes: 32 additions & 1 deletion agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import asyncio
import io
import logging
import re
import sys
from datetime import datetime, timedelta
Expand All @@ -16,14 +17,17 @@

from claude_agent_sdk import ClaudeSDKClient

# Module logger for error tracking (user-facing messages use print())
logger = logging.getLogger(__name__)

# Fix Windows console encoding for Unicode characters (emoji, etc.)
# Without this, print() crashes when Claude outputs emoji like ✅
if sys.platform == "win32":
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace", line_buffering=True)
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8", errors="replace", line_buffering=True)

from client import create_client
from progress import count_passing_tests, has_features, print_progress_summary, print_session_header
from progress import count_passing_tests, has_features, print_progress_summary, print_session_header, send_session_event
from prompts import (
copy_spec_to_project,
get_coding_prompt,
Expand Down Expand Up @@ -106,6 +110,7 @@ async def run_agent_session(
return "continue", response_text

except Exception as e:
logger.error(f"Agent session error: {e}", exc_info=True)
print(f"Error during agent session: {e}")
return "error", str(e)

Expand Down Expand Up @@ -163,6 +168,15 @@ async def run_autonomous_agent(

is_initializer = agent_type == "initializer"

# Send session started webhook
send_session_event(
"session_started",
project_dir,
agent_type=agent_type,
feature_id=feature_id,
feature_name=f"Feature #{feature_id}" if feature_id else None,
)

if is_initializer:
print("Running as INITIALIZER agent")
print()
Expand Down Expand Up @@ -236,6 +250,7 @@ async def run_autonomous_agent(
async with client:
status, response = await run_agent_session(client, prompt, project_dir)
except Exception as e:
logger.error(f"Client/MCP server error: {e}", exc_info=True)
print(f"Client/MCP server error: {e}")
# Don't crash - return error status so the loop can retry
status, response = "error", str(e)
Expand Down Expand Up @@ -291,6 +306,7 @@ async def run_autonomous_agent(
target_time_str = target.strftime("%B %d, %Y at %I:%M %p %Z")

except Exception as e:
logger.warning(f"Error parsing reset time: {e}, using default delay")
print(f"Error parsing reset time: {e}, using default delay")

if target_time_str:
Expand Down Expand Up @@ -327,6 +343,7 @@ async def run_autonomous_agent(
await asyncio.sleep(delay_seconds)

elif status == "error":
logger.warning("Session encountered an error, will retry")
print("\nSession encountered an error")
print("Will retry with a fresh session...")
await asyncio.sleep(AUTO_CONTINUE_DELAY_SECONDS)
Expand Down Expand Up @@ -354,4 +371,18 @@ async def run_autonomous_agent(
print("\n Then open http://localhost:3000 (or check init.sh for the URL)")
print("-" * 70)

# Send session ended webhook
passing, in_progress, total = count_passing_tests(project_dir)
send_session_event(
"session_ended",
project_dir,
agent_type=agent_type,
feature_id=feature_id,
extra={
"passing": passing,
"total": total,
"percentage": round((passing / total) * 100, 1) if total > 0 else 0,
}
)

print("\nDone!")
21 changes: 19 additions & 2 deletions api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@
Database models and utilities for feature management.
"""

from api.database import Feature, create_database, get_database_path
from api.agent_types import AgentType
from api.config import AutocoderConfig, get_config, reload_config
from api.database import Feature, FeatureAttempt, FeatureError, create_database, get_database_path
from api.feature_repository import FeatureRepository
from api.logging_config import get_logger, setup_logging

__all__ = ["Feature", "create_database", "get_database_path"]
__all__ = [
"AgentType",
"AutocoderConfig",
"Feature",
"FeatureAttempt",
"FeatureError",
"FeatureRepository",
"create_database",
"get_config",
"get_database_path",
"get_logger",
"reload_config",
"setup_logging",
]
29 changes: 29 additions & 0 deletions api/agent_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Agent Types Enum
================

Defines the different types of agents in the system.
"""

from enum import Enum


class AgentType(str, Enum):
"""Types of agents in the autonomous coding system.

Inherits from str to allow seamless JSON serialization
and string comparison.

Usage:
agent_type = AgentType.CODING
if agent_type == "coding": # Works due to str inheritance
...
"""

INITIALIZER = "initializer"
CODING = "coding"
TESTING = "testing"

def __str__(self) -> str:
"""Return the string value for string operations."""
return self.value
Loading
Loading