源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
This commit is contained in:
commit
2ed3415fb7
8018 files changed
+1936476
No files matched your search
@@ -0,0 +1,64 @@
|
||||
package storesqlite
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
func updateGoalStateForOperationCompletionTx(
|
||||
ctx context.Context,
|
||||
tx *sql.Tx,
|
||||
input GoalControlOperationComplete,
|
||||
op GoalControlOperation,
|
||||
syncStatus string,
|
||||
evidenceJSON string,
|
||||
stateLastError string,
|
||||
observedAtUnixMS int64,
|
||||
localStop bool,
|
||||
supersededLocalStop bool,
|
||||
) (bool, error) {
|
||||
if supersededLocalStop {
|
||||
return false, nil
|
||||
}
|
||||
query := `
|
||||
UPDATE workspace_agent_session_goals
|
||||
SET observed_json = ?, sync_status = ?, pending_operation_id = NULL,
|
||||
execution_pending = ?, last_evidence_json = ?, last_error = ?, observed_at_unix_ms = ?, updated_at_unix_ms = ?
|
||||
WHERE workspace_id = ? AND agent_session_id = ? AND pending_operation_id = ?
|
||||
`
|
||||
args := []any{
|
||||
nullableJSONMap(input.Observed), syncStatus,
|
||||
boolInt(input.ExecutionPending && goalExecutionPendingAfterObservation(true, input.Observed, syncStatus)),
|
||||
evidenceJSON, stateLastError,
|
||||
observedAtUnixMS, input.OccurredAtUnixMS, input.WorkspaceID, op.AgentSessionID, input.OperationID,
|
||||
}
|
||||
if localStop {
|
||||
query = `
|
||||
UPDATE workspace_agent_session_goals
|
||||
SET observed_json = ?, sync_status = ?, pending_operation_id = NULL,
|
||||
execution_pending = 0, last_evidence_json = ?, last_error = ?, observed_at_unix_ms = ?, updated_at_unix_ms = ?
|
||||
WHERE workspace_id = ? AND agent_session_id = ? AND revision = ?
|
||||
AND (pending_operation_id = ? OR pending_operation_id IS NULL)
|
||||
`
|
||||
args = []any{
|
||||
nullableJSONMap(input.Observed), syncStatus, evidenceJSON, stateLastError,
|
||||
observedAtUnixMS, input.OccurredAtUnixMS, input.WorkspaceID, op.AgentSessionID,
|
||||
op.GoalRevision, input.OperationID,
|
||||
}
|
||||
}
|
||||
result, err := tx.ExecContext(ctx, query, args...)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !localStop {
|
||||
return true, nil
|
||||
}
|
||||
updated, err := rowsWereAffected(result, "complete local stop goal state CAS")
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !updated {
|
||||
return false, ErrGoalOperationConflict
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
Reference in new issue
Block a user