Skip to content

Directed Evolution vision completion: WorkerRun routing (supersedes #385) + worker completion - #393

Draft
rita-aga wants to merge 10 commits into
mainfrom
codex/de-vision-completion-20260611
Draft

Directed Evolution vision completion: WorkerRun routing (supersedes #385) + worker completion#393
rita-aga wants to merge 10 commits into
mainfrom
codex/de-vision-completion-20260611

Conversation

@rita-aga

@rita-aga rita-aga commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Single PR for the temperpaw side of the vision-completion effort (one PR per repo by agreement). Supersedes #385 — its two commits are folded in here.

Table of contents

Folded + fixed

Track B worker completion

  • B7 ADR-0041 observe metadata sent mechanically: X-Temper-Observe-Metadata (producer.work_item_id, producer.worker_run_id, de.role + 13 de.* join keys, kernel limits enforced) on every DE action, entity create, observer runtime probe; Codex children get TEMPER_OBSERVE_METADATA + DD_TAGS env (proven via fake-codex fixture)
  • B8 first-class join-field resolution into the Datadog context and a ResolvedCorrelation: prompt block (one shared CorrelationJson parser)
  • B9 runtime credential preflight for simulated_user/reviewer/viability_evaluator/telemetry_evaluator (fails up-front with the env-var names, never values) + role→target assertions; telemetry fail-closed and thresholds stay genesis-router-owned (ADR-0018)
  • B10 temper dependency bump so the deployed runtime parses ADR-0041 headers — lands after feat: generic runtime action observability metadata (ADR-0041) temper#300 merges

Tests

cargo test -p paw-codex-worker: 127 passed, 0 failed (97 → 127; red→green per phase). cargo clippy --all-targets: clean.

Cross-repo dependency / merge order

temper#300 (ADR-0041 + ADR-0138) → arni-labs/genesis#25 (control plane: PawOrchestration WorkerRuns + WorkItemReceipts routing, organism runtime targets) → this PR (+ B10 bump). The deployed genesis runtime must expose the new namespaces before this merges.

🤖 Generated with Claude Code

rita-aga and others added 3 commits June 10, 2026 12:25
…recovery

A success-path receipt routing failure previously propagated between
SucceedWorkerRun and SucceedWorkItem, stranding the WorkItem in Running
(boot backlog only re-claims Queued). Routing is now best-effort on the
success path, mirroring the failure path — ResultJson still lands on the
WorkItem via SucceedWorkItem.

Boot recovery now also fails Running WorkItems claimed by this worker
(ClaimedBy-scoped OData filter), failing the attached WorkerRun and
routing a failure receipt so the control plane can re-dispatch. Recovery
runs only in the pre-loop boot block: in the reconnect loop it would
fail work items this process is still executing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
rita-aga and others added 7 commits June 11, 2026 16:31
… Codex children

The temper kernel (ADR-0041, nerdsane/temper#300) parses the
X-Temper-Observe-Metadata header into temper.observation.* span
attributes, but the worker sent nothing. Resolve the Directed Evolution
join fields from a WorkItem's CorrelationJson once
(DirectedEvolutionJoinFields) and reuse them to:

- attach the header (producer.work_item_id, producer.worker_run_id,
  de.role, de.* join fields; kernel limits: 32 keys, 96-byte keys,
  1024-byte values) to every worker->Temper action and entity create
  made on behalf of a DE work item
- attach the header to observer runtime OData probes
- inject TEMPER_OBSERVE_METADATA and DD_TAGS (de.* datadog tags,
  appended to any inherited DD_TAGS) into DE Codex child processes
  mechanically, not just via prompt text

The unused create_entity wrapper is removed; all DE creates now go
through create_entity_with_observe_metadata.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ompt header

directed_evolution_datadog_context previously carried only
service/env/work_item/role/target/control_tenant; the episode, direction,
generation, variant, stage, stage-result, trial, simulated-user-plan,
persona/run index, app_ref, runtime_ref, and runtime_tenant joins were
buried in raw CorrelationJson. Resolve them through the shared
DirectedEvolutionJoinFields parser (one parse, same source as the
ADR-0041 header) and surface them in:

- the Datadog context recorded on evidence correlation
- a ResolvedCorrelation block (de.* lines) in the DE prompt header

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Simulated-user and evaluator Codex runs previously discovered missing
runtime credentials as a confusing 401 inside the Codex child. Before
launching a DE Codex role whose correlation carries runtime_base_url,
resolve the auth env var names (correlation runtime_auth_env_vars plus
the TEMPERPAW_RUNTIME_API_KEY/TEMPER_API_KEY fallbacks, mirroring the
observer path) and verify at least one is set. If none is, fail the work
item up-front with 'runtime credential missing: none of [names] is set'
through the existing FailWorkerRun/receipt/FailWorkItem path. Env var
values are never logged.

Also assert target types at role dispatch (simulated_user -> Trial,
evaluator roles -> StageResult) and fail mismatches with a clear reason;
the mechanical evaluator's now-redundant StageResult bail is removed.
Worker-side telemetry fail-closed/threshold logic stays out of scope —
the genesis router owns it (ADR-0018).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Main gained a repo-health gate capping paw-codex-worker sources at 900
lines; directed_evolution.rs stood at 960 after the merge. Move-only
split into directed_evolution/staleness.rs (stage-evaluator targeting,
stale stage-result elimination, runtime credential guards; 198 lines)
and directed_evolution/receipts.rs (receipt bodies, receipt routing,
boot recovery of Running work items; 231 lines), leaving the parent at
542. Worker tests 127/127; the budget gate passes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant