Skip to content

CRW-567: give the crw recall CLI a link-time clock seam and replay the nine clock fixtures - #556

Merged
thisisjun786 merged 3 commits into
devfrom
codex/crw-567-recall-clock-seam
Oct 5, 2026
Merged

thisisjun786 merged 3 commits into
devfrom
codex/crw-567-recall-clock-seam

Conversation

@thisisjun786

@thisisjun786 thisisjun786 commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

What this changes

The nine clock-dependent fixtures of the CXC replay corpus (contract/fixtures/cxc) could not leave pending: the recall CLI read the wall clock, while the recording was made under a frozen clock at 2026-01-01T00:00:00Z that advanced 1 ms per Date read (contract/schema/cxc/normalisation.json). This PR adds a link-time clock seam to the recall CLI and links the recorded instant into the cxc domain's own replay binary, so the nine fixtures replay and are claimed in contract/notes/cxc/CRW-567.json.

Acceptance criteria: the nine fixture ids are no longer pending in contract/notes/cxc/CRW-391.json; TestDomain/cxc replays them green under the frozen clock; go test ./cmd/crw/ ./internal/recall/... and the contracttest package pass; the existing corpus, goldens and tests are unchanged; the activation surface (skills, wiring/hooks, plugin manifest) is untouched and crw-dev ci plugin reports the same digest.

Changes

  • cmd/crw/recall_clock.go (new): recallTestClock, a string var with no initializer so only -X main.recallTestClock= fills it in a test build, and recallNow(): the wall clock when it is empty, else time.UnixMilli(ms).UTC(); a malformed value panics naming the value it read.
  • cmd/crw/main.go: the recall row now calls recallNow() (one line; no other row and no other mode).
  • internal/contracttest/registry.go: cxcRecallBinary builds cmd/crw with -trimpath -ldflags=-X main.recallTestClock=1767225600000 (2026-01-01T00:00:00Z). contract_test.go uses it for the cxc domain and prebuilds it in TestMain; every other domain keeps testsupport.CRWPath.
  • cmd/crw/recall_clock_test.go (new): the empty seam is within one second of now; the seam 1767225600000 is 2026-01-01T00:00:00Z in UTC; a malformed value panics with it; and a release-shaped binary (no -X) running "crw recall memory status" against a seeded temporary memories_1.sqlite prints "last success: 2h ago" - a build that somehow froze the clock would clamp the future timestamp to "0m ago".
  • contract/notes/cxc/CRW-567.json (new) and CRW-391.json: four fixtures are claimed identical; five are intentionally-changed with the reason and a set for the step stdout, because the only remaining difference is a recency hits[].score (below).
  • contract/notes/cxc/README.md: the "Seams the replay does not provide" sentence now says the recall CLI replays under the link-time clock; the network call log, V8's stack text and the path-length note are unchanged.

Oracle sources

No CXC source is ported by this PR: the recall CLI and its injected clock (internal/recall/cli.go, Run(args, stdout, stderr, now time.Time)) already exist. What this PR ports is the recorder's clock contract from contract/schema/cxc/normalisation.json ("The oracle also runs under a frozen clock (2026-01-01T00:00:00.000Z, +1 ms per Date reading) with TZ=UTC") into a link-time seam, following the existing precedent internal/relay/adapter/cli.go (testClock).

Fixture classification

All nine are replayed by the cxc domain entry point "go test -count=1 -run 'TestDomain/cxc' ./internal/contracttest" (one subtest per fixture, driven through crw recall chat search / crw recall memory search / crw recall memory status CLI steps):

fixture claim this PR alone makes it pass
cli__chat__natural_language_query_relaxed intentionally-changed (2 scores) yes
cli__chat__search_plain_envelope identical yes
cli__chat__search_refresh_builds_index intentionally-changed (4 scores) yes
cli__chat__search_scan_json_and_plain identical yes
cli__memory__search_chat_fallback_and_no_chat intentionally-changed (2 scores) yes
cli__memory__search_cwd_boost_filter_and_origin_federation intentionally-changed (3 steps) yes
cli__memory__search_markdown_and_db intentionally-changed (2 steps) yes
cli__memory__search_plain_envelope identical yes
cli__memory__status_text_and_json identical yes

Fixtures this issue's units could drive but that stay pending under their own issues: cli-help__memory__allow-write_dashdash_help, the hook-path fixtures, the bare memory help fixture and the background (bg) help fixtures.

The score difference (why five claims are intentionally changed)

The recorder's clock advanced 1 ms per Date read, so a decayed score's last digits depend on how many clock reads preceded it (recorded 15.499999998280884, replayed with the fixed instant 15.5; recorded 4.375506063230572, replayed 4.3755060648070065). A dump of the full flattened observation and expectation for the five showed score-only differences: 1, 1, 4, 2 and 3+3+2 and 2+1 score fields, and zero differences at any other path. Nothing outside hits[].score differs.

Verification (this head)

All local Go commands run with TZ=UTC (the host's KST makes the recorded-oracle test in internal/recall fail at the untouched baseline too; see Defects):

  • go test -count=1 ./cmd/crw/ ./internal/recall/... - ok (cmd/crw 6.220s, internal/recall 14.154s)
  • go test -count=1 ./internal/contracttest - ok 46.171s
  • gofmt -l - empty; go vet ./... exit 0; GOOS=darwin go vet ./... exit 0; CGO_ENABLED=0 go build ./... exit 0
  • go run -tags dev ./cmd/crw-dev ci validate - exit 0 (34 skills validated, no Python outside skill assets)
  • go run -tags dev ./cmd/crw-dev ci plugin (without --record-version) - exit 0, the same package digest 0236789ec4aa1c59 over 216 files: the activation surface is untouched
  • git diff --check origin/dev...HEAD - clean

Red before, green after: with the nine claims in place and the frozen clock not linked, TestDomain/cxc fails exactly those nine fixtures (exit 1); with the link it passes. The first red state (claims in place, before the seam existed at all) failed the same nine.

Size

Counted lines (implementation + tests, added + deleted, generated data excluded): 149. Generated data: contract/notes/cxc/CRW-567.json, 50 lines of recorded claim data. Whole diff: 8 files, 184 insertions, 15 deletions.

Defects

No new defect line: the nine fixtures needed no CXC behaviour change and this unit found no defect in the ported behaviour. One pre-existing local environment sensitivity surfaced while running the verifiers and is already recorded in docs/port-cxc/known-defects.md (zone-less legacy stamps parse in local time, so the recorded-oracle test in internal/recall must run under TZ=UTC). It is not touched here.

Out of scope

The hook path, the allow-write help fixture, the bare memory help and the bg fixtures; the activation surface (skills, wiring/hooks, plugin manifest); installation, service activation and live relay behaviour.


Devin Review

…play

contract/notes/cxc/CRW-567.json claims cli__chat__natural_language_query_relaxed,
cli__chat__search_plain_envelope, cli__chat__search_refresh_builds_index,
cli__chat__search_scan_json_and_plain, cli__memory__search_chat_fallback_and_no_chat,
cli__memory__search_cwd_boost_filter_and_origin_federation,
cli__memory__search_markdown_and_db, cli__memory__search_plain_envelope and
cli__memory__search_status_text_and_json: four identical, five intentionally changed on the
step stdout because the recorder's clock advanced 1 ms per Date read and the recency-decayed
hits[].score differs in the 1e-9 digits. The nine ids leave CRW-391.json's pending list, which
keeps only the allow-write help. The replay fails without the recall clock seam.
cmd/crw/recall_clock.go adds recallTestClock (a string var with no initializer; -X fills it in a
test build only) and recallNow() (the wall clock when empty, else the frozen instant in UTC; a
malformed value panics with the value it read). The recall row of cmd/crw/main.go now calls
recallNow(). The cxc domain of internal/contracttest builds its own crw with the recorder's
2026-01-01T00:00:00Z linked in (cxcRecallBinary, prebuilt in TestMain) while every other domain
keeps testsupport.CRWPath, so the nine clock-dependent fixtures replay against the recording.
cmd/crw/recall_clock_test.go covers the empty seam, the frozen instant, the panic and a release
build reading the wall clock. contract/notes/cxc/README.md's Seams section says the recall CLI
now replays under the link-time clock; the network log and V8 stack text stay unprovided.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T01:16:01.873921Z 5fb1d8d PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@thisisjun786
thisisjun786 merged commit b32b55e into dev Oct 5, 2026
10 checks passed
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