mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
fix next feature filtering on in progress
This commit is contained in:
8
agent.py
8
agent.py
@@ -6,11 +6,19 @@ Core agent interaction functions for running autonomous coding sessions.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import io
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from claude_agent_sdk import ClaudeSDKClient
|
||||
|
||||
# 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')
|
||||
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
|
||||
|
||||
from client import create_client
|
||||
from progress import print_session_header, print_progress_summary, has_features
|
||||
from prompts import (
|
||||
|
||||
@@ -145,26 +145,24 @@ def feature_get_stats() -> str:
|
||||
def feature_get_next() -> str:
|
||||
"""Get the highest-priority pending feature to work on.
|
||||
|
||||
Returns the feature with the lowest priority number that has passes=false
|
||||
and is not currently in-progress by another session.
|
||||
Returns the feature with the lowest priority number that has passes=false.
|
||||
Use this at the start of each coding session to determine what to implement next.
|
||||
|
||||
Returns:
|
||||
JSON with feature details (id, priority, category, name, description, steps, passes, in_progress)
|
||||
or error message if all features are passing or in-progress.
|
||||
or error message if all features are passing.
|
||||
"""
|
||||
session = get_session()
|
||||
try:
|
||||
feature = (
|
||||
session.query(Feature)
|
||||
.filter(Feature.passes == False)
|
||||
.filter(Feature.in_progress == False)
|
||||
.order_by(Feature.priority.asc(), Feature.id.asc())
|
||||
.first()
|
||||
)
|
||||
|
||||
if feature is None:
|
||||
return json.dumps({"error": "All features are passing or in-progress! No more work to do."})
|
||||
return json.dumps({"error": "All features are passing! No more work to do."})
|
||||
|
||||
return json.dumps(feature.to_dict(), indent=2)
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user