Skip to content

fix: address review findings round 1 (PR #802)#803

Closed
github-actions[bot] wants to merge 4 commits intomainfrom
fix/issue-397-shutdown-precheck-9c28f8ea
Closed

fix: address review findings round 1 (PR #802)#803
github-actions[bot] wants to merge 4 commits intomainfrom
fix/issue-397-shutdown-precheck-9c28f8ea

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Addresses 6 expert review findings from round 1.

Findings addressed

  1. 🟡 MODERATE — Spurious double-reconnect on first-send-after-restart (2/3 reviewers)
    Added wasAlreadyConnected guard — pre-check is skipped when lazy-resume already reconnected.

  2. 🟡 MODERATE — OperationCanceledException wrapping loses cancellation identity (2/3 reviewers)
    Added specific catch (OperationCanceledException) with throw; before the general catch.

  3. 🟢 MINOR — null vs null! inconsistency (summary finding)
    Changed state.Session = null;state.Session = null!; for consistency with 12+ other occurrences.

  4. 🟢 MINOR — Fragile structural test window (2/3 reviewers)
    Changed anchor from method signature to IsProcessing = true with 2000-char window.

  5. 🟢 MINOR — Error message attributes all failures to "server shutdown" (2/3 reviewers)
    Error now includes ex.Message for actionable root cause visibility.

  6. 🟡 MODERATE — Tests don't cover actual behavior change (3/3 reviewers)
    Added 5 structural tests verifying pre-check code invariants (guard, cancellation, flag release, error message, null!).

Test results

All 3649 tests pass (5 new structural tests added).

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • 192.0.2.1

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "192.0.2.1"

See Network Configuration for more information.

Generated by Review & Fix · ● 13.6M ·

github-actions Bot and others added 4 commits April 29, 2026 12:13
Before sending a prompt, SendPromptAsync now checks if events.jsonl ends
with session.shutdown. If so, it forces a reconnect before sending instead
of sending to a dead session and discovering the failure 10+ minutes later
via the watchdog.

The GetLastEventType helper (tail-read, last 4KB) keeps overhead minimal
on the normal send path.

Also increases the structural test search window in
PrematureIdleSignal_ResetInSendPromptAsync to accommodate the new code.

Fixes #397

Co-authored-by: copilot-agentic-workflow[bot] <224017+copilot-agentic-workflow[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…le-reconnect

After lazy-resume, events.jsonl still shows session.shutdown from the old session.
The pre-check would read this stale file and unnecessarily reconnect again.
Gate the pre-check on whether the session was already connected before entering
SendPromptAsync, so freshly resumed sessions skip the check.

Also fixes:
- OperationCanceledException now caught separately (preserves cancellation semantics)
- state.Session = null! (consistent with 12+ other occurrences in codebase)
- Error message includes inner exception details for actionable root cause

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Search from 'IsProcessing = true' anchor instead of the method signature.
This avoids fragile window sizing that breaks every time code is added to
the early part of SendPromptAsync.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace weak behavioral tests (that just re-tested GetLastEventType) with
structural tests that verify the actual fix code:
- wasAlreadyConnected guard prevents double-reconnect
- OperationCanceledException has its own catch with throw
- SendingFlag released on both catch paths
- Error message includes inner exception details
- null! used for Session assignment (not bare null)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PureWeen
Copy link
Copy Markdown
Owner

Stale fix-round PR — fixes were pushed to the main PR branch.

@PureWeen PureWeen closed this Apr 30, 2026
@PureWeen PureWeen deleted the fix/issue-397-shutdown-precheck-9c28f8ea branch April 30, 2026 20:17
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.

1 participant