Skip to content

chore: promote staging to staging-promote/57d7b541-24389081893 (2026-04-14 10:27 UTC)#2453

Merged
henrypark133 merged 1 commit intomainfrom
staging-promote/7425dc0f-24393986437
Apr 18, 2026
Merged

chore: promote staging to staging-promote/57d7b541-24389081893 (2026-04-14 10:27 UTC)#2453
henrypark133 merged 1 commit intomainfrom
staging-promote/7425dc0f-24393986437

Conversation

@ironclaw-ci
Copy link
Copy Markdown
Contributor

@ironclaw-ci ironclaw-ci bot commented Apr 14, 2026

Auto-promotion from staging CI

Batch range: a53eac5c2dec6b6cd5c08189086093fde64aa9cb..7425dc0f4a1575189a3d44a30e3bed883d3cdf69
Promotion branch: staging-promote/7425dc0f-24393986437
Base: staging-promote/57d7b541-24389081893
Triggered by: Staging CI batch at 2026-04-14 10:27 UTC

Commits in this batch (24):

Current commits in this promotion (1)

Current base: staging-promote/57d7b541-24389081893
Current head: staging-promote/7425dc0f-24393986437
Current range: origin/staging-promote/57d7b541-24389081893..origin/staging-promote/7425dc0f-24393986437

Auto-updated by staging promotion metadata workflow

Waiting for gates:

  • Tests: pending
  • E2E: pending
  • Claude Code review: pending (will post comments on this PR)

Auto-created by staging-ci workflow

#2366)

* fix(security): harden approval thread safety (TOCTOU + error handling)

Consolidates two security fixes for the approval processing flow in
thread_ops.rs:

**TOCTOU race (#1486):** Hold session lock for the entire take-verify
sequence in process_approval() so pending approval cannot be lost if a
concurrent operation modifies the thread between take and restore.
Previously, the lock was dropped after take_pending_approval() and
re-acquired for request_id verification, creating a window where the
approval could be permanently lost.

**Silent error fallback (#1487):** Replace 10 silent `if let Some(thread)`
patterns with explicit `match` arms. Critical paths (state transitions,
deferred approval setup) return errors when threads disappear. Non-critical
paths (tool result recording, auth mode, rejection) log debug messages but
continue.

Regression tests:
- test_approval_request_id_mismatch_restores_pending
- test_approval_on_missing_thread_should_error

Supersedes #1591 (branch had no merge base with current staging).
Closes #1486, Closes #1487

https://claude.ai/code/session_01X86EZxqXEFiU9VetyhPKjM

* fix(security): prevent orphaned SSE events for dead threads

Address review feedback:
- handle_auth_intercept: return early when thread is gone instead
  of emitting auth-required SSE to a dead thread
- process_auth_token: skip emit_auth_required_status when thread
  disappeared (both Ok retry and Err retry paths)

Clients will no longer see auth prompts that can never resolve
when the underlying thread has been deleted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions bot added scope: agent Agent core (agent loop, router, scheduler) size: L 200-499 changed lines risk: medium Business logic, config, or moderate-risk modules contributor: core 20+ merged PRs labels Apr 14, 2026
@claude
Copy link
Copy Markdown

claude bot commented Apr 14, 2026

Code review

Found 2 issues:

  1. [HIGH:85] Unnecessary string clones in tool result recording path

https://github.com/anthropics/claude-code/blob/a11f75f20edd0050882fcd14fad7b28d448975cc/src/agent/thread_ops.rs#L1370-L1376

In process_tool_approval, result_content is cloned at line 1373 and again at line 1375. Since tool results can be large (API responses, file contents), and these are recorded within a hot path (every tool execution), consider using references or taking ownership directly to avoid unnecessary allocations.

  1. [MEDIUM:65] Potential session lock contention during database persistence

https://github.com/anthropics/claude-code/blob/a11f75f20edd0050882fcd14fad7b28d448975cc/src/agent/thread_ops.rs#L1278-L1297

persist_assistant_response() is called while holding the session lock in process_approval. If the store is slow or hung, the lock blocks concurrent operations on the same session. Consider extracting this to a separate task spawned outside the lock scope, or adding a timeout to prevent lock starvation.


Positive findings

✓ TOCTOU race fix is architecturally sound — atomically restores pending approval on request_id mismatch under single lock
✓ Error handling improved — explicit None branches replace silent failures throughout
✓ Regression tests are appropriate — properly exercise caller-level behavior (not just helpers)
✓ No new .unwrap()/.expect() in production paths
✓ No deadlock risks introduced

Base automatically changed from staging-promote/57d7b541-24389081893 to main April 18, 2026 00:59
@henrypark133 henrypark133 merged commit 7425dc0 into main Apr 18, 2026
34 of 44 checks passed
@henrypark133 henrypark133 deleted the staging-promote/7425dc0f-24393986437 branch April 18, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: medium Business logic, config, or moderate-risk modules scope: agent Agent core (agent loop, router, scheduler) size: L 200-499 changed lines staging-promotion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants