Make Gitea publishing claimant controlled

This commit is contained in:
2026-08-27 16:13:29 -07:00
parent 41e08611c9
commit a76ad5258b
10 changed files with 797 additions and 215 deletions
+22 -23
View File
@@ -631,8 +631,8 @@ async def execute_intake_pipeline(idea_id: str, bypass_duplicate_check: bool = F
with get_db() as conn:
runs = [dict(r) for r in conn.execute("SELECT * FROM processor_runs WHERE idea_id = ?", (idea_id,)).fetchall()]
# 1. Primary: Persist as a dedicated Gitea Project Repository under 'thinkstorm' org
gitea_res = await gitea_svc.persist_idea_dossier_repo(
# Persist the dossier locally. Remote Gitea publication is claimant-triggered.
await gitea_svc.persist_idea_dossier_repo(
idea_id=idea_id,
title=title,
summary=summary,
@@ -643,10 +643,11 @@ async def execute_intake_pipeline(idea_id: str, bypass_duplicate_check: bool = F
research_docs=research_docs,
outputs={},
provenance_runs=runs,
submission_image=submission_image
submission_image=submission_image,
publish_remote=False
)
# 2. Secondary: Persist local durable files & OpenGist
# Publish the research dossier to OpenGist as before.
gist_res = await opengist_svc.persist_idea_artifact(
idea_id=idea_id,
title=title,
@@ -661,7 +662,7 @@ async def execute_intake_pipeline(idea_id: str, bypass_duplicate_check: bool = F
submission_image=submission_image
)
# Finalize Idea to AVAILABLE and record repository links
# Finalize the idea without creating or predicting a Gitea repository.
with get_db() as conn:
conn.execute(
"""
@@ -669,22 +670,12 @@ async def execute_intake_pipeline(idea_id: str, bypass_duplicate_check: bool = F
SET lifecycle_state = 'AVAILABLE',
processing_state = 'IDLE',
enrichment_level = 5,
gitea_repo_name = ?,
gitea_repo_url = ?,
opengist_id = ?,
opengist_url = ?,
updated_at = ?
WHERE id = ?
""",
(gitea_res["repo_name"], gitea_res["repo_url"], gist_res["opengist_id"], gist_res["opengist_url"], get_utc_now(), idea_id)
)
# Store in external_resources
conn.execute(
"""
INSERT INTO external_resources (idea_id, resource_type, url, metadata, created_at)
VALUES (?, 'GITEA_DOSSIER', ?, ?, ?)
""",
(idea_id, gitea_res["repo_url"], json.dumps(gitea_res), get_utc_now())
(gist_res["opengist_id"], gist_res["opengist_url"], get_utc_now(), idea_id)
)
except Exception as e:
@@ -738,11 +729,14 @@ async def execute_work_track_workflow(work_track_id: str, model_override: Option
start_time = get_utc_now()
generated_outputs: Dict[str, str] = {}
idea_title = str(idea["title"] or idea["id"])
idea_summary = str(idea["summary"] or "")
if work_type == "ARTICLE" or work_type == "BLOG_ENTRY":
prompt_info = get_prompt_version("article-generator", is_admin=True)
user_prompt = (
prompt_info["user_prompt_template"]
.replace("{{title}}", idea["title"])
.replace("{{title}}", idea_title)
.replace("{{track_name}}", track_name)
.replace("{{research_context}}", combined_research)
)
@@ -761,8 +755,8 @@ async def execute_work_track_workflow(work_track_id: str, model_override: Option
prompt_info = get_prompt_version("coding-spec-generator", is_admin=True)
user_prompt = (
prompt_info["user_prompt_template"]
.replace("{{title}}", idea["title"])
.replace("{{summary}}", idea["summary"])
.replace("{{title}}", idea_title)
.replace("{{summary}}", idea_summary)
.replace("{{feasibility_context}}", combined_research)
)
llm_resp = await omniroute_svc.chat_completion(
@@ -781,9 +775,9 @@ async def execute_work_track_workflow(work_track_id: str, model_override: Option
prompt_info = get_prompt_version("youtube-video-generator", is_admin=True)
user_prompt = (
prompt_info["user_prompt_template"]
.replace("{{title}}", idea["title"])
.replace("{{title}}", idea_title)
.replace("{{track_name}}", track_name)
.replace("{{summary}}", idea["summary"])
.replace("{{summary}}", idea_summary)
.replace("{{research_context}}", combined_research)
)
llm_resp = await omniroute_svc.chat_completion(
@@ -821,9 +815,14 @@ async def execute_work_track_workflow(work_track_id: str, model_override: Option
)
conn.execute("UPDATE work_tracks SET state = 'COMPLETED', completed_at = ? WHERE id = ?", (end_time, work_track_id))
# Sync deliverables to Gitea Repository & OpenGist
# Keep Work Track deliverables local until the claimant publishes the dossier.
try:
await gitea_svc.persist_work_track_outputs(idea_id, track_name, generated_outputs)
await gitea_svc.persist_work_track_outputs(
idea_id,
track_name,
generated_outputs,
publish_remote=False
)
except Exception as e:
print(f"[Gitea Sync Notice] {e}")