Skip to content

fix(assistant): address sidecar review follow-ups - #19

Merged
takeokunn merged 7 commits into
mainfrom
fix/assistant-sidecar-review-followups
Sep 29, 2026
Merged

takeokunn merged 7 commits into
mainfrom
fix/assistant-sidecar-review-followups

Conversation

@takeokunn

@takeokunn takeokunn commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fix-forward for the independent review of PR #13.

Finding Fix Regression test
S2 generation race Snapshot pending generation under state-lock; poll and worker paths use locked snapshots; I/O remains outside the lock. discards-a-stale-sidecar-pending-before-the-next-request records fake-sidecar input and asserts stale is absent and fresh is delivered.
S1 EOF cleanup EOF reaps the process and enters idempotent stop cleanup; channels are closed, sibling threads joined, and self-join is avoided. stops-cleanly-when-init-gate-rejects-a-live-reader.
B1 response silence timeout Poll reads +assistant-sidecar-response-timeout-seconds+ (90 seconds) once per poll. If no event arrives for 90 seconds after the last event, it stops the sidecar and publishes a Japanese terminal error; each received event extends the deadline. does-not-time-out-while-response-events-continue; stops-and-delivers-a-terminal-event-after-response-silence.
S3 startup TOCTOU Startup claim/check is one state-lock interval; process and cleanup operations stay outside the lock. Cleanup preserves starting during the startup transition and advances the generation consistently. If pre-thread handoff fails, starting-p is cleared under the lock so a later start retries. clears-starting-state-when-startup-handoff-fails.
S4 version probe diagnostics Capture bounded stdout/stderr diagnostics and include them in the user-facing failure reason. reports-version-probe-output-when-the-sidecar-exits-with-an-error.
S5-S7 test robustness %assistant-test-await-state uses a time deadline; added stale-payload and SIGTERM-ignoring child cleanup coverage. discards-a-stale-sidecar-pending-before-the-next-request; kills-a-sidecar-that-ignores-sigterm.
Review formatting Normalized S3 stop-state/startup lambda indentation and B1 polling branch indentation. Formatting-only fixups folded into S3 and B1.

Commit mapping

Finding Commit
Test cleanup 22d3e29
S2 4c3b32f
S1 01efabe
B1 2cae770
S4 29a5189
S3 1faa6b0
Test strengthening 8ede0e8

Verification

  • Local nix build .#checks.aarch64-darwin.default -L: passed, 2293 passed, 34 skipped, 0 todo, 0 failed, 0 errored, 2327 total.
  • Commit hook gitleaks passed for the fixup commits.
  • CI run 36603297088: all 4 jobs passed: nix flake check, build release binary, integration tests, and source coverage.
  • e2e-main-wait-returns-background-status did not hang in this CI run; the earlier gate hang was an existing defect fixed by PR fix: reap completed background jobs before reading status #22 SIGCHLD handling.

@takeokunn

Copy link
Copy Markdown
Collaborator Author

Fix-forward report

  • S2: pending generation is snapshotted under state-lock; stale-payload regression records fake-sidecar input.
  • S1: reader EOF reaps the process, closes the write channel, stops the handle, joins sibling workers, and avoids self-join; cleanup is idempotent.
  • B1: added a 60-second request deadline. Timeout publishes AI 応答がタイムアウトしました(N 秒) and stops the sidecar. The existing 「まだ待つ」 choice does not extend this fixed deadline.
  • S3: startup claim/check is one mutex interval.
  • S4: bounded version probe stdout/stderr diagnostics are included in the terminal failure reason.
  • Tests: deadline-based await helper, stale payload receive-log assertion, EOF worker cleanup, timeout event, version diagnostics, and SIGKILL/process-group fallback coverage were added.

Verification:

  • Commit hook gitleaks: PASS, 0 commits scanned, no leaks.
  • git diff --check: PASS.
  • Local nix develop -c sbcl --script run-tests.lisp: started but remained blocked in first-time Nix dependency provisioning; no exit status obtained.
  • CI run 36529053731: nix flake check and build release binary failed with exit code 1; GitHub has not exposed their job logs while the run remains in progress. integration tests (x86_64-linux) and source coverage (x86_64-linux) are still in progress. Failure root cause and final run result remain pending log availability.

@takeokunn

Copy link
Copy Markdown
Collaborator Author

CI update: corrected follow-up commit caba9e2 is pushed. Run 36531314414: build release binary PASS; nix flake check FAIL after 5m37s; integration tests and source coverage are still in progress. GitHub has not exposed the completed flake log while the run remains active. Local forced ASDF load now exits 0 and confirms MAKE-ASSISTANT-SIDECAR-BOUNDARY is fbound.

@takeokunn
takeokunn force-pushed the fix/assistant-sidecar-review-followups branch from caba9e2 to ddf1a09 Compare September 29, 2026 07:36
@takeokunn

Copy link
Copy Markdown
Collaborator Author

AI sidecar follow-up run status: incomplete.

  • B1 remains staged but uncommitted. The staged stat contains the 11 B1 files only; S3 remains unstaged in src/infrastructure/assistant-sidecar-stream.lisp.
  • The canonical local gate nix build .#checks.aarch64-darwin.default -L started with a non-empty suite but failed with exit 124 after the nshell test check exceeded its 1800 second limit. The log shows SIGTERM followed by SIGKILL; no completed test-count summary was emitted.
  • This run cannot attribute the timeout to B1 alone because the Nix source archive included the separate unstaged S3 worktree changes.
  • Read-only review confirmed S3's current mutex scope keeps starting-state claim/update atomic and keeps I/O, channel waits, and joins outside the state mutex. S4 review found version-probe output and reader exception text were previously discarded; uncommitted follow-up edits now preserve diagnostic fields, but they were not committed or gate-verified.
  • Test-strengthening edits were prepared in t/unit/test-assistant-model-boundary.lisp, but their tests were not run successfully.

No commit, push, rebase, PR-body update, or merge was performed. CI run ID: not available because no new push was made.

@takeokunn

Copy link
Copy Markdown
Collaborator Author

Follow-up after isolating B1 with stash SHA 6d01879b50ebafa3fdc61cd0d6da648cfe61cf2e:

  • The stash was applied and dropped successfully. B1 is staged only; S4, S3, and test-strengthening changes are restored unstaged.
  • The canonical gate was rerun with only B1 in the source archive. It again timed out at 1800s and exited 137 after SIGTERM/SIGKILL. No test summary was emitted.
  • Focused evidence: e2e name-filter selected 115 tests, all passed; e2e-main-command-merges-stderr-with-pipe-and-ampersand passed in 0.870s; startup-cold-asdf-load-under-budget passed in 0.783s. These are not the source of the full-gate timeout.
  • Because the canonical gate is not green and no B1-specific failing test was identified, B1 was not committed or pushed. No S4/S3/test-strengthening commit was started.

CI run ID: unavailable; no push was made.

@takeokunn
takeokunn force-pushed the fix/assistant-sidecar-review-followups branch 2 times, most recently from bac0882 to 89f5d97 Compare September 29, 2026 16:43
@takeokunn
takeokunn force-pushed the fix/assistant-sidecar-review-followups branch from 89f5d97 to 8ede0e8 Compare September 29, 2026 17:12
@takeokunn

Copy link
Copy Markdown
Collaborator Author

Final review follow-up

修正を反映し、マージせずに push と検証を完了しました。

  • S3: %assistant-sidecar-start のスレッド引き渡し前を unwind-protect で保護し、失敗時は starting-p を同一世代のロック内で nil に戻すようにしました。回帰テスト clears-starting-state-when-startup-handoff-fails で、次の start が再試行されることを確認しています。
  • S3/B1: 指摘された setf、startup lambda、polling if の字下げを各対象コミットへ fixup し、autosquash しました。
  • 最終コミット: S3 1faa6b0、B1 2cae770、テスト強化 8ede0e8。

検証結果:

  • ローカル gate: 2293 passed, 34 skipped, 0 todo, 0 failed, 0 errored, 2327 total
  • CI run 36603297088: 4/4 ジョブ成功
    • nix flake check
    • build release binary
    • integration tests
    • source coverage
  • e2e-main-wait-returns-background-status のハングは今回の CI では発生していません。
  • PR はマージしていません。

@takeokunn
takeokunn merged commit a95a0ad into main Sep 29, 2026
4 checks passed
@takeokunn
takeokunn deleted the fix/assistant-sidecar-review-followups branch September 29, 2026 18:01
@takeokunn

Copy link
Copy Markdown
Collaborator Author

Squash merge completed. The merge commit on main is a95a0ad810268c38e3292943ea8dc35b58a5c613.

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