Skip to content

Sanitize batch execution failures and scope proposal lookups - #2358

Merged
Chris0Jeky merged 5 commits into
mainfrom
issue-2281/batch-error-sanitization
Aug 31, 2026
Merged

Sanitize batch execution failures and scope proposal lookups#2358
Chris0Jeky merged 5 commits into
mainfrom
issue-2281/batch-error-sanitization

Conversation

@Chris0Jeky

Copy link
Copy Markdown
Owner

Closes #2281

Summary

  • Sanitizes unexpected execution failures before status persistence, batch receipts, and relevant logs while preserving UnexpectedError.
  • Filters phase-one proposal snapshots to the caller's readable scope in one database command.
  • Retains phase-two ACL checks, revision pins, per-item transactions, and the executor's in-transaction permission recheck.
  • Adds synthetic exception-leak canaries plus warmed alternating command-shape and timing evidence.

Evidence

  • Red baseline: operation, transaction, and batch receipt canaries failed with raw provider, SQL, path, constraint, and stack sentinels.
  • Red oracle baseline: missing IDs used 1 command; unreadable board proposals used 5 commands.
  • Exact head b07e8dadbe34cdc3e338e532d31ee4657530e02d: both paths use 1 proposal-snapshot command and return the same 404 / NotFound / Proposal not found. response.
  • Post-fix warmed medians over 10 alternating samples: missing 9642.3 us; unreadable 9508.9 us. Wall-clock values are observational and no brittle threshold is asserted.
  • Focused Application tests: 39 passed.
  • Focused API, concurrency, and mid-batch revocation tests: 22 passed.
  • Full dotnet test backend/Taskdeck.sln -c Release -m:1 --no-restore: 8661 passed, 5 declared skips, 0 failed.
  • Fresh-context exact-head review: CLEAN, no CRITICAL/HIGH findings.

The timing harness retains aggregate durations and normalized command labels only. It does not retain proposal IDs, parameters, response bodies, or raw SQL.

Risk

Strict wall-clock equality is not claimed because host scheduling varies. The deterministic security property is equal response content plus equal command count and normalized query shape for stable missing and unreadable cases. Generic internal error logging intentionally trades exception detail for non-disclosure.

No canonical coordination document changed.

CLAUDE_SYNC_PACKET

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T00:55:56.719137Z 8cef2df New commits
ℹ️ 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.

@Chris0Jeky Chris0Jeky left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Exact-head independent review: CLEAN at b07e8dadbe34cdc3e338e532d31ee4657530e02d against c27283fb2926f1bddbbd20ee441808819d70aea4.

No CRITICAL/HIGH finding. The review checked all seven changed files for receipt, persistence, and log disclosure; cleanup failure handling; caller-scoped EF authorization; query-shape parity; sandbox behavior; and revision, revocation, and transaction guards.

Non-blocking: wall-clock samples remain observational because host scheduling varies. The deterministic assertion is equal response content, command count, and normalized query shape.

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

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

AppliedOperationCount: orderedOperations.Count));
}
catch (Exception ex)
catch (Exception)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve cancellation through exception sanitization

When the request token is canceled during an awaited transaction operation, OperationCanceledException enters this broad handler. The newly nested recovery catches then consume the cancellation raised by rollback or status persistence using the same canceled token and return UnexpectedError; in the parent implementation, that recovery exception escaped and cancellation propagated. This misclassifies client disconnects and host shutdowns as execution failures, so rethrow caller-requested cancellation before applying generic exception sanitization, using a separate cleanup token if rollback must still run.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Classification: MEDIUM, non-blocking. A canceled request can be misclassified, but the changed path does not create a realistic security or data-loss path. Declined for this bounded sanitization PR under the review gate; preserve cancellation semantics in a focused follow-up.

const int warmupPairs = 2;
const int measuredPairs = 10;
var interceptor = new NormalizedCommandShapeInterceptor();
using var factory = _factory.WithWebHostBuilder(builder =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Disable hosted workers for the command-shape probe

This derived host retains ProposalHousekeepingWorker, whose immediate and once-per-minute sweep queries AutomationProposals through the same intercepted TaskdeckDbContext. Because the interceptor classifies every such command as proposal-snapshot and each probe clears a process-shared queue immediately before sending its request, an overlapping sweep adds an extra shape and makes the exact single-command assertions fail nondeterministically, especially on a slow CI runner. Build this probe on a worker-disabled host, as the repository's worker-isolated test fixture does, before installing the interceptor.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Classification: MEDIUM test-isolation risk, non-blocking. The exact-head focused and hosted runs are green, and this does not affect runtime correctness, security, or data loss. Declined in this PR; isolate the worker in a focused test-harness follow-up.

@Chris0Jeky

Copy link
Copy Markdown
Owner Author

Latest-base proof for exact head 4fe8ea31e4a539f156959b18c176531b265915c8 against main 2e27a0f1ea5c36c30907dee398ef99834ac4ec90:

  • Synced the documentation-only main advance. The PR diff remains the same seven backend and test files.
  • Focused Application tests: 39 passed, 0 failed.
  • Focused API tests: 18 passed, 0 failed.
  • Concurrent-apply and mid-batch revocation tests: 4 passed, 0 failed.
  • Fresh-context synced-base review: CLEAN, no CRITICAL/HIGH findings.
  • Both Codex P2 comments were classified MEDIUM and declined as non-blocking under the bounded review gate.

Hosted checks are now re-running for this exact head. No Lane B canonical coordination document edit was introduced.

@Chris0Jeky

Copy link
Copy Markdown
Owner Author

Final exact-base reconciliation

  • head: e7edf01
  • base: 8295c95
  • base-only change since the prior green head: merged PR docs: reconcile CF-01 closure and project WIP #2359, limited to docs/IMPLEMENTATION_MASTERPLAN.md and docs/STATUS.md
  • application seam: 39 passed, 0 failed
  • API batch seam: 22 passed, 0 failed
  • git diff --check origin/main...HEAD: passed
  • fresh independent exact-base review: CLEAN, no realistic CRITICAL/HIGH finding

The hosted gate has restarted for this exact head. No unrelated infrastructure change entered the PR-authored diff.

@Chris0Jeky Chris0Jeky moved this from Pending to Review in Taskdeck Execution Aug 31, 2026
@Chris0Jeky

Copy link
Copy Markdown
Owner Author

Third and final base-drift reconciliation

  • head: 8cef2df
  • base: 8c74883
  • imported base change: merged PR Re-authorize deep-linked review proposals during polling #2357, limited to Lane A Paper Review API/composable/tests
  • PR-authored diff remains the same seven backend and test files
  • application seam: 39 passed, 0 failed
  • API batch seam: 22 passed, 0 failed
  • git diff --check origin/main...HEAD: passed
  • fresh independent exact-base review: CLEAN, no realistic CRITICAL/HIGH finding

The exact-head hosted gate has restarted. Another base advance will park this PR under the bounded gate-loop rule rather than trigger a fourth sync.

@Chris0Jeky
Chris0Jeky merged commit 3521e3c into main Aug 31, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Review to Done in Taskdeck Execution Aug 31, 2026
@Chris0Jeky

Copy link
Copy Markdown
Owner Author

Merged evidence

CLAUDE_SYNC_PACKET

shipped facts: Batch-execute unexpected failures now use generic external, persisted, receipt, and log text; proposal authorization snapshots are filtered to caller-readable rows without weakening phase-two ACL, revision, revocation, or transaction checks.
canonical-doc changes needed: Reflect #2281 and PR #2358 as merged in Claude-owned status/masterplan files if not already reconciled. Lane B changed no protected canonical coordination file.
issue/project state changes: #2281 closed as completed; #2281 and #2358 are Done / Priority II.
residuals: Preserve-cancellation semantics and worker isolation for the timing probe remain classified MEDIUM/non-blocking; wall-clock timing remains observational.
human actions: none.

@Chris0Jeky

Copy link
Copy Markdown
Owner Author

Post-merge checkpoint: the downstream E2E smoke completed successfully at the merged exact head. The late review sweep found no new review or inline thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

security: sanitize batch-execute errors and measure timing parity

1 participant