Skip to content

fix(cli): settle private one-shot turns without false persistence errors - #1068

Merged
XuPeng-SH merged 3 commits into
mainfrom
fix/cli-private-one-shot-outcome
Oct 18, 2026
Merged

XuPeng-SH merged 3 commits into
mainfrom
fix/cli-private-one-shot-outcome

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A successful one-shot tool task with --no-journal-content returned exit 4 because privacy policy intentionally omitted the canonical journal commit, which settlement classified as a persistence failure. Record an explicit durable content-omitted outcome through the existing journal CAS instead. Report local_continuation=omitted_by_policy without claiming a canonical commit or creating CSL/checkpoint/last-session recovery projections.

Related issue

Closes #1042

Change type

  • Bug fix
  • Test
  • Documentation

User and compatibility impact

Intentional local content omission no longer turns a completed task into a persistence error. Real write/fsync uncertainty, missing leases, invalid canonical messages and stale bases remain failures. Local and automatic recovery stop at an omitted or unverifiable boundary; explicit authenticated one-shot Server canonical resume remains available.

Persistent stdio redaction is rejected before model work. TUI restoration of a locally omitted boundary is explicitly rejected with one-shot recovery guidance; the separate Server/local TUI clock issue is #1063.

Architecture and complexity delta

  • Extend the existing journal CAS and one-shot settlement owner with a typed ContentOmitted result.
  • Keep the same lease, base, generation, append, readback and directory-durability fences.
  • One CLI privacy helper uses complete snapshots and existing core replay; corrupt successors cannot revive old CSL state.
  • No alternate journal, raw-content sidecar, forged canonical cursor, recovery projection or lifecycle. Explicitly requested stdout/event observer artifacts retain their normal semantics.
  • Existing device tests use the existing isolated HomeGuard; production identity checks are unchanged.

Verification

  • Real baseline main13797cce: the three tools and exact file output succeeded; DB run completed, but CLI returned persistence_error/exit4.
  • Final source: 141 CLI cases passed individually in isolated processes, including all seven original failures and privacy/corruption/Server-resume guards.
  • Nine services CAS guards passed, including repeated directory-fsync Unknown and exact retry without duplicate records.
  • cargo clippy --offline -p astra-cli -p astra-services --all-targets -- -D warnings, full make format-check and git diff --check passed.
  • Internal independent gpt-6.1-sol/xhigh source inspection found no remaining confirmed P1/P2. All 13 touched-file hashes remain identical after syncing main ee07dcf.
  • Draft remaining: new-head CI, final integrated fixed-binary GLM acceptance and formal independent PR review. Local test execution used the pre-sync dependency baseline; it is not claimed as current-head CI.
  • Database schema changes: none; the real baseline used an isolated local database/service.

Final checklist

  • Owning-layer and public-entrypoint regressions added.
  • Privacy and recovery contract documented.
  • Diff checked for credentials, private endpoints, user content and generated files.
  • Conventional Commit title.

Current head: 77a96f33c12aa41c0e1469da049d76da2290b98e. The preceding head's complete shared CLI inventory ran 4,884 tests: 4,883 passed and one existing unreadable-journal test failed because it expected the later generic journal-read message. The new privacy guard correctly rejects that directory earlier. This head changes only that test: it compares the exact early boundary plus the platform-derived I/O cause, excludes not-found misclassification, and verifies existing session/turn/history/cursor remain unchanged. Production behavior and the early refusal are preserved. Independent static follow-up review passed; precise local execution and new-head CI remain pending. No manual CI rerun was requested.

Live integration follow-up in progress

The fixed integration binary at 81f45c643d24afd326000e8a9313f68ece0f2e75 completed a real synthetic GLM privacy task with exit 0, authoritative completion, local_continuation=omitted_by_policy, and no persistence error. A subsequent client-profile filesystem audit found that the separate FileEditJournal undo checkpoint still persisted the synthetic file's raw after-content bytes. Complete privacy acceptance therefore has not passed.

The root cause is the native tool executor's independent file-checkpoint persistence binding, which bypasses canonical journal redaction. A minimal follow-up on this existing PR is under independent review: reuse the existing privacy setting at both binding entrypoints, keep in-memory undo, and preserve ordinary-mode persistence. No historical checkpoint is deleted. The two new regression tests have not yet run. The earlier formal review records the earlier head and evidence available at its submission time; it does not close this new live finding.

