Skip to content

Conversation

@integrate-your-mind
Copy link
Owner

@integrate-your-mind integrate-your-mind commented Feb 3, 2026

What

  • add live Codex harness + CDP client for debugger tests
  • add tmux readiness/pane capture to surface Codex startup failures
  • add test hooks and in-flight edge case coverage

Why

  • make live Codex tests diagnosable when startup/auth fails
  • improve PID/agent matching reliability during interactive runs

How tested

  • unit tests:
  • integration tests:
  • manual: npm run build (failed: missing deps/@types; no install)

User impact

  • better live test diagnostics; runtime hooks gated by CODEX_TEST_HOOKS=1

Docs

  • updated docs
  • updated README/examples

Risk

  • low; hooks are env-gated and debug-only

Rollback

  • revert chore: improve live codex harness diagnostics

Open with Devin

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b1f2f5ca6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +392 to +398
const assistantCreatedAt = latestAssistant?.info?.time?.created;
const inFlightSignalAt =
!hasCompleted && typeof assistantCreatedAt === "number"
? assistantCreatedAt
: hasPendingTool && typeof latestPartStart === "number"
? latestPartStart
: undefined;

Choose a reason for hiding this comment

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

P2 Badge Use recent activity for stale in-flight cutoff

When CONSENSUS_OPENCODE_INFLIGHT_STALE_MS is set, the stale cutoff uses inFlightSignalAt, which for non-tool responses is based on the assistant message created timestamp. For long-running assistant generations (no tool parts, no completion yet), created can be much older than the most recent activity, so the stale check later in this function can force inFlight to false while the response is still actively streaming. This only shows up when stale cutoff is enabled and the response duration exceeds the cutoff; consider using the most recent activity time (e.g., latestActivityAt) or updating inFlightSignalAt with newer timestamps to avoid premature idle transitions.

Useful? React with 👍 / 👎.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines +187 to +193
async function waitForExit(child: ReturnType<typeof spawn>, timeoutMs: number): Promise<boolean> {
try {
await Promise.race([once(child, "exit"), delay(timeoutMs)]);
return true;
} catch {
return false;
}

Choose a reason for hiding this comment

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

🔴 waitForExit() always returns true because Promise.race never rejects on timeout

waitForExit uses Promise.race([once(child, "exit"), delay(timeoutMs)]) inside a try/catch and returns true whenever the race resolves. Since delay(timeoutMs) resolves (it does not reject), the race always resolves even when the process has not exited.

Actual vs expected:

  • Expected: return true only if the child emitted exit within timeoutMs, else false.
  • Actual: returns true even on timeout, so callers think the process exited.

Impact:

  • startConsensusServer().stop() relies on waitForExit to decide whether to SIGKILL (if (!exited) ...). With the current implementation, SIGKILL will never be sent, potentially leaving stray node server processes running (port conflicts, resource leaks) in live tests.
Where
async function waitForExit(child, timeoutMs): Promise<boolean> {
  try {
    await Promise.race([once(child, "exit"), delay(timeoutMs)]);
    return true;
  } catch {
    return false;
  }
}

Recommendation: Change the timeout branch to reject (or resolve a sentinel) so the function can distinguish between an exit event and a timeout, e.g. const exited = await Promise.race([once(...).then(()=>true), delay(timeoutMs).then(()=>false)]); return exited;.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@integrate-your-mind
Copy link
Owner Author

Superseded by cherry-picked Codex tail fixes in fix/activity-state.

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