Skip to content

Latest commit

 

History

History
59 lines (30 loc) · 11.7 KB

adk-runtime.md

File metadata and controls

59 lines (30 loc) · 11.7 KB

Official ADK runtime

Lake uses the official google.golang.org/adk/v2 v2.6.0 with Go 1.26.6. All interactive model/tool loops now enter the SDK Runner and LlmAgent, including Web/Desktop, stdio, saved workflows, scheduled SRE work, plan generation and specialist questions. The production Go fallback and runtime selector have been removed. Historical agentRuntime=go options are normalized to adk with migration provenance.

Implementation and acceptance are tracked in the migration plan, entrypoint coverage, and final validation. Earlier phase reports describe their historical snapshots, rather than the final architecture.

Execution

internal/ai/adk_driver.go hosts official LlmAgents and their Runner. adk_model.go adapts existing provider protocols, model selection, reasoning, usage and image support. Every role gets its own official LlmAgent and isolated business scope. adk_sre_workflow.go compiles the validated DAG into ADK FunctionNodes, dependency edges and JoinNodes. Role serialization and exclusive acts are business ordering constraints; the ADK graph scheduler owns execution, fan-in, cancellation and draining. Successful native Output/NodeInfo events provide durable result reuse across explicit retries. The old model/tool loop and scheduler files have been removed.

SDK ownership sits inside internal/ai; internal/agent/storage has no AI-domain dependency. This avoids an ai → adapter → ai import cycle and ensures direct CLI/stdio callers cannot accidentally bypass ADK. Scoped Engine objects retain business state, evidence and executor access; they contain no alternative model/tool loop. The former spike runtime and gate survive only in _test.go regression fixtures; the spike executable is removed.

ADK's default concurrent execution of tool calls within one response is overridden using the public task-runner hook. Those calls preserve model order so a human answer or terminal adoption affects the following call. Independent role nodes still run concurrently.

ADK 2.6 Workflow AgentNode rewrites its user content, which discards a tool-confirmation response. A public custom-agent wrapper preserves the role LlmAgent's confirmation envelope. A public session-event adapter also emits follow-up confirmations when terminal setup and command execution need separate approvals. Neither adapter imports SDK internals or replays resource execution.

Persistence and human decisions

Web stores private SDK sessions at <DataDir>/adk/sessions.sqlite; standalone engines use <Engine.Dir>/adk. GORM uses its public SQLite dialector with Lake's existing modernc.org/sqlite driver. This prevents the duplicate sqlite driver registration that the initial glebarez adapter caused when the Windows Web store initialized.

Official session state refers to versioned artifacts holding Lake's lossless provider-history projection, including provider-native reasoning blocks. Images are stored as artifacts, with references in SDK events. The local JSON history cache can be reconstructed from the migration index and the canonical SDK projection. Intentional clear, restore, rollback and compaction publish their new projection; they do not undo external effects.

Tools request official RequestConfirmation. Durable bindings include the original call, argument/preview digests, policy and target fingerprints, terminal version, scope, plan/attempt identity and expiry. The client sends only the original ID and decision. Approval consumption and the dispatched operation row share a SQLite transaction. A failed pre-dispatch audit prevents execution. Requests that contain credentials are rejected before SDK persistence and resource execution.

Human questions use official WorkflowAgent RequestInput / ResumeOrRequestInput checkpoints. Live same-batch execution waits for the answer. After a process crash, the host reconstructs the original question response; other unfinished calls receive an explicit not-executed result and are never silently replayed. SRE specialist questions and approvals retain their original role/attempt IDs and resume through the same Runner. If a process dies between the durable role wait and its SRE business-status projection, recovery reconciles the current plan and original role/attempt before resuming, rather than creating a replacement run. Explicit plan review and manual attestation also have durable RequestInput checkpoints; automatic plan continuation does not fabricate a human review. Frozen probe values, comparison operators, freshness, windows and sample counts are evaluated by the pure EvaluateSREChecks function, independently of model wording.

An operation is durably marked dispatched before executor entry. Transport loss or process failure leaves an unknown outcome. Only an exact original command handle can reconcile a live command; manual verification records require a real result and note. Ordinary conversations do not lock subsequent calls because an earlier operation is unknown or running. Different commands follow current target and permission checks. The same durable invocation ID cannot execute twice; an exact unfinished tool/arguments/target match also cannot be regenerated with a new call ID after a crash. Unknown outcomes remain in the audit and are never inferred from a later call. SRE task continuation retains its task-level verification rules. This is a dispatch/reconciliation discipline, not a claim of exactly-once effects across arbitrary external systems. Cancellation does not assert that a remote command stopped.

File adapters parse stdout separately from stderr, so SSH connection warnings cannot become file contents, search results or SHA256 fingerprints. Cached fingerprints must be valid SHA256 values; an invalid legacy fingerprint requires a fresh read. File precondition failures before the mutating executor starts are marked not executed. Existing unknown, handle-free file operations with either exact precondition error are reconciled to not executed with append-only evidence, excluding SRE task projections. This repair never retries an operation, infers success, or releases a genuine execution failure.

Migration, backup and rollback

History import preserves original business files and SDK events, validates call/result pairs, and uses a completion marker before activating an imported session. Incomplete records are explicitly marked unknown. Import never executes a historical call. A failed import remains inactive and can be retried.

Before import, SQLite VACUUM INTO produces a consistent private snapshot, including committed WAL content; quick-check, fsync and atomic replacement verify the snapshot. Source JSON is backed up separately. This replaces the plan's initially proposed driver-specific SQLite backup API with SQLite's supported consistent-snapshot operation.

Rollback must use a signed binary compatible with the current schema. Stop and drain all work, preserve the latest operation ledger, and reconcile dispatched/unknown operations first. An old pre-execution snapshot cannot overwrite a ledger containing later effects. An incompatible pre-migration binary must use its own isolated data copy and cannot resume writes against the new database. Dev and release homes and credentials remain separate.

Verification

Run python3 scripts/check_adk_runtime_boundary.py, full Go/race/vet checks, frontend tests/typecheck/build, and the signed Dev build. .github/workflows/adk-runtime.yml executes real Linux and Windows SDK, migration and process-recovery tests; macOS CI retains the complete race suite. Use the final validation artifact for actual exit codes, source snapshots, CI links and GUI evidence. A cross-compile is never reported as target-platform execution.

Durable ordinary work

Ordinary core conversations expose work_begin/read/update/wait/finish. Plan, Pilot, specialist and workflow-summary catalogs do not inherit these tools. The ledger, dependency state, cumulative model rounds, 24-hour deadline and original human answers live in private native_work_goals, native_work_observations and transactional native_work_outboxes; an SDK summary cannot rewrite them. Old completed conversations are not automatically adopted.

A successful asynchronous Shell dispatch binds the original operation/handle. The host's release-v1 adapter supports the fixed get_release_status(order_id) contract only after the user explicitly selects it in that MCP server's settings. Imported server JSON cannot grant this capability. An unconfigured release observer leaves the dispatched job blocked for reconciliation. Observation checks current permissions and the exact server configuration revision. Arbitrary MCP annotations or status fields never establish trust or lower call_mcp_tool's write risk.

work_wait is a long-running function tool that releases its Runner invocation; a separate public Workflow ResumeOrRequestInput checkpoint records machine input. The host observer uses 5/10/20/40/60-second backoff with stable jitter, a 15-second query deadline and fenced 45-second leases. Reads are currently serial. Unchanged running status does not invoke a model. Five transport failures block the item; elapsed time and model-call quota pause the goal. Actual results resume the original function-response ID through the official Runner with live model credentials and permissions, frozen resource binding and a dedicated projection. Foreground user messages remain available while waiting. Older goal results receive a named report without replacing the current RootTurnID, draft or status.

Pause/stop cancel observation and follow-up admission, not the remote job. Session deletion cancels its pending goals. A lost local-process handle or crash during model resumption blocks instead of replaying changes. Waiting-checkpoint restart recovery is tested. New approval/questions in a detached continuation require an explicit foreground human step; machine results never satisfy them. A user-owned database prerequisite can coexist with independent observations; its dependent deployment remains ineligible.

Automatic context maintenance uses the existing input estimator, triggers at 80% and aims for 60%. Summary child timeout/failure can fall back to bounded tool previews using the live parent context, preserving original user/call pairing and task references. A 60-second failure cooldown prevents summary retry loops. Parent cancellation and manual compaction failure preserve their original semantics; protected input that cannot fit pauses rather than dropping constraints. See implementation validation for tested paths and remaining fault-matrix coverage.

Super-agent 统一入口(2026-11-02)

已切换的 Super-agent 项目由 Pilot Router 接单,Worker/保存工作流/日程共用持久准入与租约;模型/工具循环及图调度全部由官方 ADK 承担。原生人工问题与审批的恢复绑定原 SDK/root;原句柄、未知操作和验收账本不因恢复重置。旧执行写入口不能逃逸到 unmanaged;未排空的旧项目保留原 owner,拒绝双写。 验证与边界见 运行架构。

Pilot Router 在每轮原生恢复后,将已验证来源的历史任务目录正文投影为明确省略标记及准确任务 ID/版本/hash;保留全部事件页、原用户消息、引用、入口目标和工具调用/结果配对。当前轮仍读取新目录,旧状态不能成为当前状态或权限。只修改待提交模型投影;旧 ADK 会话、原事件及任务/操作账本继续保留。普通用户文字、其他项目及不匹配来源不参与投影。失败轮次正文只显示首个整理失败,所有重试原因保留在执行诊断中。