Skip to content

feat: steer an active conversation without starting another run - #201152

Closed
vincentkoc wants to merge 3 commits into
mainfrom
feat/session-steer-reconciled-20261118
Closed

vincentkoc wants to merge 3 commits into
mainfrom
feat/session-steer-reconciled-20261118

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Related: #201073, #201074, #201075, #201076 (merged prerequisites).

What Problem This Solves

An authorized person needs to correct a running conversation without accidentally starting another turn or sending the correction to a replacement run. This adds a host-only operation that targets the exact active run and reports whether delivery was accepted, rejected, or uncertain.

User Impact

User impact: host integrations can submit literal human text to an existing run using current session write access. Idle, replaced, unsupported, or unauthorized targets do not start a run, queue a follow-up, or interrupt another run. A leading slash remains text, not a command.

This is host-only: it does not add a UI, remote-writer authentication, or write access for Session Share readers. No configuration change or migration is required. Live native/model delivery and remote-writer E2E have not been exercised; the evidence below is deterministic host-boundary and persistence proof, not live-provider proof.

Why This Change Was Made

sessions.steerActive reuses the existing chat admission, injection, and retained-input owners. It binds the authenticated person, physical session, target run, and request before delivery. A retry reconciles the original input and never injects a retained active-only input again, including after restart or uncertain acceptance.

Message-hook redaction is preserved: original-text comparison uses the existing keyed fingerprint, not a retained raw-text copy or unkeyed digest. Without a fingerprint, reconciliation requires proof that retained text was unchanged and an exact match; otherwise it fails closed. Current authorization is checked again during reconciliation.

The payload is limited to this operation and its lifecycle, schema, documentation, and regression coverage. Reconciliation preserves upstream requester-device attribution and queue cancellation causes. Production code grows by 477 additions / 24 deletions; tests by 735 / 1. Generated validators account for most of the remaining diff and were regenerated from the combined schemas.

Evidence

On the exact submitted tree:

  • 38 focused steering/comparison tests passed, including literal commands, exact-run targeting, authorization, retained retries, redaction, and no replay.
  • 46 ordinary-chat fingerprint/profile/custody regressions and 34 canonical pending-input owner tests passed.
  • Independent review reran 20 prior regressions, added 5 reconciliation-seam checks, and passed 25 compiled request-predicate checks. It found no blocking P0–P2 issue.
  • Scoped types, lint (32 files), formatting (37 files), and pnpm build passed. Build stamps identify the submitted head with clean inputs.
  • Formal AutoReview reported no P0–P2 finding within its diff-only scope. This used Claude because Codex was unavailable; local ClawSweeper setup was blocked. Neither is claimed as a successful ClawSweeper run.

Seven UI bundle-size warnings remain from the full build; they were not attributed to this change. A known nonblocking wording issue remains: generic retry errors can suggest a new message ID, but callers of this operation must reconcile the original key rather than resend uncertain delivery under a new one.

Exact source and validation boundaries
  • Head: 7212c852a580d89a38384c8587e7141ab345d1f5
  • Tree: 4a04f24c7f46f74df16e66ccc7560a4822d40757
  • Reviewed base: e783f4de7f399133faf439bf358adb331eab8371
  • The three steering commits were replayed onto that base; all four prerequisite merges are ancestors. Later main changes are not silently rebased into this reviewed source.
  • Full build: exit 0 in 446 seconds. Retained warnings concern largest JS/CSS gzip size, total CSS size, and chat/new-conversation boot budgets.
  • The independent seam checks exercise requester-device attribution and cancellation of retained active-only rows. Predicate checks reject missing, empty, wrong-type, and unexpected authority/fallback/attachment fields.
  • No live runtime configuration, credentials, Talk behavior, or deployment was changed. Publication does not imply merge approval.

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling labels Nov 18, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 18, 2026 11:11
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 7212c852a580d89a38384c8587e7141ab345d1f5
  • Maintainer: @vincentkoc
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/methods/core-descriptors.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-method-policy.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/shared/session-method-scopes-base.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 18, 2026
@clawsweeper

clawsweeper Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Adds sessions.steerActive to send literal human text to one active run without starting or queuing another turn.

Example: An authenticated person sends “Use the staging database” to session research-42, targeting run native-run-7.

  • Before: Existing send paths can fall back to another turn when steering is unavailable.
  • After: The request targets only native-run-7 and returns accepted, rejected, indeterminate, or in_flight without dispatching a successor.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The feature has a coherent owner boundary, but required runtime proof is absent and actionable retry and conformance defects remain.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: An authorized person needs to correct a running conversation without the correction starting another turn or reaching a replacement run.
Reason: The maintainer-authored direction adds a distinct host contract while preserving ordinary send behavior and existing authorization owners.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: this maintainer-authored PR adds a useful exact-run operation, but unsafe retry guidance and a diff-caused conformance failure need correction.

Priority: P2
Reviewed head: 7212c852a580d89a38384c8587e7141ab345d1f5

Before merge

  • Keep active-steer recovery errors on the original idempotency key (P2) - After an accepted steer is hook-redacted and the keyed fingerprint is unavailable, clearing RAM dedupe and retrying the original request reaches this new unverifiable branch. resolveChatSendRequestConflict turns it into chatSendRequestConflictError, whose message says the previous mention selections cannot be verified and instructs the caller to use a new message ID. Following that instruction while the target remains active admits the correction again, defeating the operation's no-replay recovery contract. Return operation-specific guidance that preserves the original key and explains that delivery cannot be established safely.
  • Reconcile the source-read conformance tests with completion lookup (P2) - The unconditional completion fetch adds a SQL statement to ordinary retained-input reads, but the existing portability consumer still requires 6 statements for pending sources and 9 for committed sources. Exact-head CI fails both cases with 7 and 10 respectively in pending-input-source.conformance.test.ts:246. Either restrict or combine the completion read so the existing contract holds, or update that consumer with a justified bounded budget and coverage of the returned completion; the changed shared read path currently leaves its conformance suite failing.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Keep active-steer recovery errors on the original idempotency key — src/gateway/server-methods/chat-send-retry-comparison.ts:139-141
  • [P2] Reconcile the source-read conformance tests with completion lookup — src/config/sessions/session-pending-input-source.kernel.ts:180-181

Tests

  • Missing end-to-end proof: Provide redacted running-Gateway evidence of exact-run native delivery and same-key reconciliation without a successor turn, plus a latest-stable upgrade retaining existing session data; baseline regression execution is not shown.
Agent review details

How this fits together

The Gateway authenticates the person, applies session write policy, and passes the request through existing chat admission, native injection, and pending-input owners to return a retained delivery outcome.

flowchart TD
  A[Authenticated person] --> B[Gateway session write policy]
  B --> C[Active steering RPC]
  C --> D[Chat admission]
  D --> E[Captured active backend]
  D --> F[Pending input storage]
  E --> G[Delivery outcome]
  F --> G
Loading

Technical review

Best possible solution:

Keep the new operation on the existing admission, injection, and storage owners while correcting retry instructions and reconciling the source-read conformance contract.

Do we have a high-confidence way to reproduce the issue?

Source and the committed redaction scenario establish the unsafe retry-message path; exact-head CI independently establishes the source-read conformance failure, and no target code was executed during this review.

Is this the best way to solve the issue?

Reusing existing chat admission, opaque backend targeting, and retained-input custody is appropriate; a separate dispatcher or storage owner is unnecessary.

Full review comments:

  • [P2] Keep active-steer recovery errors on the original idempotency key — src/gateway/server-methods/chat-send-retry-comparison.ts:139-141
    After an accepted steer is hook-redacted and the keyed fingerprint is unavailable, clearing RAM dedupe and retrying the original request reaches this new unverifiable branch. resolveChatSendRequestConflict turns it into chatSendRequestConflictError, whose message says the previous mention selections cannot be verified and instructs the caller to use a new message ID. Following that instruction while the target remains active admits the correction again, defeating the operation's no-replay recovery contract. Return operation-specific guidance that preserves the original key and explains that delivery cannot be established safely.
    Confidence: 0.99
  • [P2] Reconcile the source-read conformance tests with completion lookup — src/config/sessions/session-pending-input-source.kernel.ts:180-181
    The unconditional completion fetch adds a SQL statement to ordinary retained-input reads, but the existing portability consumer still requires 6 statements for pending sources and 9 for committed sources. Exact-head CI fails both cases with 7 and 10 respectively in pending-input-source.conformance.test.ts:246. Either restrict or combine the completion read so the existing contract holds, or update that consumer with a justified bounded budget and coverage of the returned completion; the changed shared read path currently leaves its conformance suite failing.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e25ad96fb3d6.

Provenance checked

  • Exact backend targeting and fallback changes intended behavior with a stated reason (fa9626c: Capture an opaque operation and native run identity before asynchronous preparation; ordinary definite rejection may dispatch a follow-up.)
  • Worker-owned submitted-source reads keeps the original intent (5e1ffe9: Read bounded submitted bytes through the existing history worker while keeping replay authority with the current host owner.)
  • Final completion cleanup changes intended behavior with a stated reason (7a168d3: Record terminal processing independently of visible replies and retire unconsumed custody on final completion.)
  • Redacted retry identity keeps the original intent (7a894c6: Use keyed request fingerprints to reject edited retries after restart without retaining original redacted text.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Introduced behavior and authority: The new handler requires a source-authenticated personal operator and session access authority, then reuses chat admission with a private activeSteer option; descriptor and scope registrations require session write access. (src/gateway/server-methods/sessions-steer-active.ts:25, 7212c852a580)
  • Distinct capability on current main: Fetched main retains sessions.send and interrupting sessions.steer; this PR adds the separate active-only contract. GitHub search for steerActive found only this PR. (src/gateway/server-methods/sessions-messaging.ts, e25ad96fb3d6)
  • Retry instruction contradicts no-replay contract: Keyless reconciliation of hook-transformed text returns unverifiable, which becomes the existing conflict message instructing callers to use a new message ID; the new documentation explicitly prohibits that recovery action. (src/gateway/server-methods/chat-send-retry-comparison.ts:139, 7212c852a580)
  • Diff-caused conformance failure: The added completion lookup executes for ordinary retained sources. Exact-head CI reports pending reads increasing from 6 to 7 SQL statements and committed reads from 9 to 10 in pending-input-source.conformance.test.ts. (src/config/sessions/session-pending-input-source.kernel.ts:180, 7212c852a580)
  • Proof and compatibility boundary: The complete PR body explicitly disclaims live native/model delivery; the RPC suite supplies queueMessage callbacks on a fixture backend. No latest-stable upgrade evidence covers the new activeSteer message metadata, outcome_json content, and retained source lifecycle. (src/gateway/server-methods/sessions-steer-active.test.ts:100, 7212c852a580)
  • Other CI attribution remains unresolved: Exact-head annotations also report an import-cycle guard failure, baseline guards, and a delayed catalog-source assertion. Full job logs redirect to a blocked storage host, so those failures are not assigned to the contributor as established patch defects. (7212c852a580)

PR surface

Source +482, Tests +734, Docs +36. Total +1252 across 37 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 32 2995 2513 +482
Tests 4 735 1 +734
Docs 1 36 0 +36
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 37 3766 2514 +1252

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: This is a scoped host integration feature with a concrete retry-recovery defect and no demonstrated urgent production regression.
  • add merge-risk: 🚨 message-delivery: The new operation can advise a new idempotency key after previously accepted delivery, allowing duplicate steering input.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a scoped host integration feature with a concrete retry-recovery defect and no demonstrated urgent production regression.
  • merge-risk: 🚨 message-delivery: The new operation can advise a new idempotency key after previously accepted delivery, allowing duplicate steering input.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 18, 2026, 6:29 AM ET / 11:29 UTC.

@vincentkoc

Copy link
Copy Markdown
Member Author

Closing as superseded by #202397.

#202397 carries this change rebased onto current main, with three differences: the operation is off unless gateway.sessionControl.steeringEnabled is true, and both findings from the review here are fixed (active-steer retries keep the original message ID; the completion lookup no longer adds a statement to ordinary retained-input reads). Review and proof continue there. The stacked #201173 will be replaced the same way once #202397 lands.

@vincentkoc vincentkoc closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant