Skip to content

fix: flush pending responses before runtime maintenance - #173

Open
hheei wants to merge 1 commit into
cortexkit:mainfrom
hheei:fix/pending-response-flush
Open

fix: flush pending responses before runtime maintenance#173
hheei wants to merge 1 commit into
cortexkit:mainfrom
hheei:fix/pending-response-flush

Conversation

@hheei

@hheei hheei commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Flush ready deferred responses before runtime maintenance and again afterward. This prevents a terminal foreground Bash task from waiting behind a synchronous runtime drain before its NDJSON response can be emitted.

The second flush preserves delivery for responses that become ready during maintenance. Runtime maintenance and task execution behavior are otherwise unchanged.

Fixes #172.

Regression coverage

  • Adds a pending-response ordering regression: a ready deferred response must be polled and written before configure-warning maintenance runs.
  • Updates the periodic-drain polling expectation for the new before/after flush behavior.

Validation

  • cargo +nightly-2026-04-29 test -p agent-file-tools pending_response_tests -- --nocapture
  • cargo +nightly-2026-04-29 test -p agent-file-tools decide_bash_step -- --nocapture
  • cargo +nightly-2026-04-29 build -p agent-file-tools --release --bin aft
  • Direct @cortexkit/aft-bridge smoke against the built binary: configure, Bash launch, terminal status, and output retrieval succeeded.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Flush ready pending responses before and after runtime maintenance so NDJSON from foreground Bash tasks is not blocked by the drain. No change to maintenance or task behavior.

Written for commit f957d38. Summary will update on new commits.

Review in cubic

Greptile Summary

Flushes ready deferred responses before runtime maintenance and polls again afterward, with regression coverage for response ordering and the updated polling cadence.

Confidence Score: 5/5

The PR appears safe to merge, with the new ordering preserving both prompt delivery of already-ready responses and delivery of responses made ready during maintenance.

The runtime registry retains one stable application context, and current pending-response polling remains compatible with the intentional before-and-after maintenance cadence; no concrete changed-code failure remains.

Important Files Changed

Filename Overview
crates/aft/src/main.rs Reorders pending-response flushing around runtime maintenance and adds focused tests for pre-maintenance delivery and twice-per-tick polling.

Reviews (1): Last reviewed commit: "fix: flush pending responses before runt..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 1 file

Re-trigger cubic

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.

Deferred bash responses can be starved by runtime maintenance after task completion

1 participant