Skip to content

test(external-agent): cover direct-touch lease refresh - #79

Merged
0xsline merged 1 commit into
0xsline:mainfrom
Lenouw:fix/editor-lease-touch-refresh
Aug 15, 2026
Merged

test(external-agent): cover direct-touch lease refresh#79
0xsline merged 1 commit into
0xsline:mainfrom
Lenouw:fix/editor-lease-touch-refresh

Conversation

@Lenouw

@Lenouw Lenouw commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Reworked after c6d1c1d. This PR originally carried the same lastSeen fix, submitted about half an hour after c6d1c1d landed it upstream — we found the bug independently through the MCP deadlock it causes (begin_edit_session → "No OpenChatCut editor is connected" while target_project's offline fallback stays blocked, the symptom reported in #63). The fix being upstream now, this PR keeps the part c6d1c1d does not have: test coverage for the direct-touch path, plus a tiny formatting restore.

What this adds

A direct-touch scenario in broker-poll-refresh.verify.ts. The existing scenario exercises the lease refresh through nextEditorCall's wait loop. Bridge routes also touch the editor outside that loop (poll entry, tool settle); this scenario pins the lease semantics on touchEditor itself: register → touch at +30s → editor must still be connected at +60s. If a future refactor moves the lastSeen refresh back out of touch(), this fails even when the long-poll path happens to compensate.

Brace indent restore. c6d1c1d left touch()'s closing brace at column zero; restored to the surrounding two-space style.

Verification

  • tsx server/external-agent/broker-poll-refresh.verify.ts → ok (both scenarios)
  • tsx server/external-agent/broker.verify.ts → passes
  • oxlint on touched files → clean

One observation from the original investigation, in case it is useful: run-affected-verifies reports no affected verifies when only broker-registry.ts or broker-poll-refresh.verify.ts change, which is how #70's failing guard could slip through a PR run. Happy to look at wiring those files into the affected map in a follow-up if you want.

🤖 Generated with Claude Code

c6d1c1d fixed registry.touch() to refresh lastSeen, which the long-poll
scenario in broker-poll-refresh.verify.ts exercises through nextEditorCall.
Add a direct-touch scenario so bridge-route touches outside the wait loop
(poll entry, tool settle) keep the online lease covered on their own:
register, touch at +30s, editor must still be connected at +60s.

Also restores the two-space indent of touch()'s closing brace that c6d1c1d
left at column zero.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Lenouw
Lenouw force-pushed the fix/editor-lease-touch-refresh branch from 480791d to 6aac560 Compare August 14, 2026 11:59
@Lenouw Lenouw changed the title fix(external-agent): refresh editor online lease in registry touch test(external-agent): cover direct-touch lease refresh Aug 14, 2026
@0xsline
0xsline merged commit d16bc20 into 0xsline:main Aug 15, 2026
1 check passed
guifeh pushed a commit to guifeh/OpenChatCut that referenced this pull request Sep 11, 2026
c6d1c1d fixed registry.touch() to refresh lastSeen, which the long-poll
scenario in broker-poll-refresh.verify.ts exercises through nextEditorCall.
Add a direct-touch scenario so bridge-route touches outside the wait loop
(poll entry, tool settle) keep the online lease covered on their own:
register, touch at +30s, editor must still be connected at +60s.

Also restores the two-space indent of touch()'s closing brace that c6d1c1d
left at column zero.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

2 participants