Skip to content

Fix #33 promotion findings in #13/#31: keep saved revocations, isolate fixtures, log receipts (#31) - #39

Merged
lseongjoo merged 17 commits into
integration/issue-31from
claude/project-thread-snd6be
Nov 28, 2026
Merged

lseongjoo merged 17 commits into
integration/issue-31from
claude/project-thread-snd6be

Conversation

@lseongjoo

Copy link
Copy Markdown
Contributor

Fixes the findings that blocked the #33 promotion check on the combined candidate. The evidence is in #33 comment 7241707091.

Changes

  • P-01: a saved revocation is never undone by a restored older approvals file.
    • adoptDisk re-applies every revocation this run knows. A revocation missing from the file becomes a pending denial: it is retried until a re-read file holds it.
    • Only the pairing socket holder writes. A standby instance adopts read-only.
    • The revocation list has no count cap, because any cut-off would let a dropped key come back.
    • If a merge passes the 256 KiB read limit, only what is written is fitted. The file keeps, in this order:
      • revocations that remove a row of the last intact file;
      • that file's own revocations;
      • then the newest others.
        Everything stays in effect in memory and pending.
  • P-03: fixture isolation.
    • A TTS_FIXTURE_HOME compile flag is used by fixture builds only. With it, home, sockets and helper keys go under the fixture root, the identifier is a fixture one, and system integration is off.
    • The product reads no environment variable for paths. Its home comes from getpwuid, as the helper's does.
    • fixture_support.sign() refuses product bundle IDs.
  • P-04: every fixture is brought up to date with the current source. The pre-에이전트 앱별 독립 연결과 승인 관리 #13 scenarios are ported to the current approval model, and run_speech_socket_log is added.
  • P-05: new log lines carry the result, the app (or pid) and lengths only, never text:
    • [AGENT-DRAFT] receipt host=… pid=… result=… display_len=… speech_len=…
    • [AGENT-SPEECH] request pid=… result=… len=…

Evidence (user's Mac, rounds 18–25)

  • Final head ee78d9c: ./build.sh build exit 0. ./build.sh test exit 0 (23 Python tests OK, trust store tests passed, all tests passed).

  • Fixtures, all exit 0 and all run under sandbox-exec (writes to the real paths denied):

    Fixture Result
    agent_app_connections 20/20
    persistent_pairing 15/15 groups
    draft_titles 9/9
    local_draft_candidate pass
    local_instruction_candidate pass
    tts_instruction_approval_ui pass
    tts_preview_isolation pass
    tts_pronunciation_case pass
    speech_socket_log pass
    check_agent_mcp_configuration pass
  • Isolation: a stat snapshot of ~/Library/Application Support/Codebasic TTS* and /private/tmp/codebasic-tts*-mcp-<uid> was taken before and after each fixture, and every diff is 0. There were 0 sandbox denials on those paths.

  • Logs: the 16 [AGENT-DRAFT] lines contain no key, client id or text.

  • Independent reviews at round 25 (ee78d9c):

    • Codex (gpt-6.2-sol, high, read-only, session 01a22355-ef81-7122-96e3-c95ff3b17914): agree.
    • Antigravity (agy 1.5.19, requested gemini-4-neon-high, conversation 906ec848-64a4-413e-ac9c-bce92aae0b61): agree.
    • Rounds 18–24 each found blockers, and all of them were fixed in the commits above.

Follow-ups (moved to #35)

  • P-04 fixtures:
    • The 1.5 s observation window can miss a late request.
    • The speech fixture skips log matching under the sandbox and does not match the sender's pid.
  • Near the read limit:
    • The two-restore test does not directly cover a key that is dropped from disk and then rewritten.
    • The identical-content skip has no direct test.
    • Turning receipt on fails closed for an "off" file of exactly 256 KiB.
    • The read limit itself remains.
  • Held for the user, not in this PR: Codex P-02 (memory fallback vs busy) and Claude P-07 (product behavior changes).

Generated by Claude Code

claude and others added 17 commits November 28, 2026 15:48
…t and speech results (#31)

- adoptDisk re-applies every revocation this run knows to whatever it reads,
  so an older copy restored after a saved revocation cannot bring the app back
  (Codex P-01 from the #33 promotion check). Test added.
- [AGENT-DRAFT] and [AGENT-SPEECH] log lines with the result, the app (or peer
  pid) and lengths only (Codex P-05 / Claude P-04).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LJG7KnMPqFcfTZ8A1C2qh
6a573bb's new restored-file test declared `kept` twice in one scope, so
./build.sh test did not compile. Test-only rename.

Agent: Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…31)

NSHomeDirectory() ignores HOME, so fixtures that set HOME still reached the
user's Application Support (drafts.sqlite, agent-approvals.json), and helpers
built without TTS_AGENT_FIXTURE_KEYS wrote the user's agent-client-keys.

- -D TTS_FIXTURE_HOME: only fixture builds take their home from TTS_TEST_HOME,
  keep sockets relative to the fixture root, use the fixture identity
  com.codebasic.tts.fixture.receiver, keep helper keys under that home and
  register no system integration. The product reads no path from the
  environment.
- Tests/Fixtures/fixture_support.py: shared flags, environment and one sign()
  that refuses product identifiers; ad hoc unless a certificate leaf is pinned.
- Fixtures build with the flag instead of patching TTSRuntime.swift, and add
  Logging.swift where the server needs it.

Agent: Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Approval UI and preview isolation look for "외부 대본 전체 받기" (the old
  "외부 대본 받기 허용 (이번 실행)" item is gone); the preview checks the
  fixture-relative socket name under TTS_FIXTURE_HOME.
- Instruction candidate pins the probe's own certificate (leaf or, for a
  self-signed one, root) and gives the adapter copy the fixture identity.
- Draft titles, local draft candidate and persistent pairing approve a new
  agent app once after receipt on (#13), through a registered, certificate-
  signed launcher where the approval must survive a restart; a different key
  is a different app (approval_required, not other_agent); receipt off keeps
  the approval and reports "disabled". The probe reports each request's
  helper PID so the right one is approved.

run_draft_titles passes in full. run_local_draft_candidate and
run_persistent_pairing pass their opening scenario groups and still stop at
blocks written for the pre-#13 session model (ID-less disconnect/forget,
allow-new, keychain slot keys); see #31.

Agent: Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ture (#31)

- run_local_draft_candidate: the takeover scenario now uses per-app off
  (`disconnect <id>`: every session of the app reports "disabled", approval
  kept), `resume <id>`, and a second session of the same registered app
  taking over with no new approval when the first ends. The enable-expiry
  check times the approval request instead of racing the #31 ready signal.
- run_persistent_pairing: key reset runs `--forget-key` from the registered
  app it belongs to and needs one new approval; `forget <id>` revokes the key
  (status "revoked", also after a client restart) until a reset and a new
  approval; `disconnect <id>` stays off across client and app restarts and
  `resume <id>` needs no new pairing. No step was dropped.
- run_speech_socket_log (new): one stub-handled and one invalid request
  through the real LocalSpeechSocket, no audio; checks the [AGENT-SPEECH]
  lines carry result, pid and length only (the check is skipped when run
  inside a sandbox, where `log` refuses to run).

All runnable fixtures exit 0.

Agent: Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…der, no env home (#31)

Answers the round-18 Codex review of the P-01 fix:
- A known revocation missing from the file read becomes a pending denial, so
  a failed write-back is retried and only a re-read file settles it.
- Only the pairing socket holder writes back; another instance adopts read-only
  and writes on takeover.
- Merging never trims the revocation list (no eviction cascade at the cap).
- The product's home comes from the user database (getpwuid), like the helper's
  key directory; NSHomeDirectory() follows CFFIXED_USER_HOME.
- [AGENT-DRAFT] also logs the helper pid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LJG7KnMPqFcfTZ8A1C2qh
31a0a62 stopped trimming the revoked list when merging (no eviction
cascade at the cap), but the older full-list check still expected the
disk's oldest entry to be evicted. It now expects every entry kept plus the
replayed revocation. Test-only change.

Agent: Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A second helper of the same app may ask again on a later ready signal, so a
fixed 0.3 s check could see a fresh request (3 of 4 runs on 31a0a62). Poll up
to 2 s until every request has expired; none is ever approved. Test timing
only.

Agent: Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge, guard file size (#31)

Answers the round-19 Codex review:
- Revocations the file lacks are put before the file's own, so a later trim
  (oldest first) drops them before anything the file recorded; the cap is
  1024 and a merge holds at most twice that.
- commit never writes a file larger than the read limit.
- The product home has no environment fallback (getpwuid only, like the helper).
- [AGENT-DRAFT] logs the key prefix the connect line shows instead of the
  approval id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LJG7KnMPqFcfTZ8A1C2qh
#31)

The poll ended at the first empty list, so a second helper's late request
(one signal-driven attempt per second plus 0.25 s jitter, and one follow-up)
could appear afterwards unchecked. Ask both helpers first, then require the
list to stay empty for 1.5 s within 5 s: late requests also expire and none
is approved. Test timing only.

Agent: Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Answers the round-20 reviews (Codex and Antigravity): any cut-off of the
revocation list lets a restored older copy, or a retried write, bring a
dropped key back. The list now has no count limit; a file that would pass
the 256 KiB read limit (thousands of revocations) is not written and the
denial stays pending and in effect. Tests cover 2,048 saved revocations
with a failed first write and a restored backup, and the read limit.
[AGENT-DRAFT] drops the key prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LJG7KnMPqFcfTZ8A1C2qh
…31)

29964c0 removed trimming and the merge ordering (revocations are only
appended when absent), but the takeover test still expected the older list
before the newer one. It now checks that every entry is kept exactly once.
Test-only change.

Agent: Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eping what removes a row (#31)

Answers the round-21 Codex finding: two histories that each fit may not fit
together. The merge then keeps every revocation that removes a row of the file
read, then the file's own, then the newest others, and writes that, so a
revoked app with a row in a restored backup stays revoked after a restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LJG7KnMPqFcfTZ8A1C2qh
…#31)

Answers the round-22 reviews: the fit no longer removes anything from memory
or pending, and never drops a revocation the file last read already holds
(no safety margin). Past the read limit, commit writes the revocations that
remove a row of the file last read, all of that file's own, then the newest
others that fit exactly; the rest stay in effect and pending. Nothing is
written when even the first two do not fit. Test: two restored backups in a
row, the second with K's row, do not bring K back in the run or after a
restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LJG7KnMPqFcfTZ8A1C2qh
…p a write over it (#31)

Answers the round-23 reviews: the skip-identical-write branch compared with a
file read before it became unreadable, so turning receipt on left the
unreadable file in place. onDisk is cleared when the file is missing or
unreadable and the skip needs a readable, open file. The restore test now
puts back a copy without K's row before the one with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LJG7KnMPqFcfTZ8A1C2qh
…31)

Answers the round-24 Codex finding: clearing onDisk also cleared what the fit
keeps first, so replacing an unreadable file could push out revocations the
last readable file held. lastGood keeps the last intact file for the fit;
onDisk (cleared on missing/unreadable) only gates skipping a write. Test:
replacing an unreadable near-limit file keeps every revocation it held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LJG7KnMPqFcfTZ8A1C2qh
@lseongjoo
lseongjoo merged commit 6262d82 into integration/issue-31 Nov 28, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T18:10:57.651391Z ee78d9c PR opened
🔒 Security Review ✅ Completed 2026-11-28T18:12:03.122263Z ee78d9c 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.

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