Skip to content

Share the terminal-nudge marker so collectors can recognize the nudge#172

Open
arseniycodes wants to merge 1 commit into
mainfrom
ash/terminal-nudge-marker
Open

Share the terminal-nudge marker so collectors can recognize the nudge#172
arseniycodes wants to merge 1 commit into
mainfrom
ash/terminal-nudge-marker

Conversation

@arseniycodes

@arseniycodes arseniycodes commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Observed in a live session: the model called propose_pr; the idle-nudge user.message landed 14ms later in the event stream; a collector that resets captured turn state on every user.message wiped both the captured terminal call AND its pending ack — the session then sat in requires_action forever (the ack never arrives), unreachable by the spent one-shot nudge.

Two changes:

  • TERMINAL_NUDGE_MARKER exported from agent-outcome-tools.ts (the shared contract module) and used as the nudge prompt's opening sentence, so collectors can recognize nudge messages and treat them as pokes that never reset state.
  • No functional change to sync.ts beyond composing the prompt from the shared constant.

Summary by cubic

Exports a shared TERMINAL_NUDGE_MARKER and uses it to build the idle terminal nudge so collectors can spot nudge user.messages and avoid resetting turn state. This prevents the race where a terminal tool call is wiped and the session gets stuck in requires_action.

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

Review in cubic

A collector that treats every user.message as a turn reset wipes a
terminal tool call that raced the nudge by milliseconds — the ack is never
sent and the session wedges in requires_action. Exporting the nudge's
opening sentence lets collectors classify it as a poke that never resets
captured state.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/worker/src/agent-outcome-tools.ts">

<violation number="1" location="apps/worker/src/agent-outcome-tools.ts:48">
P2: The `TERMINAL_NUDGE_MARKER` is exported for collectors to recognize nudge messages, but no collector or event-stream code in this repository actually consumes the constant. Without the consuming-side change that avoids resetting captured turn state on messages matching this marker, the race condition described in the PR remains unfixed by this change alone. Please confirm whether the collector logic is updated in a companion PR or planned follow-up.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

// collectors can recognize the nudge in a session's user.message stream and
// treat it as a poke (never a turn reset): a nudge that lands milliseconds
// after the model's own terminal call must not invalidate that call.
export const TERMINAL_NUDGE_MARKER =

@cubic-dev-ai cubic-dev-ai Bot Jul 7, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The TERMINAL_NUDGE_MARKER is exported for collectors to recognize nudge messages, but no collector or event-stream code in this repository actually consumes the constant. Without the consuming-side change that avoids resetting captured turn state on messages matching this marker, the race condition described in the PR remains unfixed by this change alone. Please confirm whether the collector logic is updated in a companion PR or planned follow-up.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/worker/src/agent-outcome-tools.ts, line 48:

<comment>The `TERMINAL_NUDGE_MARKER` is exported for collectors to recognize nudge messages, but no collector or event-stream code in this repository actually consumes the constant. Without the consuming-side change that avoids resetting captured turn state on messages matching this marker, the race condition described in the PR remains unfixed by this change alone. Please confirm whether the collector logic is updated in a companion PR or planned follow-up.</comment>

<file context>
@@ -41,6 +41,13 @@ export type OutcomeToolDefinition = {
+// collectors can recognize the nudge in a session's user.message stream and
+// treat it as a poke (never a turn reset): a nudge that lands milliseconds
+// after the model's own terminal call must not invalidate that call.
+export const TERMINAL_NUDGE_MARKER =
+  "You ended your turn without calling a terminal outcome tool";
+
</file context>
Fix with 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.

1 participant