feat(runtime): heartbeat immediately after claim
Some checks failed
Governed runtime contract / contract (push) Failing after 1s
Some checks failed
Governed runtime contract / contract (push) Failing after 1s
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a06ba0-10aa-7ea0-b20a-4f3fac39efe9
This commit is contained in:
parent
4310c15eac
commit
44f5bb9d88
7 changed files with 242 additions and 11 deletions
|
|
@ -305,6 +305,30 @@ def process_one(
|
|||
return ProcessResult(claimed=False, empty=True, reason="queue empty")
|
||||
|
||||
run = claimed[0]
|
||||
try:
|
||||
# Make active lease ownership observable even for normal short jobs,
|
||||
# and fail closed before dispatch if Activity Core no longer accepts it.
|
||||
client.heartbeat(run.id, lease_seconds=cfg.lease_seconds)
|
||||
logger.info("accepted initial heartbeat run_id=%s", run.id)
|
||||
except OpsRunError as exc:
|
||||
rejected = exc.status_code == 409
|
||||
detail_key = "lease_loss" if rejected else "heartbeat_failure"
|
||||
return ProcessResult(
|
||||
claimed=True,
|
||||
run_id=run.id,
|
||||
ok=False,
|
||||
retry_full_interval=True,
|
||||
reason=(
|
||||
f"initial heartbeat {'rejected' if rejected else 'failed'}: {exc}"
|
||||
),
|
||||
detail={
|
||||
detail_key: {
|
||||
"stage": "pre-dispatch-heartbeat",
|
||||
"status_code": exc.status_code,
|
||||
"code": exc.code,
|
||||
}
|
||||
},
|
||||
)
|
||||
approach = GLAS_APPROACH if run.harness_profile_ref else select_approach(run)
|
||||
logger.info(
|
||||
"claimed run_id=%s approach=%s title=%r labels=%s",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue