Skip to content

fix(task): settle idle host child admission errors - #9621

Open
Dante-dan wants to merge 6 commits into
code-yeongyu:devfrom
Dante-dan:fix/9590-host-error-terminal
Open

Dante-dan wants to merge 6 commits into
code-yeongyu:devfrom
Dante-dan:fix/9590-host-error-terminal

Conversation

@Dante-dan

@Dante-dan Dante-dan commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A host child can emit an assistant error before agent_end when admission compaction refuses the next turn. The task runner previously kept waiting for agent_end, leaving the task reported as running after the child was idle. Observe that error and settle it on agent_idle or a confirmed idle heartbeat, preserving the compaction diagnostic.

This covers the task terminal-state acceptance item in #9590. It does not change the engine compaction algorithm or resolve the reported 380K provider / 120K estimated context mismatch.

Changes

  • Turn outcome: hold an assistant error even when the engine omits agent_end; let a new agent_start replace it so retries and extension continuations remain live.
  • Host state: a heartbeat settles the held error only when no stream, compaction, retry, bash work, steering, follow-up or pending message owns the session.
  • Regression coverage: existing host-handle tests cover event-only and heartbeat-only settlement, a queued follow-up, and active retry backoff. Rebuild the task extension from this source.

QA & Evidence

  • Conflict recovery merges dev through becbd1dc6; generated task extension was rebuilt with the repository generator. The four scoped source files preserve the published terminal-error fix. The later dev changes affect only Codex installation, leaving the QA-tested Senpi/task inputs unchanged.
  • Focused host-handle tests: 10 pass / 0 fail / 16 expectations. Task and adapter typechecks: exit 0. Full extension generator: exit 0.
  • Affected task suites: 992 pass / 1 skip / 2 fail. The zero-cap admission isolated recheck passed. The stderr fixture failed on matching dev under the original shim PATH; both this branch and matching dev passed its isolated recheck with native Node 24.12. The original broad failures remain recorded.
  • Resumed bun run test:senpi: FAIL, incomplete. Build/staging completed. The failing adapter suite was interrupted with exit 130 after 3700 passing / 173 failing test lines; these are partial log counts, not a complete suite total. Failures include build-purity/rebuild timeouts and sandbox restrictions. Gateway/thread failures explicitly report EPERM: operation not permitted, posix_spawn 'ps'. The final evidence-resolver suite was not reached; no same-root baseline attribution is claimed for these broad failures.
  • Real installed Senpi task-e2e.mjs: FAIL overall (22 PASS / 5 FAIL). Core spawn, wake, follow-up, peek, event sequence, batch, sync, invalid-category, happy resume and TTL checks passed. Cancel setup/non-revival, killed non-revival, and LRU setup/non-revival failed. Their captures show direct bash tool calls rejected by the current eval-tool surface, so sentinel waits did not execute; LRU attempted a second child while the first remained running and received residency_denied. Persisted cancel/kill records have the expected terminal dispositions, but failed compound witness/timing assertions mean these no-revival invariants remain unproven. This is not a clean live QA pass.
  • Final isolation fields: realSenpiUntouched: true, realSenpiChangedPaths: [], leakedPids: 0, mainExit: 0. Driver process exit 0 does not override its FAIL verdict. The locally installed real Senpi uses isolated agent directories and a scripted mock provider.
  • Local ignored evidence: .omo/evidence/omo-senpi-adapter/20261006-9590-conflict/, including README-resumed.md, live-task-resumed/verdict.json, qa-failure-attribution.json and package-gate-resumed.txt. Evidence remains local and is not committed. The earlier evidence root is retained as history.
  • Final live verdict SHA256: 53b67e9979252b95a7eb040dbf4997d78117fe0c15177321fd0ce65b7b15b7f4.

Risks & Residuals

  • The engine deterministic-compaction acceptance item remains unresolved. No original 380K/120K context failure is reproduced by this patch.
  • Existing task error/fallback consumers receive the held child-turn-failed outcome. This patch does not implement a separate compaction fallback chain.
  • Heartbeat settlement relies on the host's explicit idle state; busy/retry/queue fields keep the task live. The tests cover the relevant admission-error and continuation shapes.
  • Full-package and five resume QA assertions remain red as disclosed above. The resumed captures identify sandbox/process restrictions and a stale direct-bash fixture contract; the failed witness/non-revival assertions remain unverified. Core task paths and focused admission-error regressions passed, with broader regression risk retained.

Automated Checks

