diff --git a/cmd/agent-canary/main.go b/cmd/agent-canary/main.go index f6d6964..42cd850 100644 --- a/cmd/agent-canary/main.go +++ b/cmd/agent-canary/main.go @@ -34,10 +34,15 @@ func main() { enabled := flag.Bool("enable-canary", false, "explicitly enable the manual canary") implementation := flag.String("implementation", "fake-worker", "allowlisted deterministic implementation") postgresMode := flag.Bool("postgres", false, "use the Work PostgreSQL repository instead of in-memory storage") + runID := flag.String("run-id", "", "optional unique canary run suffix; generated when omitted") flag.Parse() - now := time.UnixMilli(1_700_000_000_000) - intent := work.AgentDispatchIntent{DispatchID: "manual-dispatch-1", IdempotencyKey: "manual-idempotency-1", DelegationID: "manual-delegation-1", RunID: "manual-run-1", ImplementationID: *implementation, ImplementationRevision: 1, SourceRevision: "manual-source-1", WorktreeID: "manual-worktree-1", VerificationPlanRef: "manual-verification-1", CreatedAtUnixMillis: now.UnixMilli()} + suffix := *runID + if suffix == "" { + suffix = fmt.Sprintf("%d", time.Now().UnixNano()) + } + now := time.Now().UTC() + intent := work.AgentDispatchIntent{DispatchID: "manual-dispatch-" + suffix, IdempotencyKey: "manual-idempotency-" + suffix, DelegationID: work.DelegationID("manual-delegation-" + suffix), RunID: work.AgentRunID("manual-run-" + suffix), ImplementationID: *implementation, ImplementationRevision: 1, SourceRevision: "manual-source-" + suffix, WorktreeID: "manual-worktree-" + suffix, VerificationPlanRef: "manual-verification-" + suffix, CreatedAtUnixMillis: now.UnixMilli()} var store ports.ExecutionStore = &memoryStore{} var closeStore func() if *postgresMode { diff --git a/dev/ACTIVE_TASK.json b/dev/ACTIVE_TASK.json index b7a5e03..ce754b7 100644 --- a/dev/ACTIVE_TASK.json +++ b/dev/ACTIVE_TASK.json @@ -1,5 +1,5 @@ { - "task_file": "dev/tasks/DEV-000194-agent-canary-protected-storage.json", - "task_id": "DEV-000194", + "task_file": "dev/tasks/DEV-000195-replayable-agent-canary-run-ids.json", + "task_id": "DEV-000195", "task_revision": 1 } diff --git a/dev/tasks/DEV-000195-replayable-agent-canary-run-ids.json b/dev/tasks/DEV-000195-replayable-agent-canary-run-ids.json new file mode 100644 index 0000000..fc01d2f --- /dev/null +++ b/dev/tasks/DEV-000195-replayable-agent-canary-run-ids.json @@ -0,0 +1,23 @@ +{ + "task_id": "DEV-000195", + "task_revision": 1, + "architecture_revision": "ADR-0018", + "base_repo_revision": "7252296a74ab7ff236fae865d63692e0fc6a777d", + "risk_tier": "E", + "intent": "Make the explicit Agent Execution dry-run canary replayable by generating unique dispatch, lease and callback identities per invocation while retaining durable evidence.", + "requirement_ids": ["Agent Execution runtime and recovery", "replayable durable canary", "lease/callback evidence"], + "allowed_change_scope": {"modules": ["agent-canary"], "paths": ["cmd/agent-canary/main.go", "dev/ACTIVE_TASK.json", "dev/tasks/DEV-000195-replayable-agent-canary-run-ids.json"]}, + "forbidden_change_scope": {"paths": ["architecture/**", "security/**", "database/**", "deploy/**", "modules/**", "contracts/**", ".gitea/**"]}, + "allowed_architecture_delta": {"new_cross_module_dependencies": 0, "new_canonical_owners": 0, "new_privileges": 0, "new_third_party_dependencies": 0, "new_database_owner_roles": 0}, + "contracts": {"consume": ["existing canary dry-run contract", "existing durable Work execution records"], "may_change": ["canary identity generation"]}, + "semantic_owner": "work-agent-execution", + "canonical_state": ["work.agent_dispatch_intents", "work.agent_leases", "work.agent_callback_heads"], + "state_transitions": ["each explicit canary invocation creates a fresh dispatch identity and durable lease/callback chain"], + "side_effects_and_privileges": ["manual dry-run only; no external execution or source mutation"], + "persistence_and_migrations": ["none"], + "failure_retry_restart": ["repeated invocation does not reuse prior canary identity; lease conflicts remain explicit errors"], + "assumptions": ["the protected-storage canary configuration from DEV-000194 is already in main"], + "acceptance_scenarios": ["default invocation generates a unique suffix", "operator-supplied run-id remains attributable", "two production canary invocations persist independent durable records"], + "required_tests": ["go test ./...", "go vet ./...", "go run ./cmd/devctl preflight -active dev/ACTIVE_TASK.json", "go run ./cmd/devctl check-diff -active dev/ACTIVE_TASK.json", "go run ./cmd/devctl check-architecture", "go run ./cmd/devctl independent", "git diff --check", "CI", "production canary and public health check"], + "terminal_gap_states": ["BLOCKED_BY_MISSING_CAPABILITY", "BLOCKED_BY_SPEC_GAP"] +}