Skip to content

test(runtime): capture real Antigravity transcripts — the detector is inverted on live output - #19983

Merged
nwparker merged 4 commits into
mainfrom
nwparker/antigravity-transcript-capture-scaffold
Sep 11, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/antigravity-transcript-capture-scaffold

Conversation

@nwparker

@nwparker nwparker commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​765 $\color{#cf222e}{\Huge{\mathbf{−}}}$​74 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​691
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​900 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​900

What

Orca's Antigravity readiness detector has been written five times, each version tuned against a five-line screen typed from memory into a .spec.ts fixture. Three of the first four were found worse than the bug they replaced; the fifth (#19749) was reverted after it still returned ready=false for the personal/API-key user it existed to unwedge and flipped five silent startup dialogs to ready=true.

This PR builds the capture tooling, then uses it: six transcripts recorded from a live agy on macOS are committed here, and they show the shipped detector is inverted on real output — it refuses a genuinely ready screen and accepts a live /model picker.

No detector logic changed. The src/main/runtime/terminal-wait-detection.ts diff is empty. Attempt six is deliberately not written; the evidence and the assessment come first.

What the real transcripts prove

Full evidence, with the fixture and line for each claim, is in docs/reference/antigravity-readiness-evidence.md. The load-bearing findings:

1. The model row never starts a line. Antigravity paints a block-glyph logo down the left, and the identity, model and path rows are painted on the same physical lines as the logo. What Orca derives is:

▀▀▀▀▀▀       Gemini API key
▀▀▀▀▀▀▀▀      Gemini 3.7 Flash (Low)
▄▀▀    ▀▀▄     ~

The detector requires startsWith('gemini', trimmedStart) on a trimmed line. The trimmed line starts with ▀. Measured three ways:

Input isKnownReadyPromptPreview
Real ready screen false
The same screen with the logo glyphs stripped true
Real ready screen followed by the live /model picker true

A decorative glyph — suppressible with AGY_CLI_HIDE_LOGO — is what decides readiness today. This is not a Gemini-vs-non-Gemini problem, which is what all five attempts assumed. Even Gemini 3.7 Flash (Low) fails.

2. The dialog supplies the model line the ready screen cannot. /model prints Gemini 3.8 Flash, > Gemini 3.7 Flash (current), Gemini 3.1 Pro — one per line, at line start — and a bare > composer sits earlier in the tail. Both halves of the rule are satisfied while the picker owns the screen.

3. There is no email account row, and the row is switchable off. For an API-key user the identity row reads literally Gemini API key. Separately, AGY_CLI_HIDE_ACCOUNT_INFO=1 (a supported env var in the binary) removes the row from a fully ready screen — captured as its own fixture. The account-row requirement of attempts 4 and 5 can never pass for those users.

4. The banner is never reprinted. After dismissal the CLI prints ⎿ Exited /model command and redraws the composer only, so headerIndex never advances and cannot be the ordering anchor.

5. Dialogs are drawn two different ways. The trust dialog and sign-in splash take the alternate screen (ESC[?1049h); the picker and palette are drawn in place. 6. > is the dialog selection marker too (> Yes, I trust this folder), so the "accept any line beginning with >" relaxation proposed in #15840/#15852 would make the trust dialog read as ready. 7. agy sets no OSC title at all, so title-based readiness is unavailable for this agent.

Version note: agy --version reports 1.1.25 while its own banner prints Antigravity CLI 1.2.0. Any version-keyed rule must read the banner and tolerate the two disagreeing. The 1.1.17 mode-banner claims in #15840/#15852 (sourced from a screenshot) could not be reproduced: on 1.2.0 the idle composer is a bare >.

Confirm / refute, by attempt

Attempt Key claim Verdict
1 (HEAD) Model row begins with Gemini Refuted — never at line start
1 (HEAD) Only the composer prints > Refuted — every dialog marks its selected row with >
2 (loop 1) Dialog model-row wording is enumerable Refuted — the picker prints real model rows
3 (loop 2) Banner is reprinted on dismissal, so headerIndex advances Refuted
3 (loop 2) No alternate screen Refuted — ESC[?1049h
4 (loop 3) Every ready screen prints an account row Refuted twice — API-key identity, and AGY_CLI_HIDE_ACCOUNT_INFO
5 (#19749) The wedge is a model-name problem Refuted — it is a line-start problem
5 (#19749) Executing both builds was sufficient verification Refuted — the executed input was the hand-written fixture, so the check reproduced the fixture's own assumptions. That is the trap this PR exists to prevent

Can attempt six be written?

Yes, but not as a variation on any of the five — every one refined a predicate over \n-delimited lines, and that is the layer where the evidence says the information is not.

The only marker that survived contact with the transcripts is a line whose entire trimmed content is >: present in every ready capture, absent from every dialog capture (a dialog's > always carries its row label). The model-row requirement should be dropped (it matches dialogs, not ready screens), the account row must not be required, and headerIndex cannot anchor ordering. The blocked-signal path already refuses the trust dialog correctly today, by wording.

Still unknown before shipping: the sign-in, theme, privacy and update dialogs, and accept-edits/plan mode, where the composer may not be a bare >. The durable fix is to ask the terminal emulator what the bottom row of the screen is, rather than infer it from a byte stream written with cursor addressing.

The recorder

config/scripts/capture-agent-pty-transcript.mjs (also pnpm capture:agent-transcript) allocates a real PTY, mirrors the session so an operator can drive it, and appends every byte to src/main/runtime/__fixtures__/<name>.txt with escapes, CRs and wrapping intact, plus a .meta.json sidecar. Two details that matter operationally:

  • Ctrl-] is consumed by the recorder and never forwarded — the only way to end a capture while a dialog still owns the screen, since quitting the agent would first dismiss it.
  • Redaction uses same-length placeholders, because a transcript's value is its exact wrapping; a shorter replacement reflows the screen. The scanner recognises its own placeholders, so a scrubbed file verifies clean.

Added while capturing: --send "<ms>:<text>" (a dialog capture has to be driven, and an unattended run has no TTY — the keystrokes ride the same PTY a human's would), and a UUID rule in the scanner, because agy prints a resumable conversation id on exit. That id was found by the scanner and redacted before commit; all nine committed transcripts scan clean.

What could not be captured, and why

Nothing was faked or approximated. Each of these needed a change to the operator's account or config, which was out of bounds:

Missing Why
Business-account ready screen This machine has no OAuth session ("You are currently not signed in"; it authenticates from GEMINI_API_KEY). Reaching it means signing someone in
Any non-Gemini model row agy models offers 11 models, all Gemini; settings.json pins modelProvider: gemini
Sign-in dialog Unsetting the key does not reach it — the CLI refuses to start because modelProvider is pinned. Reaching it means editing their settings.json
Theme picker No /theme command exists in 1.2.0; onboarding only, which means deleting their config
Privacy notice Onboarding only, as above
Update banner Cannot be forced; none was pending

Each remains a named, skipping case so it stays visible.

The scaffold

src/main/runtime/antigravity-readiness-transcripts.test.ts replays raw bytes through OrcaRuntimeService.onPtyData → waitForTerminal('tui-idle') — the same path as the reported worker-start agent_readiness wedge — and takes the pane title from the transcript's own OSC bytes.

  • Before the captures: 19 passed | 16 skipped, skipping by name.
  • Now: 16 passed | 10 skipped, of which 4 are pinned KNOWN DEFECT cases asserting what the detector does (must be ready; KNOWN DEFECT, refused: the model row never starts a line, the logo shares it). CI stays honest rather than permanently red, and fixing the detector flips those to failing — which is exactly when the expectations need re-reading. The correct answer stays in expectReady and in each test's name.
  • A doc-coverage ratchet asserts every fixture name appears in the evidence doc; an ESC-byte guard asserts each capture is raw.

One scaffold bug the real captures exposed and this PR fixes: waitForTerminal rejects on timeout rather than resolving, so "never became ready" surfaced as an error instead of a verdict. The helper now maps rejection to ready: false, which is what the orchestrator does.

The ESC-byte guard, and why it exists

A guard against a mistake already made in this repo. The three cursor-agent-*.txt fixtures carry the comment "Captured verbatim from cursor-agent … driven through Orca" yet contain zero ESC bytes and zero carriage returns — renderer- and clipboard-laundered text. They evidence wording and glyphs, which is all the rules built on them key on, and nothing about the caret, repaints, or the alternate screen. Had a real capture existed, finding 5 above (alt-screen) would have been visible years ago. This PR corrects that comment only; the fixtures and the rules on them are untouched, and that suite still passes 27/27.

Testing

  • pnpm test on the three suites: 61 passed | 4 expected fail | 10 skipped before the defect-pinning refactor; 16 passed | 10 skipped for the Antigravity suite as committed, cursor-agent 27 passed, scanner 22 passed.
  • pnpm tc:node / tc:cli / tc:web clean, run sequentially. oxlint and oxfmt --check clean on every touched file. pnpm run check:code-quality:changed — 0 new findings.
  • Every committed transcript scans clean, enforced in CI by config/scripts/pty-transcript-secret-scan.test.mjs.

Operator-state safety

The ready-screen captures ran in a directory the CLI already trusted, so no trust answer was written to the operator's config. No login state was changed, no settings were edited, and no dialog was forced by mutating anything on disk. The one knob used, AGY_CLI_HIDE_ACCOUNT_INFO=1, is an environment variable scoped to a single child process.

CI fix: one entry added to the batch-shim ratchet allowlist

The first CI run failed one test — config/scripts/windows-cmd-shim-spawn-boundary.test.mjs > has no unlisted script naming a Windows batch shim — with config/scripts/pty-transcript-secret-scan.test.mjs as the lone offender.

That ratchet is a text match on any quoted .cmd/.bat literal in a new config/scripts/ or tests/tools/ script. The literal it found is in an assertion, not a spawn:

expect(resolveSpawn(['agy.cmd', '--model', 'sonnet'])).toEqual(...)

The test is pinning that the recorder routes a Windows shim through cmd.exe — asserting the very behaviour the ratchet exists to enforce. A text ratchet cannot distinguish an assertion from a spawn; its own docblock names that as the ceiling of the approach. (The producer, capture-agent-pty-transcript.mjs, escapes the scan only because it matches with a regex rather than a quoted literal.)

So the file is added to WINDOWS_SHIM_SPAWN_ALLOWLIST under the existing "Write or assert on shim files rather than spawning one." category, alongside the other .test.mjs entries.

Why the allowlist rather than rewriting the literal: obfuscating it (`agy.${'cmd'}`) would keep the list from growing but silently defeat the ratchet for every future reader. The docblock's "the list only shrinks" is the right default, and this is a deliberate exception with precedent — #18100 grew the same list for build-linux-local.mjs. The entry is also self-policing: the companion has no stale allowlist entry test fails if the literal is ever removed, so the line cannot rot into a silent exemption.

Nothing else in the shard failed (1 failed | 1054 passed), and the verify job was downstream of this one test.

…tigravity readiness

Antigravity readiness has been written five times against a five-line screen
typed from memory. There is no Antigravity transcript in this repository, so
every attempt was a guess tested against another guess. This adds the recorder,
the protocol and the fixture-driven suite so the sixth attempt can be written
against evidence, and changes no detector logic.

- config/scripts/capture-agent-pty-transcript.mjs records a live agent session
  through a real PTY, escapes and wrapping intact. Ctrl-] is consumed by the
  recorder and never forwarded, which is the only way to end a capture while a
  dialog still owns the screen.
- config/scripts/pty-transcript-secret-scan.mjs finds account identifiers and
  credentials, redacts them with same-length placeholders so wrapping survives,
  and recognises its own placeholders so a scrubbed file verifies clean.
- src/main/runtime/antigravity-readiness-transcripts.test.ts asserts a verdict
  per transcript and skips by name until the transcripts land, with a
  doc-coverage ratchet and a guard that a fixture contains escape bytes.

The escape-byte guard exists because the three cursor-agent fixtures carry a
comment claiming they were captured verbatim through Orca, yet contain zero ESC
bytes and zero carriage returns. That comment is corrected here to say what
those files are; the fixtures and the rules built on them are untouched.
@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ab32c591-d338-4b94-86de-d62dc6a6cef0

📥 Commits

Reviewing files that changed from the base of the PR and between 455ecf3 and 4df7868.

📒 Files selected for processing (9)
  • .gitattributes
  • config/scripts/capture-agent-pty-transcript.mjs
  • config/scripts/pty-transcript-secret-scan.mjs
  • docs/reference/antigravity-readiness-evidence.md
  • src/main/runtime/__fixtures__/antigravity-busy-mid-turn.meta.json
  • src/main/runtime/__fixtures__/antigravity-busy-mid-turn.txt
  • src/main/runtime/__fixtures__/antigravity-busy-turn-ended.meta.json
  • src/main/runtime/__fixtures__/antigravity-busy-turn-ended.txt
  • src/main/runtime/antigravity-readiness-transcripts.test.ts
💤 Files with no reviewable changes (1)
  • config/scripts/pty-transcript-secret-scan.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a PTY transcript recorder with timed input, secret scanning, redaction, and metadata output. It documents transcript capture and Antigravity readiness evidence requirements. It adds captured Antigravity fixtures and updates readiness tests to validate transcript-based verdicts, including known detector defects. A shared runtime harness now replays transcripts for readiness and terminal visibility tests. Repository instructions and an npm script support the workflow.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 4df78

The transcript workflow can expose credentials or lose captures, and its readiness evidence can still validate incomplete or misleading states. Resolve these issues before relying on the new captures for readiness changes.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.10% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 6 files. (6 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description provides detailed scope, rationale, evidence, testing, and safety information, but it omits several required template sections, including the mandatory linked issue, visual proof or N/… Add all missing template sections. Include a real issue reference after “Fixes #”, provide visual proof or write “N/A” with a reason, complete AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections, and record t…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: capturing real Antigravity transcripts and showing the live-output detector defect. It is specific and related to the changeset.
Full details: Docstring Coverage

Explanation

Docstring coverage is 38.10% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 6 files. (6 skipped: 6 unsupported.)

Full details: Description check

Explanation

The description provides detailed scope, rationale, evidence, testing, and safety information, but it omits several required template sections, including the mandatory linked issue, visual proof or N/A, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist.

Resolution

Add all missing template sections. Include a real issue reference after “Fixes #”, provide visual proof or write “N/A” with a reason, complete AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections, and record the required validation results and platform coverage.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6fffc818-ac2b-4a37-91f8-44e4ae98d805

📥 Commits

Reviewing files that changed from the base of the PR and between ecd7b19 and 4ac48ce.

📒 Files selected for processing (11)
  • .gitignore
  • AGENTS.md
  • config/scripts/capture-agent-pty-transcript.mjs
  • config/scripts/pty-transcript-secret-scan.mjs
  • config/scripts/pty-transcript-secret-scan.test.mjs
  • docs/reference/agent-pty-transcript-capture.md
  • docs/reference/antigravity-readiness-evidence.md
  • package.json
  • src/main/runtime/agent-transcript-pane-test-harness.ts
  • src/main/runtime/antigravity-readiness-transcripts.test.ts
  • src/main/runtime/terminal-interactive-wait-visibility.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

}

function writeMeta(outPath, details) {
const metaPath = outPath.replace(/\.txt$/, '.meta.json')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not overwrite transcripts with metadata.

--out accepts paths without a .txt suffix. After the capture completes, writeMeta leaves such paths unchanged and writeFileSync replaces the transcript with metadata. Use a distinct sidecar path for every supported output filename.

Proposed fix
-  const metaPath = outPath.replace(/\.txt$/, '.meta.json')
+  const metaPath = outPath.endsWith('.txt')
+    ? outPath.replace(/\.txt$/, '.meta.json')
+    : `${outPath}.meta.json`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const metaPath = outPath.replace(/\.txt$/, '.meta.json')
const metaPath = outPath.endsWith('.txt')
? outPath.replace(/\.txt$/, '.meta.json')
: `${outPath}.meta.json`

Comment on lines +203 to +206
command: details.command,
cols: details.cols,
rows: details.rows,
note: details.note,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify whether any repository-owned gate scans transcript metadata.
rg -n -C 4 \
  'meta\.json|details\.command|details\.note|scanTranscriptForSecrets|redactTranscript' \
  config/scripts package.json AGENTS.md

Repository: stablyai/orca

Length of output: 13304


🏁 Script executed:

sed -n '145,215p' config/scripts/capture-agent-pty-transcript.mjs
printf '\n--- repository guidance ---\n'
rg -n -C 4 'captured transcript|account identifier|scrub|credential|meta\.json' AGENTS.md config README.md package.json 2>/dev/null || true

Repository: stablyai/orca

Length of output: 50371


Sensitive Data Exposure

Reachability: Internal
Exploitability: Moderate
CWE: CWE-312 — Cleartext Storage of Sensitive Information

Scan metadata before writing the sidecar.

writeMeta stores command and note verbatim, while the scrub check scans only the transcript. Credential-bearing arguments or notes can therefore reach the committed .meta.json file. Scan the serialized metadata or sanitize these fields before writing the sidecar.

Source: Coding guidelines

describe('Antigravity readiness, decided by captured transcripts', () => {
for (const transcript of TRANSCRIPTS) {
const path = fixturePath(transcript.name)
const captured = existsSync(path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Require the metadata sidecar for every captured fixture.

If <name>.txt exists without <name>.meta.json, captured is true and the readiness tests can pass without the capture protocol’s platform, PTY size, CLI/account note, or exit code. Add a per-fixture assertion that the metadata sidecar exists whenever the transcript exists.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

Two issues to address before merging: the refusal cases in the new Antigravity suite will fail spuriously on the very silent dialogs they exist to catch, and the security-critical scrub module is committed as a binary file (a literal NUL byte), so its code is invisible in this and every future diff.

Reviewed changes — this PR adds capture/scrub/test scaffolding so a future "attempt six" of the Antigravity readiness detector can be pinned to real PTY transcripts. No detector logic changed.

  • Recorder — config/scripts/capture-agent-pty-transcript.mjs drives a real PTY via node-pty, mirrors the session to the operator, and appends raw bytes to a __fixtures__/<name>.txt fixture plus a .meta.json sidecar; Ctrl-] ends a capture without dismissing the dialog.
  • Secret scan/redaction — config/scripts/pty-transcript-secret-scan.mjs and its .test.mjs implement same-length redaction and shape-based scanning, and re-scan every committed __fixtures__/*.txt in CI.
  • Transcript suite — src/main/runtime/antigravity-readiness-transcripts.test.ts is table-driven over eight antigravity-*.txt names (skipping by name until they land), with a doc-coverage ratchet and two self-checks proving the harness reaches both verdicts.
  • Harness extraction — src/main/runtime/agent-transcript-pane-test-harness.ts is pulled out of the cursor-agent suite and shared with the new one.
  • Docs — agent-pty-transcript-capture.md (recorder + scrub protocol) and antigravity-readiness-evidence.md (captures A–D and per-attempt falsifiable questions), both allow-listed in .gitignore and linked from AGENTS.md.

⚠️ The secret-scan module is committed as a binary file

config/scripts/pty-transcript-secret-scan.mjs — the one file here that encodes the security boundary — contains literal 0x00 (NUL) and 0x1f control bytes, not the escaped \x00-\x1f text, inside the preview regex. Git therefore classifies the file as binary (git diff --numstat reports - -, and this PR's own diff renders it as "binary file or no changes"), so the scrub patterns and redaction logic are invisible to this and every future review.

Technical details
# Secret-scan module is binary; restore it to text

## Affected sites
- config/scripts/pty-transcript-secret-scan.mjs:117 — `return head.replace(/[<0x00>-<0x1f>]/g, '?')`
  carries a literal NUL and 0x1f byte in the character class.

## Evidence
- `xxd` of line 117: `6570 6c61 6365 282f 5b00 2d1f 5d2f 672c` — i.e. `replace(/[` + `0x00` + `-` + `0x1f` + `]/g,`.
- `git diff --numstat --merge-base main -- config/scripts/pty-transcript-secret-scan.mjs` → `- -` (binary).
- `.gitattributes` marks `/config/scripts/**/*.mjs text eol=lf`, but the `text` attribute does not
  override git's NUL-byte binary detection for diffs.

## Required outcome
- The regex is written as escaped ASCII text: `replace(/[\x00-\x1f]/g, '?')` (or `[\u0000-\u001f]`),
  so the file diffs as text and the scrub logic is reviewable.

## Suggested approach
- Replace the two literal bytes on that line with the `\x00` / `\x1f` escapes. Verify with
  `git diff --numstat` no longer showing `- -`, and confirm
  `LC_ALL=C grep -nP '[\x00-\x08\x0b\x0c\x0e-\x1f]' config/scripts/pty-transcript-secret-scan.mjs`
  returns nothing.

ℹ️ The scrub gate never scans the committed sidecar

Both the capture-time scan (runCapture) and the CI ratchet (pty-transcript-secret-scan.test.mjs) read only the .txt transcript. The <name>.meta.json sidecar written alongside it carries the free-form --note and the full command, and is committed unscanned — the docs cover it only as a manual "check the sidecar too" step. Given the PR's own framing ("the scrub gate is the only thing standing between a live transcript and a committed account identifier"), an operator who puts an email or a --api-key in --note/args would commit it with no automated guard.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

…y prove

`agy` 1.1.25 turned out to be installed, so the transcripts this scaffold was
built for now exist. Six are recorded from live sessions and committed; the
rest are named as skipped, because reaching them would mean signing the
operator out or deleting their config.

The captures invert the story. On real output the shipped detector refuses a
genuinely ready screen and accepts a live `/model` picker:

- Antigravity paints a block-glyph logo down the left, so the model row never
  starts a line. `startsWith('gemini', trimmedStart)` cannot match a real ready
  screen, on any account or model. Stripping the logo flips the same screen to
  ready, which means a decorative glyph decides readiness today.
- The `/model` picker prints `Gemini 3.x Flash` one per line, at line start, and
  a bare `>` composer sits earlier in the tail. Both halves of the rule are
  satisfied while a dialog owns the screen.
- For an API-key user the identity row reads `Gemini API key` — no `@`, no
  domain — and `AGY_CLI_HIDE_ACCOUNT_INFO=1` removes the row entirely. The
  account-row requirement of attempts 4 and 5 can never pass for those users.
- The banner is printed once and never reprinted after a dialog is dismissed, so
  `headerIndex` cannot be the ordering anchor.

Four suite cases are pinned as KNOWN DEFECT: they assert what the detector does
so CI stays honest instead of permanently red, and flip to failing the moment
someone fixes it. No detector logic changed.

The recorder gains `--send "<ms>:<text>"` because a dialog capture has to be
driven and an unattended run has no TTY, and the scrub scanner gains a UUID rule
because agy prints a resumable conversation id on exit.
@nwparker nwparker changed the title test(runtime): capture real agent PTY transcripts before rewriting Antigravity readiness test(runtime): capture real Antigravity transcripts — the detector is inverted on live output Sep 11, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues. The prior refusal-timeout concern is addressed cleanly, the six committed transcripts assert correctly against the current detector, and every touched suite passes (26/16 antigravity, 22/22 secret-scan, 27/27 cursor). One minor doc inconsistency noted inline.

Reviewed changes — since the prior review this PR added the real Antigravity captures and pivoted the suite from skip-by-name to asserting against them.

  • Six live transcripts committed — antigravity-*.txt fixtures (ready ×2, trust dialog, model picker, command palette, dismissed picker) with .meta.json sidecars, recorded from agy TUI 1.2.0 on macOS.
  • Scripted capture input — a new --send "<ms>:<text>" flag drives dialogs unattended via parseSend, with \r \n \t \e escapes delivered through the same PTY a human's keystrokes would use.
  • KNOWN DEFECT inversion — TranscriptCase.knownDefect pins the four cases where the shipped detector contradicts the transcript, so CI asserts current behavior and flips red when a future fix lands.
  • Verdict refactor — readinessVerdict now takes a timeoutMs and returns { ready, blockedReason, outcome }, catching the wait timeout so a silent dialog resolves to ready: false instead of rejecting.
  • UUID scanner — the secret scan now flags the resumable agy --conversation= id, and the evidence doc is rewritten from a capture checklist to the measured results.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread AGENTS.md

## Agent Terminal Screens

A rule that reads what an agent CLI paints on a terminal — readiness, blocked prompts, idle — must be written against a captured transcript, not a remembered screen. Record one with [`docs/reference/agent-pty-transcript-capture.md`](./docs/reference/agent-pty-transcript-capture.md), which keeps escapes and wrapping intact and scrubs account identifiers before they reach git. Antigravity readiness has no transcript yet and five failed attempts without one; before touching it, read [`docs/reference/antigravity-readiness-evidence.md`](./docs/reference/antigravity-readiness-evidence.md).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This sentence is stale now that this PR commits six transcripts. It still asserts "Antigravity readiness has no transcript yet", but src/main/runtime/__fixtures__/antigravity-*.txt now exists — a future agent reading this will think it needs to capture from scratch. Update it to point at the committed fixtures.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 01866103-3740-4e50-b975-bc853647542e

📥 Commits

Reviewing files that changed from the base of the PR and between 4ac48ce and 455ecf3.

📒 Files selected for processing (18)
  • config/scripts/capture-agent-pty-transcript.mjs
  • config/scripts/pty-transcript-secret-scan.mjs
  • config/scripts/pty-transcript-secret-scan.test.mjs
  • docs/reference/agent-pty-transcript-capture.md
  • docs/reference/antigravity-readiness-evidence.md
  • src/main/runtime/__fixtures__/antigravity-dialog-command-palette.meta.json
  • src/main/runtime/__fixtures__/antigravity-dialog-command-palette.txt
  • src/main/runtime/__fixtures__/antigravity-dialog-dismissed.meta.json
  • src/main/runtime/__fixtures__/antigravity-dialog-dismissed.txt
  • src/main/runtime/__fixtures__/antigravity-dialog-model-picker.meta.json
  • src/main/runtime/__fixtures__/antigravity-dialog-model-picker.txt
  • src/main/runtime/__fixtures__/antigravity-dialog-trust-workspace.meta.json
  • src/main/runtime/__fixtures__/antigravity-dialog-trust-workspace.txt
  • src/main/runtime/__fixtures__/antigravity-ready-account-info-hidden.meta.json
  • src/main/runtime/__fixtures__/antigravity-ready-account-info-hidden.txt
  • src/main/runtime/__fixtures__/antigravity-ready-api-key-gemini-model.meta.json
  • src/main/runtime/__fixtures__/antigravity-ready-api-key-gemini-model.txt
  • src/main/runtime/antigravity-readiness-transcripts.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment on lines +192 to +208
}
term.write(chunk.toString('binary'))
})
// Why scripted input: a dialog capture has to be driven, and CI (or an agent) has no TTY to
// type into. The keystrokes ride the same PTY a human's would, so the capture is unchanged.
const sendTimers = options.sends.map((send) => setTimeout(() => term.write(send.text), send.atMs))
const durationTimer = options.duration === null ? null : setTimeout(stop, options.duration * 1000)

const exitCode = await new Promise((resolveExit) => {
term.onExit(({ exitCode: code }) => resolveExit(code ?? 0))
})
for (const timer of sendTimers) {
clearTimeout(timer)
}
if (durationTimer !== null) {
clearTimeout(durationTimer)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Require --out to end in .txt. parseArgs() accepts any --out value, and runCapture() writes the transcript before writeMeta() derives the sidecar with outPath.replace(/\.txt$/, '.meta.json'). With --out /tmp/capture, the path is unchanged, so writeFileSync() overwrites the transcript with metadata JSON. Reject non-.txt paths or derive a distinct sidecar path.


### 5. Dialogs are drawn two different ways, and the banner is never reprinted

The trust dialog and the sign-in splash take the **alternate screen** (`ESC[?1049h` … `ESC[?1049l`).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🤖 get_repo_knowledge executed:

get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings

Length of output: 41659


🏁 Script executed:

#!/bin/bash
set -e
file="docs/reference/antigravity-readiness-evidence.md"
printf '%s\n' '--- targeted file excerpt ---'
sed -n '35,55p;105,120p' "$file"
printf '%s\n' '--- file references to sign-in, splash, transcript, and capture ---'
rg -n -C 2 -i 'sign[- ]in|splash|transcript|captur|observ|unobserv|alternate screen|1049' "$file"

Repository: stablyai/orca

Length of output: 11841


Separate observed and unobserved sign-in behavior.

The fixture table marks antigravity-dialog-sign-in.txt as not captured, while the findings cite the sign-in splash as transcript evidence. Remove this claim or cite an independent source and label it as unobserved.

Comment on lines +193 to +195
present in every ready capture and absent from every dialog capture, because a dialog's `>` always
carries its selected row's label. This is a much narrower rule than any attempt used, and it is
the only one that survived contact with the transcripts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not treat a bare > as dialog-exclusive in the retained tail.

Lines 91-94 show that the live model picker retains a bare > from before the picker opened. Lines 76 and 93 show that this causes the false-ready result. Rewrite this rule to require the current bottom-row content or equivalent screen-state evidence; a bare retained-tail match is not sufficient.

Comment on lines +134 to +138
capture: 'C',
what: 'update banner owning the screen',
expectReady: false
}
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Require and validate the matching metadata sidecar for every captured transcript. The suite checks only whether <name>.txt exists and never reads <name>.meta.json, so deleting the sidecar can leave the readiness and raw-escape assertions active. This bypasses the documented provenance for the capture conditions, PTY size, command, platform, and CLI/account details.

Answers the busy-frame question a P1 review raised against attempt six, with
two new captures from a live turn.

At the frame level the review is right: a busy frame parks the caret with the
same bytes as an idle one, `CR ESC[2A ESC[2C`, and the only differing row —
`esc to cancel` versus `? for shortcuts` — is erased by that park.

At the retained-tail level it does not reproduce. Each spinner tick is its own
repaint with its own `CR ESC[2A`, two rows higher than the frame's, which
splices the composer away: a live turn's tail ends on `⣟  Generating...`, with
no bare caret to match. A constructed input that keeps the park and edits only
the status text is not faithful, because a live turn has a spinner row
repainting below the composer.

The residual is the gap between a frame park and the next tick, where the tail
does end on the bare caret. Quiescence-gated paths are safe there because ticks
keep arriving; text-only paths are not, and for those the capture supports one
clause: a braille glyph on the last visible line means working. That predicate
already exists here for cursor-agent and should be reused, scoped to the last
line — a first-run transcript prints `⠾ Signing in...` during startup.

Also in this commit, from the same review:

- pty-transcript-secret-scan.mjs held raw 0x00-0x1f bytes in a character class,
  so the one file gating real PTY data into history was binary to git and
  unreviewable in a diff. It now tests codepoints, which the formatter cannot
  fold back into control bytes.
- Pin `src/main/runtime/__fixtures__/*.txt` as -text. A Windows checkout would
  otherwise normalise line endings and rewrite the CR bytes that make these
  files evidence.

The recorder now stops appending at the stop moment rather than through
shutdown: an agent repaints an idle frame on its way out, which was overwriting
the mid-turn state the capture existed to record.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues. The secret-scan binary-file fix is clean, the two mid-turn captures pin the right verdicts, and the .gitattributes rule needs one scoping tweak (inline) so it stops swallowing the diffable cursor-agent-*.txt fixtures.

Reviewed changes — since the prior review this PR added two live mid-turn captures and made the scrub module reviewable again.

  • Made the secret-scan module reviewable — preview now tests codePointAt(0) < 0x20 instead of a literal control-byte character class, restoring the file to text so the scrub patterns diff normally (resolving the prior must-address finding).
  • Captured two busy-state transcripts — antigravity-busy-mid-turn (spinner live) and antigravity-busy-turn-ended (composer returned after a backend error), each with a table case: one plain refusal, one KNOWN DEFECT pin.
  • Stopped recording before the kill — a recording flag keeps the shutdown repaint out of the transcript, so a mid-turn capture ends on the captured state rather than an idle frame.
  • Pinned fixture byte-ness — .gitattributes marks runtime fixture transcripts -text so real CR/CRLF bytes survive a Windows checkout.
  • Documented busy-vs-idle — evidence doc section 8 records that busy and idle frames park the caret identically and the braille-spinner clause is the only surviving discriminator.

ℹ️ Nitpicks

  • docs/reference/antigravity-readiness-evidence.md:127 — the new section is ## 8. (h2), but it follows ### 6. (h3) and there is no section 7 (that finding moved to the cross-cutting table). Make it ### 7. (or renumber) and keep the ### level so it stays nested under "What the transcripts show".

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread .gitattributes
# Captured agent PTY transcripts. -text, not `text eol=lf` like the wrapper snapshots above:
# these carry real CR and CRLF bytes as the terminal emitted them, and line-ending
# normalisation on a Windows checkout would rewrite the evidence the fixture exists to be.
/src/main/runtime/__fixtures__/*.txt -text

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The -text rule also matches cursor-agent-*.txt, which are laundered text fixtures (the visibility suite's header notes they carry "no escape bytes and no carriage returns") and are edited when the approval-prompt wording rules change. Marking them binary hides future edits from review — the same "binary file or no changes" problem this PR just fixed in the secret-scan module. Scope the rule to the captured transcripts (/src/main/runtime/__fixtures__/antigravity-*.txt -text) and pin the cursor-agent fixtures with text eol=lf instead.

…atchet

pty-transcript-secret-scan.test.mjs asserts that the capture recorder routes
an 'agy.cmd' shim through cmd.exe, so the shim literal it names is the
assertion, not a spawn. Fits the existing assert-on-shim-files category.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this commit. The batch-shim ratchet allowlist entry is correct and self-policing.

Reviewed changes — since the prior review this PR added one commit that unblocks CI: the Windows batch-shim ratchet was failing on the new secret-scan test.

  • Allowlisted the transcript scan test in the batch-shim ratchet — config/scripts/pty-transcript-secret-scan.test.mjs carries a quoted 'agy.cmd' literal in an assertion pinning that resolveSpawn routes a Windows shim through cmd.exe, which the text ratchet flags as a spawn. Added under the existing "Write or assert on shim files rather than spawning one." category, where the companion "has no stale allowlist entry" test keeps the entry honest — it fails if the literal is ever removed.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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