Skip to content

Stop retrying rejected DSH continuations - #8857

Closed
loopx-agent wants to merge 3 commits into
mainfrom
codex/dsh-prestep-rejection
Closed

loopx-agent wants to merge 3 commits into
mainfrom
codex/dsh-prestep-rejection

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

  • A downstream pre-step listener can rewrite or discard a reserved LoopX continuation. Rejection previously triggered fresh automatic admission, restored orphaned host context, or parked an independently accepted human message until another native wake.
  • The Driver holds unaccompanied invalid continuations, excludes their original ID and source kind from inbox restoration, and keeps already-approved human input in the current step. A message already in either inbox keeps its original delivery. Cancelled and vetoed steps follow the native decision.
  • On both File and SQLite, the previous PR head recorded blocked with the independently accepted human message still pending. The final head recorded one native step, one committed human message and a completed Turn with the automatic reservation excluded. Related to #8563. Validation base is main at dfa6de7a6476e1b485d3f6874fa1a77d004bda93. Clean merge compatibility checked against f599a60ce64fd78db80d6318c84e3af58bfc1df9 after the Japanese documentation update.

Author Declaration

  • Written by: model_agent, OpenAI Codex (GPT-6).

Implemented against

Criterion Disposition Symbol / path Test or command
Exact reservation and authority checks before automatic work reaches a model step implemented src/driver.ts onPreStep, sameReservation Rewrite, removal, malformed source and original ID relabeled as user
Preserve independent input and existing native gates in mixed batches implemented onPreStep projects the downstream enter result and preserves its request-series marker Native same-step human acceptance, queued duplicate, explicit veto and host cancellation
Fresh evaluation after human input or explicit Driver recovery implemented Existing input and GoalBar Driver entry Native human re-entry, Driver bridge tests and packaged GoalBar smoke
  • Self-check before submission: compared persisted native step, Turn, inbox and guard results. The fixture uses a deterministic local model and counts accepted input from the Session events.

Scope And Continuation

  • A compact helper identifies step inputs outside the original continuation for both restoration and the downstream-approved decision. The inbox identity check serves both paths.
  • Mixed input encountered before downstream approval can still wait for a native wake. A normal Host completion before Todo binding still needs exact completion/guard correlation and owner-visible recovery in [Bug]: DSH admits completed but unclosed Turns indefinitely without recovery escalation #8563.

Validation

  • Tested revision: 422f60abb6fbbe56b5e16329eacfb56ad408f749. Previous-head contrast: 7ac93779c4171fbd62d8cd2a4824bb3a61785682.
  • Run state: finished.
  • Input classes: synthetic, public_fixture.
Check kind Result Public-safe evidence / limitation
regression_parity passed Five native cases on two providers and two revisions (20 executions) covered approved human input, same-ID relabeling, a message already in the inbox, downstream veto and Host cancellation. The first two cases advanced in the original step on the candidate. Every case excluded the automatic message and recorded zero quota debits.
regression_parity passed Six final-head native runs repeated the earlier fix's rewrite, context-only and malformed-source cases across both providers. Each held after one rejected attempt, cleared invalid/redundant input, and reached a fresh continuation after a human wake. The first commit's paired main baseline reproduced repeated admissions and malformed input replay.
real_backend passed Installed artifacts ran through the real LoopX CLI and isolated File and SQLite providers on macOS DSH 0.2.1-rc.2.
real_entrypoint passed Native Loader installation and real DSH Session/inbox, plus packaged GoalBar runtime smoke.
unit passed pnpm run test in packages/dsh-loopx-plugin passed 303 tests. Two same-step regression assertions fail on the previous PR head.
static passed Plugin typecheck and exact-head standard loopx canary premerge --from-git-diff --git-diff-base dfa6de7a6476e1b485d3f6874fa1a77d004bda93 passed four direct and sixteen selected executions. The catalog and risk profile include overlapping plugin checks. The earlier concurrent run timed out in both quality entries. The final run kept the same 120-second per-check limit and ran after the native matrix.
  • Coverage and gaps: native comparison used DSH 0.2.1-rc.2 and a local synthetic response. Hosted CI and independent review of the updated head are pending.

Frontend / Visual Evidence

  • UI impact: none.

Type of Change

  • Bug fix
  • Documentation update
  • Test update

LoopX Area

  • Host or runtime integration

Technical Direction

Shared-authority RFC fixture impact

N/A. The Driver uses the native pre-step decision and inbox.

Boundary Checklist

  • Public-safe source and validation summary.
  • Scoped DSH host integration changes.
  • RFC bilingual diff gate passed.
  • UI impact recorded.
  • DCO signed commits.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…ection

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审提交 422f60abb6fbbe56b5e16329eacfb56ad408f749,按不可变 merge base dfa6de7a6476e1b485d3f6874fa1a77d004bda93 对照。 复核时远端主干为 f599a60ce64fd78db80d6318c84e3af58bfc1df9,DSH Driver 代码与该 merge base 相同。

动机 / Motivation

在同一 DSH Session 中运行已启用的 LoopX continuation,同时使用下游 pre-step 监听器的操作者。
主干在预定消息被改写后可以反复重新准入。严格 source 解析失败的 Driver 消息也可能被当作普通输入恢复到 inbox。
在真实 DSH pre-step 改写已领取的 continuation,分别检查空 inbox、只有短暂宿主上下文,以及后来提交的真实用户消息。观察 guard 次数和送入下一步的类型。
前一提交的普通改写在 File 和 SQLite 上由主干三次 guard 降至一次,后续用户输入触发新准入。File 上候选会从后续步骤排除重新标识的坏 continuation。当前提交在真实 DSH File 上保留了下游已接受的用户消息、伴随 runtime-context 和 startsRequestSeries。只有暂存宿主上下文时,两库仍会连续准入。
本地使用 DSH 0.2.1-rc.2、真实 File/SQLite CLI 和合成监听器。观察点在模型开始前,现场配置与其它 DSH 版本待验。

改动思路 / Approach

沿用原 reservation、两次绑定核验与 Session 的错误暂停。把拒绝后的 inbox 恢复统一通过消息 source.kind,普通待办继续进入 DSH 后续输入。
原预约的内容、绑定和 quota 继续由 sameReservation 与 Driver 权威检查决定。已拒绝的候选批次只在含独立输入时恢复伴随上下文。

具体改动 / Changes

3 个文件新增 145 行、删除 44 行。按 packages/dsh-loopx-plugin/README.md 复核 exact-reservation-before-step、independent-input-restoration 和 rejected-continuation-hold。 主干契约 · 当前行为说明

关键代码讲解

  • isDriverMessage。用 source.kind 找出属于 Driver 的工作。错误 schema 或重新标识的消息仍经过预约校验。 来源分类
  • onPreStep。已领取消息在下游回调前后都有权威检查。下游改写会撤掉原预约。若回调已经允许真实用户输入,Driver 在当前 step 保留该输入和伴随消息,并按消息 ID 避免重复消费 inbox。 派发与拒绝
  • restoreCompetingMessages 与 onAgentStatus。恢复普通输入并去重。拒绝后的 idle 根据暂停位决定是否重新评估。 恢复分支 · idle 与用户接续

