Skip to content

Reuse the tool/after preflight ping instead of a second daemon query - #140

Merged
ScriptedAlchemy merged 3 commits into
masterfrom
fix/after-preflight-handoff
Sep 6, 2026
Merged

ScriptedAlchemy merged 3 commits into
masterfrom
fix/after-preflight-handoff

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Why

#107 follow-up: agent-bundle#664 (d94223a66, on main72a035a3f) lets an event preflight return { outcome: 'execute', data } and hands that value to the route as props.preflight. cargo-hauler's tool/after gate already had the daemon's session-completed answer and then asked again in after-shell.ts.

What

  • tool/after preflight returns the finished-ticket ping as data when that is why the route loads, including an asOfMs watermark sampled before the ping.
  • The route announces those tickets and writes that watermark; it does not query the daemon a second time for that answer.
  • Cargo/hauler/hidden-cargo still short-circuit to 'execute' without a ping (same as today); that path still uses the existing completedSince query.
  • Pin agent-bundle and @agent-bundle/runtime to the pkg.pr.new preview of current main 9197015b9.

Closes the #107 comment 5556824771 for this follow-up.

Test plan

  • pnpm run check (validate, build, typecheck, diagnostics, rstest 1073 passed / 2 skipped, test:routes 37 passed / 3 skipped)
  • Live afterPreflight assertion now expects { outcome: 'execute', data } with tickets + asOfMs
  • tests/notify.test.ts asserts preflight tickets skip completedSince and write the ping watermark
  • One kache-status event-loop timing assertion flaked once (54.6 < 50) then passed on retry; unrelated to this diff

Deslop: Cursor Grok 4.6, 1 edit (dropped a restating field comment).

Self-review

Reviewer: gpt-5.6-sol-medium (generalPurpose; TraceDecay MCP/daemon was down, so the first change-risk-reviewer dispatch was blocked).

Findings:

  1. Warning — writing Date.now() after route start could skip tickets that finished between ping and write. Fixed: preflight carries asOfMs.
  2. Warning — no test that finishedTickets skips the daemon query. Fixed: tests/notify.test.ts.
  3. Warning (follow-up) — asOfMs sampled after the ping could still skip an in-flight finish. Fixed: sample asOfMs before the request.
  4. Atomic daemon-side watermark. Dismissed: would need a protocol change; pre-request sample matches the previous single-query race bound.

Re-reviewed after (1)+(2); (3) applied after the second pass. No remaining critical/warning merge risks.

@changeset-bot

changeset-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f5ad9d0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
cargo-hauler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@ScriptedAlchemy
ScriptedAlchemy merged commit 58f0da4 into master Sep 6, 2026
@ScriptedAlchemy
ScriptedAlchemy deleted the fix/after-preflight-handoff branch September 14, 2026 20:15
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