@XuPeng-SH
XuPeng-SH marked this pull request as ready for review October 18, 2026 13:03

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Code recommendation: APPROVE for 77a96f33c12aa41c0e1469da049d76da2290b98e.

Submitted as a COMMENT review because the connected account is the PR author; this records the code recommendation without casting an approval vote.

I found no blocking defects in the final 13-file change. ContentOmitted reuses the journal CAS lease, owner/base checks, generation checks, fsync and exact-record retry/readback fences. It does not manufacture a canonical cursor or write raw CSL/checkpoint/trace projections. Complete journal reads and canonical replay prevent stale local recovery after omitted, unreadable or invalid-successor boundaries; explicit authenticated one-shot Server canonical resume remains available. Stdio and TUI restrictions match the documented scope. The final test correction retains the early I/O rejection and strengthens preservation of the existing session state.

Fresh evidence for this head:

  • All 40 check runs were read across all pages; none is pending. All 15 required contexts match GitHub Actions App 15368: 12 succeeded and 3 were skipped by verified scope (test_core=false, sdk=false, web=false). The online integration label likewise completed its explicit unaffected-lane gate.
  • Shared CLI execution: 4,884/4,884 passed, 20 skipped, plus 3/3 supervisor checks. The previously failing unreadable-journal case passed. Turn-core/services/plan: 5,451/5,451 passed, including privacy CAS and durability guards.
  • Lint completed clippy, formatting and audit successfully; audit retains three allowed warnings.

The optional live harness remains failed: 16/18 passed, with BehaviorContractViolation results for flash_child_question_parent_answer and introspection_reflection_source_boundary. Live acceptance remains limited by those failures.

The cited PR CI tested merge e748efaacb2232b02c9b92f0bb4d22d88b4959e4 against ee07dcfc375330a7376f54c10e3f639eb9f0df9d. I separately inspected current main f0dd007ba6f239936bb399a8bcc73c7c830eb835: its native-CA transport change preserves certificate/hostname verification and has no file overlap with this privacy change.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Supplement to my earlier review 5563351180: code recommendation REQUEST_CHANGES for current head 77a96f33c12aa41c0e1469da049d76da2290b98e. This is a COMMENT because the connected account is also the PR author; it is not a formal change-request vote. The previous review remains unchanged, but its APPROVE recommendation is superseded by this new evidence.

Blocking privacy defect: file-edit undo checkpoints still persist raw content. The real synthetic privacy case on fixed integration 81f45c643d24afd326000e8a9313f68ece0f2e75 completed with exit 0, authoritative completion, local_continuation=omitted_by_policy, and no persistence error. Its client-profile filesystem audit nevertheless found file_checkpoints/000000.json with a raw after-content byte array of length 3, exactly matching the synthetic output. The journal's redaction markers and successful settlement do not make that separate file private.

I independently checked the current-head source: set_active_session_id and with_shared_file_journal enable checkpoint persistence without consulting the privacy policy; FileEditJournal serializes the original before/after bytes. This is an unclosed part of this PR's privacy contract, not an environment-only failure. My earlier independent review missed this persistence lane, so its statement about raw checkpoint projections was too broad.

Local commit 484d03ad4f004c4188ac5c9d1fb36d444654e38f is a candidate repair that detaches checkpoint persistence at both existing binding entrypoints while retaining in-memory undo. It is not in remote head 77a96f33 and is not accepted here as a completed fix. The repair must be published and validated with the actual create/overwrite/undo regressions, ordinary-mode control, shared/prebound builder and session-isolation cases, and a fresh client-profile filesystem audit. No existing checkpoint should be deleted to hide the evidence. Privacy acceptance remains on hold until the corrected behavior is demonstrated.

Fresh API verification still binds this review to 77a96f33: all 41 check runs were paginated through an empty final page; the 15 exact required contexts come from App 15368 (12 success, 3 verified scope skips). Those checks and the earlier optional-harness results do not cover or refute this newly confirmed raw-checkpoint leak. No Cargo, provider invocation, or product modification was performed by this reviewer.

@XuPeng-SH
XuPeng-SH force-pushed the fix/cli-private-one-shot-outcome branch from 77a96f3 to 1799d2c Compare October 18, 2026 17:18

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Code recommendation: APPROVE for 1799d2c79212e2421171eba97570a5e2fc65a5e2, against base/main e5ef6e2627aafbc111668c18b208152f0a332b80.

This is a COMMENT review because the authenticated account is the PR author, XuPeng-SH (39627130). It records an independent code recommendation, not an approval vote. I reviewed the complete 15-file diff and traced the production one-shot, native delivery, SSE executor, settlement and recovery call chains. I found no confirmed blocking defect.

The checkpoint leak recorded in review 5563478059 is addressed in this head. Both session binding and shared-journal binding consult the existing effective privacy policy before enabling persistence. A prebound shared journal is detached in either builder order. The journal method retains entries and undo behavior; it does not delete historical checkpoints. Session changes clear the previous session's in-memory undo. Ordinary-mode persistence remains covered.

Assessment of the four requested areas:

  • Design: ContentOmitted extends the existing journal CAS and settlement owner. It does not fabricate a canonical cursor or introduce a second transcript, sidecar or recovery state machine. The privacy branch persists only a reconstructed redacted terminal fact; raw tool/trace/transcript projections do not reach that batch or CSL/profile-pointer settlement.
  • I/O, isolation and cost: no SQL/schema or additional database round trips are introduced. The same owner-scoped paths, request/session execution lease, exclusive journal lock, base/generation checks, fsync and exact readback remain authoritative. File undo uses the existing bounded journal and mutex. Privacy recovery adds complete local journal reads, with canonical replay after an omission followed by a successor; automatic cloud selection can perform those local reads over the existing 20-candidate listing. This is startup/recovery work, not per-token or per-tool database work.
  • Clean Code and size: independently recounted, excluding pure movement: implementation +341/-25, net +316; tests +728/-3, net +725; documentation +37/-0, net +37. No pure file/function moves were found. The added code supplies distinct settlement, durability, recovery and checkpoint privacy behavior and reuses the authoritative CAS/replay/undo implementations. The size is not by itself a reason to reject it.
  • Unhappy paths: missing/mismatched leases, stale bases, malformed/unterminated journals, invalid canonical successors, append/durability uncertainty and existing cancellation/partial-result behavior retain failure semantics. Old CSL/checkpoints cannot silently revive an omitted boundary. Explicit authenticated one-shot Server canonical resume remains available; TUI restore and stdio restrictions match the documented contract.

Fresh verification for this target:

  • Before review and immediately before submission, PR 1068 was open, non-draft and unmerged at the exact head/base above. The protected main branch's required_status_checks.checks supplies 15 exact context/App pairs, all App 15368. Parent-inclusive ruleset enumeration and both rule details add no required checks. The administration-only full protection endpoint returns 403; the required inventory was read directly from the branch response.
  • All 39 check runs, commit statuses, all 5 workflow runs and each workflow's jobs were paginated through empty final pages. Required results are 12 success + 3 justified skips. Test scope output has test_core=false; static scope output has sdk=false, web=false, matching their exact workflow job conditions. online_integration=false makes the green integration job an explicit scope no-op; it is not evidence that integration tests ran.
  • Current-head shared CLI execution: 4,890/4,890 passed, 20 skipped, plus 3/3 supervisor checks. Logs explicitly show both checkpoint privacy regressions and the settlement, corruption, routing and TUI guards passed. Turn-core/services/plan: 5,451/5,451 passed, including the omission CAS conflict, repeated directory-fsync uncertainty and exact retry checks. The tested PR merge is 42b8e8c9fe8652291d303e0b14ed74fb35a1a9ea, combining the exact head and base above. Static Checks run 39148998021 also succeeded.
  • In an isolated local harness, I compiled the exact current FileEditJournal source against cached environment dependencies: its 23 existing tests plus one independent detach/undo/unchanged-old-checkpoint probe passed (24/24). This is source-level validation, not a full current-head CLI Cargo build. git diff --check passed; product worktrees remain clean.
  • The existing optional live harness reports 18/18 passed at this exact head. I did not invoke a provider or rerun CI. Its ordinary live cases and the historical d2da GLM evidence are not a fresh 1799 full client-profile privacy filesystem audit; no such additional audit is claimed here.

Deduplication checked raw review bodies, explicit SHAs and original anchors: the two earlier submissions remain anchored to 77a96f3; neither is a review of this head. No merge, branch push, product edit, label/draft/protection change or new issue/PR was performed by this reviewer.

@XuPeng-SH
XuPeng-SH merged commit 05ce15f into main Oct 18, 2026
@XuPeng-SH
XuPeng-SH deleted the fix/cli-private-one-shot-outcome branch October 18, 2026 17:53
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.

[Bug]: One-shot chat with --no-journal-content exits 4 after successful tool execution

1 participant