bun test packages/senpi-task/src/runners/rpc-host/handle-continuation.test.ts
tsgo --noEmit -p packages/senpi-task/tsconfig.json
bun test --timeout 20000 packages/senpi-task/src/runners/rpc-host packages/senpi-task/src/runners/rpc packages/senpi-task/src/manager packages/senpi-task/src/completion
bun test --timeout 20000 packages/senpi-task/src/runners/rpc-host-cancel-pending.test.ts -t 'host answers but cannot list'
bun run test:senpi
SENPI_BIN=<local-installed-binary> node packages/omo-senpi/scripts/qa/task-e2e.mjs

Related Issues

Refs #9590

Evidence hashes (relative to the local ignored evidence root):

db6daff529e98e99cad192e0e5b8b5188cfff24e5cd869fdc0d26927aca022ce  focused-current.txt
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855  task-typecheck-current.txt
308645a28df891721f9c04bc57af2c8309931b5ba06be4d00d5786467cc03fc7  affected-current.txt
ec306cc49754055f8f1927bb3062ee532650423e3e76df9a2ebe8f75b7959e24  pending-cancel-recheck.txt
b33949963aab271b860405eaa42080e89eeffd35493bfd1a346481dd41a276a2  package-gate-current.txt
8b20324f83af39c37c55fd16ff7e8b2101cbe85eda10cb71ce3a2f3cd9a8f7c4  live-task/verdict.json

Summary by cubic

Fixes task settling so a host child that emits an assistant error without agent_end no longer keeps the task reported as running after the child goes idle; the error now settles on agent_idle or a confirmed idle heartbeat.

  • Holds the assistant error turn when agent_end is missing; a new agent_start replaces it so retries and continuations stay live.
  • A heartbeat settles the held error only when the session reports no stream, compaction, retry, bash work, steering, follow-up, or pending messages.
  • Regression tests cover event-only and heartbeat-only settlement, a queued follow-up, and active retry backoff.
  • Refreshed the generated bundle source fingerprint in omo-task.js after merging dev.

Known residuals: Full-package and batch/resume QA remain red, and the pending-cancel recovery test fails under its 50 ms close budget while its isolated recheck passes; attribution is unconfirmed. This does not change the engine compaction algorithm or resolve the 380K/120K estimated context mismatch. Refs #9590.

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

View guided diff

Generated bundle freshness correction (aac47c235)

The Ubuntu Senpi compatibility job stopped before running tests because omo-task.js had a stale source fingerprint. Regenerating with the repository build script changes only its first-line source digest; every executable body byte is unchanged (SHA-256 a45399fa2b5fef85557355048cb05bb40ba75a07678a2efa66f244e640aa968d). No handwritten bundle edit or additional behavior change.

  • Official build-extension.mjs --check and build-install.mjs --check: pass after regeneration (native Node 24.15.0 / Bun 1.4.2). Focused host regressions: 10 pass / 0 fail.
  • A fresh real Senpi adapter smoke returned behavior PASS, with ultrawork injection observed and the optional comment-checker skipped because its binary is absent. Its isolation certification is unavailable (DIRECTORY_IDENTITY_UNAVAILABLE); empty changed-path arrays do not prove real-home isolation.
  • The previously disclosed same-source task QA FAIL (22 pass / 5 fail) and incomplete/red full-package gate remain unchanged. The fresh smoke is not a substitute for those gates.

Local ignored evidence: .omo/evidence/omo-senpi-adapter/20261006-9590-ci-freshness/ (artifact-comparison.json, generator.txt, check-after.txt, focused.txt, live-adapter.json, README.md). Required remote CI and maintainer review remain pending.

@github-actions github-actions Bot added omo-senpi Changes under packages/omo-senpi senpi-task Changes under packages/senpi-task labels Oct 5, 2026

@code-yeongyu code-yeongyu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @Dante-dan. Approving aac47c2356. This covers #9590's task-terminal-state item without touching compaction.

  • The held error waits for real idle: a message-only assistant error is held until the session is idle (agent_idle, or a heartbeat whose state shows no stream, compaction, retry, bash, steering, follow-up or pending message). It never settles on the message_end alone, and a new agent_start still replaces it, so retries and continuations stay live.

  • Mutations, locally: 132/132 in handle-continuation.test.ts + src/runners/rpc/.

    • Removing the heartbeat-driven settle in handle.ts fails heartbeat confirms idle β†’ the error is surfaced.
    • Removing the retryAttempt guard in sessionIsIdle fails heartbeat sees a retry attempt β†’ it cannot fail the active retry.

    Both guards are pinned by a test that fails without them.

The PR conflicts only in the generated omo-task.js. On its merge turn I'll merge dev and regenerate on Linux; dev is held for a release right now.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

omo-senpi Changes under packages/omo-senpi senpi-task Changes under packages/senpi-task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants