Skip to content

refactor(harness): automate timeline truth loop - #159

Merged
nanzhi84 merged 1 commit into
mainfrom
codex/issue-157-pr2-automatic-truth-loop
Aug 2, 2026
Merged

nanzhi84 merged 1 commit into
mainfrom
codex/issue-157-pr2-automatic-truth-loop

Conversation

@nanzhi84

@nanzhi84 nanzhi84 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Implements PR2 of #157: the Harness now closes the timeline truth loop automatically after every committed atomic mutation.

  • move timeline.inspect and timeline.check out of every LLM dynamic surface
  • attach an exact-version automatic_timeline_check result to the mutation tool receipt before the next provider call
  • refresh CurrentTimelineView between provider calls and allow zero-tool read-only/final-export guidance calls
  • run a terminal fallback check when a non-standard path has not yet verified the latest mutation
  • stream Harness-owned check steps as started → progress → finished, including duration, and persist/show them after refresh
  • keep a committed version when validation fails and return the failure as new evidence rather than poisoning the next call
  • simplify scripted workflow tests by removing model-authored inspect/check turns

Contract changes

  • model-visible catalog: 21 → 19 tools
  • model-visible schema payload: 19,432 → 18,828 runes
  • new SSE event: tool_step_progress
  • no synthetic user continuation; final export remains user/UI-owned

Local acceptance

  • make contracts
  • make test (Go race)
  • make coverage — handwritten coverage 90.5%
  • make lint — 0 issues
  • Web: 27 files / 232 tests, typecheck, production build, bundle budget
  • make e2e — Playwright 9/9

Browser acceptance and exact timeline/API/SQLite/log evidence will be added after CI is green.

Part of #157.

nanzhi84 commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

PR2 browser acceptance — PASS

Environment:

  • branch/commit: codex/issue-157-pr2-automatic-truth-loop@05f970c
  • isolated workspace: /tmp/rushes-issue157-pr2-browser.YVxPnY
  • API/Web/worker metrics: 18010 / 15180 / 18012
  • draft: draft_04397629e5111f78d9cbeff9
  • deterministic asset: asset_f401e4e55b93d1bd1c341aaf

Accepted real-model path:

  1. The model invoked one real timeline.insert for visual_base [0,60).
  2. The same turn immediately showed an independent 检查时间线 · Harness · 0ms · 完成 row.
  3. The assistant then referenced the automatic v1 validation evidence.
  4. Page reload restored the same Harness badge/status/duration from persisted message history.
  5. Browser console had no errors (only Vite/React/Diffusion development info).

Cross-source evidence:

  • Timeline API: timeline_id=draft_04397629e5111f78d9cbeff9:v1, version=1, duration_frames=60, one visual_base clip, edit lease released.
  • SQLite timeline_versions: one v1 row, 60 frames, one visual clip, persisted validation report.
  • SQLite events: TimelineVersionCreated followed by TimelineValidated; report has structural_valid=true, content_contract_valid=true, valid=true.
  • Persisted Harness trace: step_ccd84af877fdf23b2f187aba, exact args {"timeline_id":"draft_04397629e5111f78d9cbeff9:v1"}, harness_owned=true, progress=1, status=succeeded, duration_ms=0.
  • API log model surfaces around the mutation contained timeline.insert/delete/update/split but never exposed timeline.inspect or timeline.check.
  • Startup catalog confirmed 19 tools / 18,828 schema runes.

Honest run note: the first broad prompt produced only plan.update and a premature textual claim while the UI/API timeline remained empty, so it was explicitly excluded from acceptance. A corrective prompt requiring the concrete atomic write produced the accepted path above. No synthetic continuation was used.

CI — PASS

Run 30756117842: all 5 jobs passed.

  • Go race: Ubuntu + macOS
  • contracts, vet, integration vet, golangci-lint, dependency scan, >=90% coverage
  • Web typecheck/test/build/bundle
  • Playwright against Go API and worker

@nanzhi84
nanzhi84 marked this pull request as ready for review August 2, 2026 16:22
@nanzhi84
nanzhi84 merged commit 28ec4b6 into main Aug 2, 2026
5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05f970ce3e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 207 to +210
if requestsReadOnlyTimelineCheck(userText) &&
!successfulTimelineMutationSinceLatestUser(messages) &&
!successfulToolCallSinceLatestUser(messages, "preview.generate") {
lane = rushestools.SurfaceRender
selected = filterSpecsByName(allowed, "timeline.check")
selected = nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Run an authoritative check for read-only validation requests

When a user asks to validate an existing timeline in a new turn, this clears the tool surface without executing timeline.check. The injected CurrentTimelineView contains the timeline document and a validated boolean, but not the content-contract failures, speech-quality analysis, or other reports computed by toolCheckTimeline; persisted Harness traces are also filtered from model history. Timelines changed manually or in an earlier turn therefore receive an unevidenced model answer instead of the requested validation. Execute a Harness-owned check for this path or inject a current exact-version check result before calling the provider.

Useful? React with 👍 / 👎.

},
"omitted_ranges": omittedRanges,
"inspect_hint": "当前视图省略了窗口外片段;需要完整轨道、片段 ID、效果或元数据时调用 timeline.inspect 读取当前 timeline_id。",
"mutation_hint": "当前视图省略了窗口外片段;只可编辑 clips 中明确出现的 ID。每次写入后 Harness 会刷新这一视图。",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve access to clips outside the compact window

For timelines exceeding 48 clips, buildCurrentTimelineContext exposes only a 24-clip window selected from recent edit history or the tail. This instruction now forbids editing omitted IDs, while the same commit makes timeline.inspect Harness-only and provides no way to request another window. Consequently, users cannot inspect or update/delete a clip outside the selected window, and refreshing after a write does not help because the omitted clip cannot be targeted to move the anchor. Retain a model-accessible full inspection or add a deterministic way to page/re-anchor the authoritative view.

Useful? React with 👍 / 👎.

@nanzhi84
nanzhi84 deleted the codex/issue-157-pr2-automatic-truth-loop branch August 9, 2026 17:24
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