|
|
@@ -15,6 +15,7 @@ from production_build_agents.global_data.graph import create_global_data_graph
|
|
|
from production_build_agents.global_data_stage_finalization import (
|
|
|
validate_completed_run,
|
|
|
)
|
|
|
+from production_build_agents.observability import GlobalDataObservation
|
|
|
from production_build_agents.run.langgraph_checkpointer import (
|
|
|
create_sqlite_checkpointer,
|
|
|
)
|
|
|
@@ -130,34 +131,53 @@ def run_global_data(
|
|
|
validator_model=validator_model,
|
|
|
)
|
|
|
saved = dict(graph.get_state(config).values)
|
|
|
- if saved:
|
|
|
- validate_resume_identity(
|
|
|
- saved,
|
|
|
- thread_id=thread_id,
|
|
|
- protocol_version=PROTOCOL_VERSION,
|
|
|
- input_path=source,
|
|
|
- input_sha256=input_sha256,
|
|
|
- run_dir=run_dir,
|
|
|
+ execution_mode = (
|
|
|
+ (
|
|
|
+ "completed_noop"
|
|
|
+ if saved.get("status") == "COMPLETED"
|
|
|
+ else "failed_noop"
|
|
|
)
|
|
|
- if saved.get("status") in TERMINAL_STATUSES:
|
|
|
- if saved.get("status") == "COMPLETED":
|
|
|
- validate_completed_run(saved)
|
|
|
- return saved
|
|
|
- graph_invoked = True
|
|
|
- result = dict(graph.invoke(None, config))
|
|
|
- else:
|
|
|
- graph_invoked = True
|
|
|
- result = dict(
|
|
|
- graph.invoke(
|
|
|
- _initial_state(
|
|
|
- thread_id=thread_id,
|
|
|
- input_path=source,
|
|
|
- input_sha256=input_sha256,
|
|
|
- run_dir=run_dir,
|
|
|
- ),
|
|
|
- config,
|
|
|
+ if saved and saved.get("status") in TERMINAL_STATUSES
|
|
|
+ else ("resume" if saved else "fresh")
|
|
|
+ )
|
|
|
+ with GlobalDataObservation(
|
|
|
+ project_root=Path(__file__).resolve().parent,
|
|
|
+ thread_id=thread_id,
|
|
|
+ input_sha256=input_sha256,
|
|
|
+ protocol_version=PROTOCOL_VERSION,
|
|
|
+ execution_mode=execution_mode,
|
|
|
+ graph=graph,
|
|
|
+ ) as observation:
|
|
|
+ if saved:
|
|
|
+ validate_resume_identity(
|
|
|
+ saved,
|
|
|
+ thread_id=thread_id,
|
|
|
+ protocol_version=PROTOCOL_VERSION,
|
|
|
+ input_path=source,
|
|
|
+ input_sha256=input_sha256,
|
|
|
+ run_dir=run_dir,
|
|
|
)
|
|
|
- )
|
|
|
+ if saved.get("status") in TERMINAL_STATUSES:
|
|
|
+ if saved.get("status") == "COMPLETED":
|
|
|
+ validate_completed_run(saved)
|
|
|
+ observation.finish(saved, graph_invoked=False)
|
|
|
+ return saved
|
|
|
+ graph_invoked = True
|
|
|
+ result = dict(graph.invoke(None, config))
|
|
|
+ else:
|
|
|
+ graph_invoked = True
|
|
|
+ result = dict(
|
|
|
+ graph.invoke(
|
|
|
+ _initial_state(
|
|
|
+ thread_id=thread_id,
|
|
|
+ input_path=source,
|
|
|
+ input_sha256=input_sha256,
|
|
|
+ run_dir=run_dir,
|
|
|
+ ),
|
|
|
+ config,
|
|
|
+ )
|
|
|
+ )
|
|
|
+ observation.finish(result, graph_invoked=graph_invoked)
|
|
|
if graph_invoked:
|
|
|
try:
|
|
|
record_run_invocation(
|