Skip to content

Add timeout checkpoint/resume for autonomous Harbor task runs before attempt-level retry #186

Closed as not planned

Description

@likun666661

Maka currently treats provider/runtime timeout as an attempt-level failure and, while budget remains, starts a fresh autonomous attempt. This preserves the existing verifier/scorer path, but it loses the live attempt trajectory: the next attempt gets a retry prompt and compact progress/evidence rather than the same model-visible runtime history and the same workspace state.

Source-backed current behavior:

  • runAutonomousTask() creates attempt-N, calls runTaskOnce(), records decision, and starts another attempt on retry/continue while budget remains.
  • runTaskOnce() creates a fresh throwaway workspace, session, turn, and AgentRun per attempt, then cleans the workspace in finally.
  • Runtime/provider timeout currently falls through to generic agent_failed classification.
  • Heavy-task progress/evidence is prompt-projected into retries, but full runtime replay and workspace diffs/content are not available across attempts.
  • Runtime replay exists within a session, while autonomous attempts create fresh sessions.

Desired behavior:

  • Persist a checkpoint after each accepted model/tool/checkpoint boundary.
  • On provider/runtime timeout, classify timeout explicitly and prefer checkpoint resume when a valid checkpoint exists.
  • Restore model-visible state from durable runtime/session events and workspace-visible state from a resumable snapshot/diff/artifact ref.
  • Keep retry as a fallback when checkpoint resume is missing, invalid, or fails, with explicit taxonomy.
  • Do not change official verifier/scorer authority or benchmark isolation.

Implementation areas:

  • packages/headless/src/task-contracts.ts: timeout/resume taxonomy and result records.
  • packages/headless/src/scorer.ts: preserve timeout failure class.
  • packages/headless/src/autonomous-agent-loop.ts: choose checkpoint resume before retry and render resume-specific prompt.
  • packages/headless/src/task-agent-controller.ts: checkpoint emission, workspace preservation, resume segment startup.
  • packages/headless/src/sandbox.ts: resumable workspace snapshot/diff lifecycle.
  • packages/headless/src/task-run-store.ts: checkpoint and resume events/projection.
  • packages/runtime/src/agent-run.ts, packages/runtime/src/model-history.ts, packages/runtime/src/ai-sdk-backend.ts: replay-complete runtime state and timeout/interruption closure.
  • packages/storage/src/agent-run-store.ts, packages/storage/src/session-store.ts: durable high-water refs for checkpoint replay.
  • packages/headless/src/heavy-task-progress.ts, packages/headless/src/heavy-task-evidence.ts: resume summary/artifact refs, not benchmark-specific prompts.
  • packages/headless/src/harbor-cell.ts and possibly packages/headless/harbor/maka_agent.py: expose checkpoint/resume/fallback metadata in Harbor output.

Acceptance criteria:

  • A synthetic provider timeout after a valid checkpoint starts a checkpoint resume segment before creating a new attempt.
  • A timeout without a valid checkpoint falls back to retry with explicit fallback taxonomy.
  • Replayed model input has no dangling tool-use state and includes explicit timeout/interruption closure where needed.
  • Restored workspace contains files created/modified before timeout.
  • Official verifier/scorer calls remain limited to the existing scoring path.
  • Resume rejects mismatched task/source/workspace identities.
  • A real Harbor smoke with induced inner runtime timeout reports checkpoint/resume metadata in cell output and either completes through existing scoring or records explicit retry fallback.

Non-goals:

  • Do not add benchmark-specific strategies or expected-answer/verifier leakage.
  • Do not use official verifier output as a resume oracle.
  • Do not depend on hidden in-memory executor state as the resume contract.

Activity

  1. Keesan12 commented on Jun 27, 2026

    @Keesan12

    This is a strong direction. The checkpoint/resume split is usually where retry systems either become trustworthy or quietly start faking continuity.

    A few edges I’d explicitly lock down:

    • checkpoint acceptance should happen only at boundaries where tool side effects and workspace state are both explainable; otherwise resume can replay the model state against a half-truth world
    • timeout taxonomy should distinguish provider timeout, runtime watchdog timeout, and host interruption because the safe resume contract is different for each one
    • resumed runs should carry a durable blocker/closure record for the interrupted segment, so the model does not inherit an open tool-use thread or ambiguous pending action
    • fallback-to-retry should preserve the reason resume was rejected; otherwise operators lose the signal that the resume path is the thing degrading

    The other big one is workspace identity drift. In practice, resume is much safer when the checkpoint stores a compact fingerprint of the visible workspace plus the last committed runtime event offset, so you can reject stale/mutated environments early instead of trying to reason about them mid-run.

    That "resume only when the world is provably the same enough" rule has been one of the more useful runtime lessons for us lately. MartinLoop keeps surfacing the same thing from a different angle: the control plane matters more than another polite retry.

  2. likun666661 commented on Jun 30, 2026

    @likun666661
    MemberAuthor

    Thanks for spelling this out. I agree with the direction here, especially the "resume only when the world is provably the same enough" rule.

    The implementation should treat these as core acceptance constraints, not nice-to-have diagnostics:

    • only accept checkpoints at explainable model/tool/workspace boundaries;
    • classify provider timeout, runtime watchdog timeout, and host/manual interruption separately;
    • record durable closure/blocker state for the interrupted segment before any resume projection;
    • preserve the concrete resume rejection reason when falling back to retry;
    • validate a compact visible-workspace fingerprint plus the last committed runtime-event offset before resuming.

    That framing keeps checkpoint resume from becoming a hidden retry with continuity-shaped logs. I will fold these points into the follow-up design/implementation criteria for this issue.

  3. likun666661 commented on Jun 30, 2026

    @likun666661
    MemberAuthor

    Follow-up after comparing Claude Code/Codex resume semantics and discussing the Maka-specific design:

    The useful lesson from Claude Code and Codex is not that we should copy their session resume directly. Both are strong references for conversation/session continuation: transcript, prior tool calls/results, plans/reasoning context, session metadata, and current workspace UX. They do not appear to promise the stronger autonomous benchmark contract this issue needs: safe continuation of an in-flight tool call, shell/process/container restore, full workspace restore, workspace fingerprint validation, runtime-event high-water validation, timeout closure records, or explicit fallback-to-retry reasons.

    For Maka, the product thesis should stay closer to the Google ADK-style information-flow model: preserve the original committed message/tool-result stream, then resume from a clean committed boundary. The missing piece is not a competitor-style chat session picker. It is a lightweight way to restore the coding agent's address space alongside that message stream.

    A reasonable P0 is therefore Git-backed coarse address-space checkpointing:

    resumable checkpoint = committed message/event high-water
                         + compaction summary ref
                         + Git-managed workspace commit/tree/ref
    

    At checkpoint time:

    • only checkpoint after an accepted model/tool/checkpoint boundary;
    • persist the message/event high-water offset;
    • persist any compaction summary ref used for future projection;
    • capture the agent-relevant workspace state into an attempt-local Git commit/tree/ref;
    • record repo root, worktree/workspace lease, base commit, checkpoint ref, and dirty/include policy.

    At resume time:

    • validate task/source identity and expected repo/worktree identity;
    • restore or checkout the checkpoint commit/tree/ref;
    • replay exact committed messages/tool calls/tool results through the high-water offset;
    • load the compaction summary;
    • add an explicit interruption closure saying the previous segment timed out and no uncommitted partial tool result is being replayed;
    • continue the next model turn.

    If the Git state cannot be restored or validated, resume should be rejected with a stable reason and the system should fall back to attempt-level retry only visibly:

    • no_checkpoint
    • unsupported_timeout_kind
    • workspace_ref_missing
    • workspace_dirty_or_drifted
    • runtime_offset_mismatch
    • checkpoint_restore_failed
    • dangling_tool_state

    This keeps P0 much lighter than a custom agent filesystem. We can use Git as the coarse-grained address-space ledger for coding/benchmark tasks, and let Maka's message/runtime event ledger carry the original information flow. A finer agent-fs journal can remain future work for non-Git workspaces or side-effect-heavy tools.

    Open P0 details to decide:

    • whether Harbor workspaces are always Git repos, or whether the runner should git init attempt workspaces;
    • whether checkpoints should be real commits/refs or lower-level tree objects;
    • the include/exclude policy for build outputs, caches, verifier artifacts, and untracked deliverables;
    • how dirty workspace detection is reported in Harbor output;
    • how checkpoint refs are retained/garbage-collected across attempts.

    Acceptance criteria to add or adjust:

    • A synthetic timeout after a clean checkpoint restores the Git-backed workspace ref and resumes before creating a fresh retry attempt.
    • A dirty/drifted workspace rejects resume with a stable reason and records visible fallback-to-retry metadata.
    • A runtime-event high-water mismatch rejects resume.
    • Partial provider output or dangling tool-call state is never replayed as committed history.
    • The resumed model input is built from committed messages/tool results plus a clear interruption closure, not from a lossy retry summary alone.
    • Official verifier/scorer authority stays unchanged; checkpoint validity is decided from runtime and Git workspace facts, not from scorer output.

    In short: P0 should be ADK-style committed information-flow resume + Git-backed coarse workspace restore, not full process resume and not a custom filesystem layer.

  4. zhiiw commented on Jul 14, 2026

    @zhiiw
    Contributor

    Hi @likun666661 ,

    I'd love to take on this issue!

  5. YayoiNanoka commented on Aug 17, 2026

    @YayoiNanoka
    Contributor

    Hi @likun666661, I’m reviewing older open issues and wanted to confirm the current disposition of this one.

    Since this issue was opened, generic safe-boundary resume support landed in #1223, while #2605 replaced the former Headless autonomous-attempt architecture with the current @maka/eval + Runtime Host model. As a result, the original runAutonomousTask() / Harbor attempt-level retry integration described here no longer maps directly to the current codebase.

    Would you consider the original issue resolved or superseded enough to close? If checkpoint resume is still needed for the current Eval architecture, it may be clearer to open a new issue with updated boundaries and acceptance criteria.

    点击展开中文

    你好 @likun666661,我正在整理较早的 open issue,想确认一下这个 issue 目前应该如何处理。

    这个 issue 创建后,#1223 已经实现了通用的安全边界恢复能力;与此同时,#2605 用当前的 @maka/eval + Runtime Host 模型取代了原来的 Headless autonomous-attempt 架构。因此,这里描述的 runAutonomousTask() / Harbor attempt-level retry 集成已经无法直接对应当前代码。

    你认为原 issue 是否已经解决,或者已经被新架构取代,可以关闭?如果当前 Eval 架构仍需要 checkpoint resume,或许新建一个符合当前边界和验收标准的 issue 会更清晰。

  6. added
    enhancement
    help wanted
    on Aug 20, 2026
  7. Astro-Han commented on Aug 23, 2026

    @Astro-Han
    Contributor

    Closing as superseded. Generic safe-boundary resume landed in #1223, while #2605 replaced the Headless autonomous-attempt architecture this issue targets with the current @maka/eval + Runtime Host boundary. The named runAutonomousTask() / attempt-workspace integration points no longer describe the product.

    If Eval still needs checkpoint restoration across Attempts, it should be specified against the current Experiment → Cell → Attempt → Result model rather than carried forward under these obsolete boundaries.

    Triage and wording were prepared with OpenAI Codex and reviewed by the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions