Skip to content

v0.4 automation integration and transaction safety - #71

Merged
Dailin521 merged 19 commits into
mainfrom
agent/v0.4-automation-integration
Aug 4, 2026
Merged

v0.4 automation integration and transaction safety#71
Dailin521 merged 19 commits into
mainfrom
agent/v0.4-automation-integration

Conversation

@Dailin521

@Dailin521 Dailin521 commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Draft v0.4.0 integration PR, built from the verified PR #70 Application/Controller baseline and completed on branch agent/v0.4-automation-integration.

Final branch head: 3a97301a40b499f07d482248502b48c1c31df713 (documentation-only evidence update).
Final implementation/headful head: 28c4dd40a5a23282a990533a350b88b334e3d5c7.

  • completes Issue reliability: make multi-file rollback track partial writes #69 transaction safety in Node and .NET: atomic replacement, backup-bound journals, compensating rollback, rollback-failure evidence, cancellation, concurrency, idempotence, crash recovery, retry-safe lock cleanup, stable SQLite planning fingerprints, and conservative recovery for ambiguous SQLite COMMIT acknowledgement;
  • completes shared Application use cases used by the Windows GUI, Business Automation host, and GUI trace path;
  • ships experimental Business Automation protocol 0.4 commands describe, status, plan, sync, switch, restore, and prune; writes are dry-run by default and require explicit --apply plus the bound plan and digest;
  • requires explicit --sqlite-home, --allow-sqlite-home-relocation, and --no-config for Automation restore relocation;
  • makes sync/switch plans publish concrete automatic-prune deletion targets; checked cleanup revalidates the exact set and recursive fingerprints before deletion;
  • reserves exit code 5 for complete-rollback evidence, uses 2 before Applying, and fails closed with 10 for applying failures without rollback/recovery evidence;
  • assigns stable Automation IDs to all WinForms interaction entries, publishes a 40-entry manifest, and enables an isolated/authenticated GUI bridge only in disposable test launches;
  • adds one-command visible Windows Release GUI E2E that drives real controls/events and native dialogs, checks independent config/rollout/SQLite effects, restart persistence, prune physical deletion/sentinel preservation, and GUI-to-Application causal traces;
  • finalizes v0.4.0 versions, CI, architecture/design docs, migration notes, and Release Notes.

Verification

All fixtures used disposable HOME/UserProfile/Codex/SQLite/AppData/Temp roots. No real auth.json, token, Codex Home, SQLite Home, or user data was read or tested.

  • Node local suite at implementation head: 183/183 passed.
  • .NET Core: 188 passed; 1 expected environment-gated WSL test skipped locally. Application 49/49, Automation 27/27, WinForms 66/66, GUI E2E contracts 36/36 passed; Release solution build had 0 warnings/errors.
  • Visible interactive Windows Release Headful E2E at 28c4dd4: 40/40 manifest entries, 53/53 required scenarios, 17 dialogs, 6 file-diff groups, 57 trace rows, restart passed, 0 errors, 0 blockers, and the published EXE SHA-256 matched independently.
  • v0.4.0 version consistency passed for all npm manifests and six shipped .NET projects.
  • Primary and independent stable-diff reviews found no P0/P1/P2. The final exact-head @codex review reported no major issues. The single external reliability challenge was unavailable after repeated server-side 502 retries and was cancelled at maintainer direction; it is not represented as a PASS.
  • Implementation-head CI: https://github.com/Dailin521/codex-provider-sync/actions/runs/30893561068
  • Final exact-head CI: https://github.com/Dailin521/codex-provider-sync/actions/runs/30893772549

Release state

Final exact-head CI and fresh Codex review are green, and primary review found no P0/P1/P2. No main mutation, merge, auto-merge, formal tag, or Release has yet been performed. CI contract tests are explicitly non-Headful; the real visible Headful run above is the release evidence.

Closes #69 when merged.

@Dailin521

Copy link
Copy Markdown
Owner Author

M1 transaction-safety checkpoint pushed at 38062c3d34169b334239f407f4b020af465f4503.

Isolated local evidence (fresh HOME/UserProfile/Codex/SQLite/AppData/Temp/cache roots; credential-like variables removed):

  • Node: 168 passed, 0 failed, 0 skipped
  • Core Release: 158 passed, 0 failed, 1 existing WSL-only conditional skip
  • git diff --check: passed
  • Independent Claude reliability reviews completed; deterministic findings were reconciled before push

This checkpoint fixes the macOS order-sensitive cancellation case by deterministic rollout ordering and substantially hardens Issue #69 partial-write tracking, rollback, crash recovery, journal acknowledgement, cross-runtime backup metadata, and lock ownership. CI run 30878602260 is the first exact-head validation for this commit.

Still intentionally deferred (not claimed complete): transaction journal v2 per-target rollback evidence and shared-SQLite pending markers. Windows Application/Business/GUI work continues in parallel. PR remains Draft.

@Dailin521

Copy link
Copy Markdown
Owner Author

Milestone checkpoint at exact head 88dc703:\n\n- macOS desktop/Core/Application/Release build: PASS\n- desktop-test: PASS\n- Node 16/24 on Windows and Ubuntu: PASS\n- ci-gate: PASS\n- exact run: https://github.com/Dailin521/codex-provider-sync/actions/runs/30879154032\n\nThe follow-up fixes Node 16 test compatibility and makes lock publication no-replace on POSIX. Windows Application/API/GUI work continues in separate local slices; none of that unverified work is represented by this green head.

@Dailin521

Copy link
Copy Markdown
Owner Author

SQLite consistency checkpoint at exact head f68279d4ef196c8030831fd038c7f44dbfc632d:\n\n- managed Node/.NET backups now use SQLite online backup\n- manifests record one standalone main database; live WAL/SHM are not copied independently\n- legacy metadata mirror is derived from the consistent snapshot\n- exact run: https://github.com/Dailin521/codex-provider-sync/actions/runs/30879424821\n- all required jobs and ci-gate: PASS\n\nWindows Application/API/GUI changes remain local and are not represented by this green checkpoint.

@Dailin521

Copy link
Copy Markdown
Owner Author

Milestone pushed: \ ef8cef240a492dc445169e4cbfb96842e055764\ (isolated WinForms automation bridge).

Evidence at this exact commit:

  • Release App.Tests: 50/50 passed, 0 skipped (verified in a clean detached worktree)
  • stable IDs + manifest for current WinForms interaction surface
  • bridge drives real controls/events, including dynamic provider/recent-home selection
  • bootstrap is claimed before normal AppData/singleton/update access
  • isolated SQLite/backup/rollout/pending-journal containment tests include malicious config/env and unchanged external DB hash
  • atomic queued cancellation, bounded request-id replay rejection, and human-readable accessibility names

Not claimed at this milestone: MainForm→shared Application migration, GUI→Application trace, modal-dialog E2E, or final headful PASS. Those are active follow-up slices. Exact-head CI is now pending.

@Dailin521

Copy link
Copy Markdown
Owner Author

Exact-head CI checkpoint for \ ef8cef240a492dc445169e4cbfb96842e055764: run \30880210036\ passed all required jobs (Node Windows/Ubuntu 16+24, Windows desktop, macOS desktop, ci-gate). This is a checkpoint only; later unpushed Application/Business/GUI trace work is not represented by this run.

@Dailin521

Dailin521 commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Milestone pushed: 5f73a31bc930eac0a794f82381bb943862fb3ca9 (lock ownership/recovery hardening).

Exact clean-worktree evidence:

  • Node lock suite 23/23 passed
  • .NET Core Release LockServiceTests 23/23 passed
  • broader pre-commit evidence: Node 24 full 180/180; Core 171 passed + 1 existing WSL-only conditional skip; Release solution 0 warnings/errors

Coverage includes directory-generation ABA, file/symlink fail-closed diagnostics, bounded stale reclaim, claim cleanup semantics, no-replace recovery, owner-only Unix publication, and a stable busy marker/predicate while preserving the existing exact InvalidOperationException contract.

Deferred by design: journal v2 and shared-DB pending markers. Exact-head remote CI is pending.

@Dailin521

Copy link
Copy Markdown
Owner Author

Milestone pushed: 9f1b22070cdc6df12b2ef163a6dd3d394ae0d4ba (shared Application use cases + production Business Automation API).

Exact clean-worktree evidence:

  • Release solution build: 0 warnings / 0 errors
  • Core: 171 passed, 1 existing WSL-only conditional skip
  • Application: 48/48
  • Business Automation: 22/22
  • WinForms regression: 50/50
  • Release publish contains CodexProviderSync.exe, CodexProviderSync.Automation.exe, and automation-protocol-v0.4.schema.json

Implemented:

  • describe/status/plan/sync/switch/restore/prune
  • writes default to dry-run; apply requires explicit --apply + exact plan document/digest
  • production Core write port, same-observation lock-held freshness check, expiry, durable single-use claims
  • real-process apply/duplicate/stale/busy coverage with exit 3/4 and zero-write rejection evidence
  • CI now builds the full Release solution, tests Automation, and adds an Ubuntu .NET lock job

Known honest limitation: auto-prune binds the complete managed backup-root inventory + retention action rather than publishing a fabricated per-directory deletion list. GUI migration/trace and headful E2E remain separate active milestones. Exact-head CI is pending.

@Dailin521

Copy link
Copy Markdown
Owner Author

P0 follow-up pushed: f5b8be522cfea790847a01d59086b0cd9ad4d6f3 (transactional SQLite snapshot restore).

Why this was required: the prior online-snapshot creation milestone no longer stored independent live WAL/SHM copies, but the restore path still deleted live sidecars before replacing the main file. A restore failure could therefore discard committed WAL data.

Exact clean-worktree evidence:

  • Node SQLite + reliability: make multi-file rollback track partial writes #69 sync/restore suites: 119/119
  • .NET Core: 172 passed, 1 existing WSL-only conditional skip
  • v2 live-WAL round trip restores the snapshot through SQLite's official online-backup API
  • corrupt backup fails while preserving live WAL bytes and committed rows
  • disappearing source is opened read-only and is not recreated as an empty DB

Both Node and .NET now use backup snapshot as SQLite source and live DB as destination; neither manually deletes/copies live WAL/SHM. Node driver selection requires both DatabaseSync and backup; .NET destination uses synchronous=FULL. POSIX mode inheritance for a brand-new restore target remains a documented non-P0 follow-up because post-commit chmod would add a false-failure window. Exact-head CI is pending.

@Dailin521

Copy link
Copy Markdown
Owner Author

Exact-head CI checkpoints:

  • \5f73a31bc930eac0a794f82381bb943862fb3ca9: run \30880431865\ — success
  • \9f1b22070cdc6df12b2ef163a6dd3d394ae0d4ba: run \30880719212\ — success

The latter passed the expanded gate: Release desktop build/tests including Automation, macOS, Node Windows/Ubuntu 16+24, the new Ubuntu .NET lock job, and ci-gate. Current head \ 5b8be5\ has its own CI still in progress; these earlier runs are checkpoints only.

@Dailin521

Dailin521 commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Milestone: WinForms now shares the v0.4 Application use cases (357868df0fb559fb95b1bbca630a8d4ef465a07c). - GUI status/sync/switch/restore/prune route through one production IApplicationService; no direct Core write/status calls remain in MainForm. - GUI writes freeze intent, confirm first, then CreatePlan -> exact plan+digest -> apply; only Succeeded + Applied + Result is accepted. A stale plan gets one complete re-plan with a fresh digest. - ui.invoke still drives real WinForms Button.Click handlers and now returns/writes causal Application operation IDs, kinds, and lifecycles (trace schema v2). - Automation mode uses a real FolderBrowserDialog, with post-selection isolation validation. Manual update check drives the real control/event/busy/log path against a deterministic no-network boundary; external launches remain blocked. - Initial async-load and disabled-control automation races are closed. Local Release evidence at this exact commit: - CodexProviderSync.Application.Tests: 49/49 PASS - CodexProviderSync.App.Tests: 66/66 PASS - includes a real STA WinForms refresh Button.PerformClick through production Application/Core with an isolated SQLite fixture and GUI->Application trace. - diff --check: clean Independent Claude XHigh findings incorporated: strict applied-result handling, full re-plan on plan_stale, disabled ui.set, bounded per-request trace correlation, and observer non-interference. Real modal interaction remains intentionally external to the bridge and will be proven by the headful Windows E2E harness now in progress.

@Dailin521

Copy link
Copy Markdown
Owner Author

Exact-head CI checkpoint: 357868df0fb559fb95b1bbca630a8d4ef465a07c is fully green in run https://github.com/Dailin521/codex-provider-sync/actions/runs/30881368805.

PASS: Windows desktop tests, macOS Core/Application + Mac build, Linux lock tests, Node 16/24 on Windows and Ubuntu, and ci-gate.

This is an intermediate checkpoint. The PR remains Draft; the real headful Windows Release GUI E2E, its CI wiring, documentation/version finalization, and final exact-diff Claude review are still in progress.

@Dailin521

Copy link
Copy Markdown
Owner Author

Milestone pushed at �6a91cb: Windows lock identity reads now use delete-sharing, owned claim cleanup is bounded/revalidated/retryable, and cleanup exhaustion preserves both the original contention and cleanup evidence. Local evidence: LockService 28/28 PASS; full lock-filter suite previously 46/46 PASS; two-reclaimer stress 50 rounds per run (plus repeated 500-round verification) PASS; diff check PASS. Next: land the SQLite SHM plan-stability fix, then rerun the one-shot real Release GUI E2E.

@Dailin521

Copy link
Copy Markdown
Owner Author

Database plan-stability milestone pushed at 6603dd8. Real Headful evidence showed restore replanning twice with identical main/WAL hashes and only state_5.sqlite-shm timestamp drift. Fix: SHM is excluded as derived WAL-index/lock state; SQLite plan fingerprints bind main/WAL bytes without mtime; missing and zero-length WAL normalize identically; snapshot format is v2. Durable drift protection remains: a committed WAL-resident SQL change is rejected before mutation. Evidence: new planning tests 11/11, repeated 110/110; full Core Debug 176 pass + 1 existing WSL skip; full Core Release 176 pass + 1 skip; Application 49/49; diff check PASS. Independent Claude database/reliability challenge was read and its actionable mtime/empty-WAL concerns were incorporated. Next: rerun the hardened real Release GUI E2E after its anti-false-PASS gates finish.

@Dailin521

Copy link
Copy Markdown
Owner Author

v0.4 Windows GUI E2E milestone

Pushed implementation commit c5af7c3 and documentation commit 7548f02.

Visible interactive Windows Release E2E at c5af7c3:

  • published real CodexProviderSync.exe SHA-256 independently matched
  • GUI manifest coverage: 40/40
  • required Headful scenarios: 53/53 passed
  • errors: 0; blockers: 0; skipped required scenarios: 0
  • real native FolderBrowserDialog/MessageBox paths exercised
  • shared Application traces linked Status (including failure/recovery), Sync, Switch, Restore, and Prune
  • independent config/rollout/SQLite effects verified
  • prune physically removed the old managed directory and preserved the unmanaged sentinel SHA-256
  • restart persistence verified
  • GUI E2E contract tests: 36/36; Release solution build: 0 warnings/errors

7548f02 only records the verified result in docs/Release Notes. No tag, Release, auto-merge, or main mutation was performed. Exact-head local suites and CI are now running.

@Dailin521

Copy link
Copy Markdown
Owner Author

COMPLETE — final exact-head gate

  • final PR head: ed6cd7243f4ee561b6d3d2c633dfa93a5bbdd4b9
  • final implementation/headful head: 7545b5d0b72aa4877bb07d2ab0b35aca38944899
  • exact-head CI: https://github.com/Dailin521/codex-provider-sync/actions/runs/30887776820 — 8/8 passed
  • local Node: 183/183
  • Core: 182 passed + 1 expected WSL environment gate; remaining .NET suites green
  • real visible Windows Release GUI E2E: 40/40 manifest, 53/53 required scenarios, 0 error/blocker, EXE hash/restart/file diffs/dialogs/Application trace verified
  • final independent review: no unresolved P0/P1/P2
  • worktree clean; branch equals remote

PR remains Draft. No main mutation, auto-merge, tag, or Release was performed.

@Dailin521
Dailin521 marked this pull request as ready for review August 4, 2026 07:53

@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: ed6cd7243f

ℹ️ 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 thread desktop/CodexProviderSync.Automation/AutomationCommandLine.cs
Comment thread desktop/CodexProviderSync.Core/CodexSyncService.cs
Comment thread desktop/CodexProviderSync.Automation/AutomationHost.cs Outdated
@Dailin521
Dailin521 marked this pull request as draft August 4, 2026 08:24
@Dailin521

Copy link
Copy Markdown
Owner Author

Review-fix checkpoint — 28c4dd40a5a23282a990533a350b88b334e3d5c7

The three new Codex findings were independently validated and fixed on the original PR branch:

  • Automation restore relocation now requires explicit --sqlite-home, --allow-sqlite-home-relocation, and --no-config.
  • sync/switch plans enumerate concrete automatic-prune deletion targets; checked cleanup is restricted to the exact planned set and revalidates recursive fingerprints before deleting.
  • exit code 5 is now reserved for failures with explicit complete-rollback evidence; pre-apply failures use 2, while post-apply failures without rollback evidence fail closed with 10.

Exact local evidence:

  • Node: 183/183
  • Core Release: 188 passed, 1 existing Windows/WSL environment-gated skip
  • Application: 49/49; Automation: 27/27; WinForms: 66/66; GUI E2E contracts: 36/36
  • Release solution build: 0 warnings / 0 errors
  • visible Windows Release GUI E2E at this committed head: 40/40 manifest, 53/53 required scenarios, 17 dialogs, restart persistence, 0 errors / 0 blockers
  • independent stable-diff review: no P0/P1/P2

Exact-head CI: https://github.com/Dailin521/codex-provider-sync/actions/runs/30893561068 (in progress). PR remains Draft pending CI and a new @codex review.

@chatgpt-codex-connector

Copy link
Copy Markdown

Review Result

No additional P0/P1/P2 findings were identified at checkpoint 28c4dd40a5a23282a990533a350b88b334e3d5c7.

The reviewed changes address all three earlier findings:

The worktree was already clean at the supplied commit, so I made no changes, created no additional commit, and—per the repository workflow—did not create a new pull request.

Checks

  • git diff --check && git status --short
  • git status --short --branch — clean branch at 28c4dd4
  • ⚠️ dotnet test desktop/CodexProviderSync.Automation.Tests/CodexProviderSync.Automation.Tests.csproj -c Release --no-restore — could not run because the container does not have dotnet installed.
  • ⚠️ dotnet test desktop/CodexProviderSync.Core.Tests/CodexProviderSync.Core.Tests.csproj -c Release --no-restore — could not run because the container does not have dotnet installed.

View task →

@Dailin521

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 3a97301a40b499f07d482248502b48c1c31df713, with implementation changes at 28c4dd40a5a23282a990533a350b88b334e3d5c7.

The prior three findings were addressed with regression coverage:

  • restore relocation requires explicit --sqlite-home + --allow-sqlite-home-relocation + --no-config;
  • sync/switch automatic-prune plans list exact deletion targets, and checked cleanup revalidates the full candidate set and recursive fingerprints before deletion;
  • exit code 5 requires complete-rollback evidence; pre-apply failure is 2 and unknown post-apply failure is 10.

Exact-head CI run 30893772549 passed all 8 jobs. Visible Windows Release GUI E2E passed 40/40 manifest and 53/53 required scenarios with 0 errors/blockers.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 3a97301a40

ℹ️ 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".

@Dailin521
Dailin521 marked this pull request as ready for review August 4, 2026 09:35
@Dailin521
Dailin521 merged commit 6cf321b into main Aug 4, 2026
8 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: 3a97301a40

ℹ️ 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 thread src/session-files.js
Comment on lines +784 to 785
await syncStagedFile(tmpPath);
await fsp.rename(tmpPath, change.path);

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 Skip rollouts that remain open on POSIX

When sync runs on Linux or macOS while Codex still has an active rollout open, this staged replacement swaps the directory entry while the writer's existing file descriptor remains attached to the old inode; later session records can therefore be appended to an unlinked inode and disappear from the visible rollout. The final size/mtime check cannot detect writes made after the rename, and this commit routes equal-length provider rewrites through this replacement instead of the previous in-place update, broadening the data-loss case. Detect and skip active rollouts or preserve the inode during rewriting.

AGENTS.md reference: AGENTS.md:L137-L141

Useful? React with 👍 / 👎.

Comment thread src/service.js
Comment on lines +959 to +963
const normalizedBackupDir = path.resolve(backupDir);
let boundJournal = null;
try {
boundJournal = await readTransactionJournal(
path.join(normalizedBackupDir, "transaction-journal.jsonl")

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 Reject restores while another transaction is pending

When transaction A has a non-terminal recovery journal and the user invokes the Node CLI to restore backup B, this code inspects only B's journal and never checks findPendingTransactions(codexHome). It consequently permits an unrelated snapshot to overwrite the partially recovered state while A remains pending; the later mandatory restore of A then overwrites B again. Reject the restore when any pending transaction is bound to a different backup, as the .NET restore path already does.

Useful? React with 👍 / 👎.

@Dailin521
Dailin521 deleted the agent/v0.4-automation-integration branch August 4, 2026 10:07
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.

reliability: make multi-file rollback track partial writes

1 participant