对主干的风险 / Risks

  • [P2] 暂存的宿主上下文会绕过拒绝后的暂停。 下游监听器改写 continuation,同时只暂存一条 runtime-context,并在 DSH 回到 idle 前撤回它。期间没有用户消息或独立工作。拒绝分支把原批次和 inbox 分开检查。restoreCompetingMessages 对纯上下文返回 false,inboxHasPending 却把待撤回的上下文算成工作。撤回后,onAgentStatus('idle') 看到空 inbox 和未设置的暂停标记,再次调用 guard。File 和 SQLite 的真实 DSH 基线与当前头都继续发出三个新 guard,测试在第三次封顶。三次均被拒绝,零模型 step、零扣额。前一提交的隔离对照只改此处判断,File 和 SQLite 均停在第一次,真正用户消息仍可接续。当前提交保留了同一判断。按 source.kind 判断 nextStep 和 nextTurn 中是否有独立输入,排除 isHostContextMessage 与 Driver 消息。用真实用户消息和显式 Start 验证接续。 返回边界
  • 当前提交在真实 DSH 的 File 路径保留了下游已接受的用户消息、伴随 runtime-context 和 startsRequestSeries。普通改写、再发用户消息以及坏来源的补充 A/B 来自前一提交。 已接受输入
  • 当前提交 303 项插件测试、TypeScript 和 quick premerge 通过。打包 GoalBar runtime smoke 在前一提交独立运行通过。更完整的 premerge 在前一提交出现质量与 GoalBar watch 超时,后续重跑在 pnpm 依赖状态检查处停止。 当次 DSH 主进程的两库反例独立于这组额外检查。

语义与 CI 对齐

保留现有 source.kind 和预约作为类型化来源。复验应把纯宿主上下文放在 pending inbox,先让下游改写并拒绝原请求,再撤回派生消息。每次读取真实新 guard 次数,并用真正用户输入复验恢复。

我的整体评价 / Verdict

请求更改。已验到原批次的分类和恢复生效。两个 inbox 队列的判断仍缺少相同的独立输入条件。 这处判断补齐后,普通拒绝能保持安静,独立输入仍可自然接续。

English verdict: REQUEST_CHANGES. On 422f60abb6fbbe56b5e16329eacfb56ad408f749, a transient host-context-only inbox bypasses the post-rejection hold and reissues admission without human input. File and SQLite reproduce the missed guard.

return { ...decision, messages: acceptedInputs }
}
const restoredWork = this.restoreCompetingMessages(agent, remaining)
if (!restoredWork && !inboxHasPending(agent.inbox)) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[P2] 暂存的宿主上下文会绕过拒绝后的暂停。 下游监听器改写 continuation,同时只暂存一条 runtime-context,并在 DSH 回到 idle 前撤回它。期间没有用户消息或独立工作。拒绝分支把原批次和 inbox 分开检查。restoreCompetingMessages 对纯上下文返回 false,inboxHasPending 却把待撤回的上下文算成工作。撤回后,onAgentStatus('idle') 看到空 inbox 和未设置的暂停标记,再次调用 guard。File 和 SQLite 的真实 DSH 基线与当前头都继续发出三个新 guard,测试在第三次封顶。三次均被拒绝,零模型 step、零扣额。前一提交的隔离对照只改此处判断,File 和 SQLite 均停在第一次,真正用户消息仍可接续。当前提交保留了同一判断。按 source.kind 判断 nextStep 和 nextTurn 中是否有独立输入,排除 isHostContextMessage 与 Driver 消息。用真实用户消息和显式 Start 验证接续。 当前契约

@mergify

mergify Bot commented Nov 17, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 17, 2026
@loopx-agent

Copy link
Copy Markdown
Collaborator Author

Closing this superseded branch cleanly: all commits from PR #8857 were integrated into PR #8879 (squash-merged onto main in 3d6fd2e0ce6cd82384b866f9aeaa377397701851) and independently verified at origin/main f15c705623 with LoopX 2.4.0 and dsh-loopx-plugin 0.1.1-beta.7 (quality, package, runtime DSH 0.2.2-rc.3, loopx-turn-dsh-e2e-smoke.py, loopx-turn-dsh-builtin-host-e2e-smoke.py, and 411 Python DSH/recovery tests passing). Follow-up pause/recovery regression lock-in is tracked in PR #8955. (This PR branch was superseded rather than directly merged.)

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

Labels

needs-rebase Mergify: the pull request has merge conflicts with its base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant