mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-02-01 15:03:36 +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 asyncio
|
||||||
|
import io
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from claude_agent_sdk import ClaudeSDKClient
|
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 client import create_client
|
||||||
from progress import print_session_header, print_progress_summary, has_features
|
from progress import print_session_header, print_progress_summary, has_features
|
||||||
from prompts import (
|
from prompts import (
|
||||||
|
|||||||
@@ -145,26 +145,24 @@ def feature_get_stats() -> str:
|
|||||||
def feature_get_next() -> str:
|
def feature_get_next() -> str:
|
||||||
"""Get the highest-priority pending feature to work on.
|
"""Get the highest-priority pending feature to work on.
|
||||||
|
|
||||||
Returns the feature with the lowest priority number that has passes=false
|
Returns the feature with the lowest priority number that has passes=false.
|
||||||
and is not currently in-progress by another session.
|
|
||||||
Use this at the start of each coding session to determine what to implement next.
|
Use this at the start of each coding session to determine what to implement next.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
JSON with feature details (id, priority, category, name, description, steps, passes, in_progress)
|
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()
|
session = get_session()
|
||||||
try:
|
try:
|
||||||
feature = (
|
feature = (
|
||||||
session.query(Feature)
|
session.query(Feature)
|
||||||
.filter(Feature.passes == False)
|
.filter(Feature.passes == False)
|
||||||
.filter(Feature.in_progress == False)
|
|
||||||
.order_by(Feature.priority.asc(), Feature.id.asc())
|
.order_by(Feature.priority.asc(), Feature.id.asc())
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
|
|
||||||
if feature is None:
|
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)
|
return json.dumps(feature.to_dict(), indent=2)
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user