Skip to content

🧪 Wait for REPL questions before asserting lifecycle - #981

Merged
taras merged 1 commit into
mainfrom
agent/repl-lifecycle-935-codex-20261021
Oct 22, 2026
Merged

taras merged 1 commit into
mainfrom
agent/repl-lifecycle-935-codex-20261021

Conversation

@taras

@taras taras commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Why

L2 needs a real unanswered question before it checks the element's lifecycle. Component import can still be in enter after entry admission, so a finite scheduler poll does not establish question readiness.

What changes

Before: L2 polls for up to 1,000 scheduler turns until some lifecycle occurrence reports a wait.

After: L2 subscribes to question changes before checking the pending question, then asserts the entire Elicit:active:question reading. Answering the real question still leads through joined entry teardown to an empty reading and non-live session.

How to verify it

The added regression holds Elicit import and checks the entire Elicit:enter: reading with no pending question. After release, it obtains the real question, checks the full lifecycle and waiting-element assertions, answers and joins completion. A missing question wait still fails the assertion after question readiness completes.

Retained focused runs passed on the candidate verified to match signed head 06e31348460a0320d9db55dde993c3511ca24848:

  • deno task test packages/cli/tests/repl-lifecycle.test.ts — 1 passed, 9 steps, 0 failed.
  • deno task test packages/cli/tests/repl-execution.test.ts packages/cli/tests/repl-lifecycle.test.ts — 8 passed, 42 steps, 0 failed.

Scope

Included

  • Question readiness and one controlled delayed-import regression in packages/cli/tests/repl-lifecycle.test.ts.

Intentionally unchanged

  • Production lifecycle reporting, provider ownership, answer validation, persistence and replay.

New abstractions

  • A private scoped nextQuestion helper serves ordinary L2 and the delayed-import regression. Its subscription ends when the read returns, fails or is cancelled.
  • Each new abstraction has multiple concrete uses or a clear justification.
  • No speculative functionality is included.

Risks and limitations

The controlled delay demonstrates the pre-question interval. The exact scheduling of the historical failures was not reproduced.

Scope confirmation

  • Every changed file supports the purpose described above.
  • Unrelated cleanup and formatting changes are excluded.
  • No generated or mechanical files changed.
  • The description matches the final diff and retained test results.

Refs #935.

@github-actions

Copy link
Copy Markdown

PR #981: 🧪 Wait for pending questions in REPL lifecycle tests

1 files, +73 / -24

Scope

✅ PR scope looks good.

Structural

✅ No structural bloat detected.

Slop

✅ Slop indicators look low.

Static Analysis

✅ Oxlint found no issues.

Correctness

FILE: packages/cli/tests/repl-lifecycle.test.ts
PATTERN: Speculative abstractions
CONCERN: nextQuestion function has only 1 consumer (this test) but implements general-purpose logic
QUESTION: Would this logic benefit from being in a shared test utility or eliminated in favor of direct assertions?

FILE: packages/cli/tests/repl-lifecycle.test.ts
PATTERN: Speculative abstractions
CONCERN: nextQuestion implementation includes custom iterator handling that may not justify standalone abstraction
QUESTION: Could this logic be inlined to reduce cognitive overhead without sacrificing readability?

@taras taras changed the title 🧪 Wait for pending questions in REPL lifecycle tests 🧪 Wait for REPL questions before asserting lifecycle Oct 22, 2026
@taras
taras marked this pull request as ready for review October 22, 2026 05:05
@taras
taras merged commit 7eb2d38 into main Oct 22, 2026
44 checks passed
@taras
taras deleted the agent/repl-lifecycle-935-codex-20261021 branch October 22, 2026 05:11
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