Visual Truth protocol + runtime deadline propagation - #17
Merged
Merged
Conversation
There was a problem hiding this comment.
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:
vtstep 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 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() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
Notes