Skip to content

Visual Truth protocol + runtime deadline propagation - #17

Merged
Delqhi merged 2 commits into
mainfrom
codex/visual-truth-protocol
Mar 15, 2026
Merged

Delqhi merged 2 commits into
mainfrom
codex/visual-truth-protocol

Conversation

@Delqhi

@Delqhi Delqhi commented Mar 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Propagate per-task deadlines through the actor system and opencode adapter so agent timeouts cancel underlying execution.
  • Add an opt-in Visual Truth step runner (desktop video via ffmpeg/avfoundation) with optional NVIDIA NIM validation, plus a strict GA-closure wrapper.
  • Extend the soak harness with a safer default noop goal prefix and optional model routing overrides (model_preference/fallback_chain/model_id/context_budget).

Testing

  • ./scripts/release/check-gates.sh

Notes

  • Visual Truth recording requires macOS Screen Recording permission for the terminal app.
  • NIM validation is gated behind VISUAL_TRUTH_ALLOW_UPLOAD=1 and either VISUAL_TRUTH_UPLOAD_CMD or VISUAL_TRUTH_ALLOW_BASE64=1.

Copilot AI review requested due to automatic review settings March 15, 2026 02:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds end-to-end per-task deadline propagation (actor system → agent handler ctx → opencode execution) and introduces an opt-in “Visual Truth” step runner for recording/validating desktop video during GA-closure/rehearsal/soak workflows.

Changes:

  • Propagate task-scoped context deadlines through the actor system (AgentEnvelope.Ctx) and ensure the opencode adapter honors caller deadlines (only defaulting when none is provided).
  • Add Visual Truth tooling: vt step runner (ffmpeg/avfoundation recording), optional NIM-based video validation, and a strict GA-closure wrapper.
  • Extend soak harness defaults and request payload to support safer noop goals and optional model routing overrides.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
biometrics-cli/internal/contracts/types.go Adds per-task context field to AgentEnvelope for deadline propagation.
biometrics-cli/internal/runtime/actor/system.go Uses per-send timeout context; passes env context into handlers; removes time.After wait.
biometrics-cli/internal/executor/opencode/adapter.go Honors existing context deadlines; only applies a default timeout when none exists.
scripts/visual_truth/vt Adds bash-based Visual Truth step runner + recording preflight/handshake + optional validation hook.
scripts/visual_truth/vt_validate.py Adds NIM validation flow with strict gating and optional upload/base64 modes.
scripts/visual_truth/visual_truth.py Adds a Python context-manager helper for lightweight recording/validation usage.
scripts/release/run-ga-closure-visual-truth.sh Adds strict wrapper enforcing recording + strict validation + upload gating.
scripts/release/run-ga-closure-program.sh Wires vt doctor and wraps GA-closure steps via vt step when enabled.
scripts/run-soak.sh Changes default goal prefix to a safer noop and adds optional model routing payload fields.
erotic-models-SSOT.md Updates worklog/SSOT content describing local GA-closure reliability work.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 124 to +129
select {
case <-ctx.Done():
return contracts.AgentResult{}, ctx.Err()
case <-time.After(timeout):
return contracts.AgentResult{}, fmt.Errorf("actor %s timeout", actorName)
case <-taskCtx.Done():
if errors.Is(taskCtx.Err(), context.DeadlineExceeded) {
return contracts.AgentResult{}, fmt.Errorf("actor %s timeout", actorName)
}
return contracts.AgentResult{}, taskCtx.Err()
Comment on lines +207 to +210
video_url = ""
if allow_upload and upload_cmd:
video_url = run_upload_cmd(upload_cmd, str(video_path))
result["upload"] = {"method": "cmd", "cmd": upload_cmd}
Comment on lines +38 to +46
def nim_chat_completion(
base_url: str,
api_key: str,
model: str,
prompt: str,
video_url: str,
media_type: str,
video_fps: float | None,
) -> dict:
Comment on lines +25 to +36
class VideoRecorder:
def __init__(
self,
task: str,
session: str | None = None,
base_dir: str | None = None,
screen_spec: str | None = None,
fps: int | None = None,
min_seconds: int | None = None,
validate: bool | None = None,
strict_validate: bool | None = None,
):
Comment on lines 115 to +120
select {
case <-ctx.Done():
return contracts.AgentResult{}, ctx.Err()
case <-taskCtx.Done():
if errors.Is(taskCtx.Err(), context.DeadlineExceeded) {
return contracts.AgentResult{}, fmt.Errorf("actor %s timeout", actorName)
}
return contracts.AgentResult{}, taskCtx.Err()
Comment thread scripts/visual_truth/vt
Comment on lines +308 to +309
emit_event "$events_file" "step.start" "$step_name" "{\"video\":\"${video_file}\",\"cmd_log\":\"${cmd_log}\",\"ffmpeg_log\":\"${ffmpeg_log}\"}"

Comment on lines +118 to +121
str(source),
"-vf",
"scale=1280:-2,fps=4",
"-c:v",
Comment on lines +78 to +81
screen_spec = self.screen_spec
if screen_spec == "auto":
screen_spec = "Capture screen 0"

Comment on lines +141 to +148
execCtx := ctx
var cancel context.CancelFunc
if _, ok := ctx.Deadline(); !ok {
execCtx, cancel = context.WithTimeout(ctx, 10*time.Minute)
}
if cancel != nil {
defer cancel()
}
@Delqhi
Delqhi merged commit ab522f0 into main Mar 15, 2026
18 checks passed
@Delqhi
Delqhi deleted the codex/visual-truth-protocol branch March 15, 2026 16:35
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.

2 participants