kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-18 14:06:23 +02:00
parent 824341a972
commit e3a286ef6f
5 changed files with 1598 additions and 6 deletions

View file

@ -126,16 +126,25 @@ def generate_followups(
parsed = _try_parse_json(output)
if not isinstance(parsed, list):
if isinstance(parsed, dict):
parsed = parsed.get("tasks") or parsed.get("followups") or []
if "tasks" in parsed:
parsed = parsed["tasks"]
elif "followups" in parsed:
parsed = parsed["followups"]
else:
parsed = []
else:
return {"created": [], "pending_actions": []}
# Guard: extracted value might be null/non-list (e.g. {"tasks": null})
if not isinstance(parsed, list):
parsed = []
# Separate permission-blocked items from normal ones
created = []
pending_actions = []
for item in parsed:
if not isinstance(item, dict) or "title" not in item:
if not isinstance(item, dict) or not item.get("title"):
continue
if _is_permission_blocked(item):

View file

@ -31,13 +31,27 @@ def validate_completion_mode(value: str) -> str:
return "review"
# Columns that are stored as JSON strings and must be decoded on read.
# Text fields (title, description, name, etc.) are NOT in this set.
_JSON_COLUMNS: frozenset[str] = frozenset({
"tech_stack",
"brief", "spec", "review", "test_result", "security_result", "labels",
"tags",
"dependencies",
"steps",
"artifacts", "decisions_made", "blockers",
"extra_json",
"pending_actions",
})
def _row_to_dict(row: sqlite3.Row | None) -> dict | None:
"""Convert sqlite3.Row to dict with JSON fields decoded."""
if row is None:
return None
d = dict(row)
for key, val in d.items():
if isinstance(val, str) and val.startswith(("[", "{")):
if key in _JSON_COLUMNS and isinstance(val, str) and val.startswith(("[", "{")):
try:
d[key] = json.loads(val)
except (json.JSONDecodeError, ValueError):