Skip to content

feat(coding-agent): connect terminal sessions to Lark with mirrored approvals - #260

Open
xuxujo97-coder wants to merge 3 commits into
mainfrom
feat/lark-session-connect
Open

xuxujo97-coder wants to merge 3 commits into
mainfrom
feat/lark-session-connect

Conversation

@xuxujo97-coder

Copy link
Copy Markdown
Collaborator

Problem

An interactive terminal session cannot currently receive Lark messages or present its pending tool approvals in the same chat. Users must return to the terminal to continue work or approve a tool.

Changes

  • Add /connect, /connect lark, and /connect off through a built-in CLI extension, with device authorization, a complete QR/link fallback, and a separate connection status row.
  • Isolate registration, REST requests, WebSocket routing, attachment downloads, and approval tokens in @step-harness/lark-adapter. Pin the Lark SDK and QR dependencies.
  • Bind the first valid chat, route bounded text/image/file/post input into the existing session, and project assistant output and tool activity into updateable cards.
  • Add opt-in typed select/confirm mirroring. The first valid terminal or chat decision wins; cancellation, completion, and teardown invalidate remote tokens without changing permission policy.
  • Disconnect transport and remote approvals before sending a best-effort English disconnection card. Keep credentials in memory and remove owned temporary downloads on close.
  • Build the adapter before the coding-agent bundle and include its entrypoint in the test bootstrap's missing-output detection. Without these changes, fresh or partially built worktrees fail to bundle or load the CLI.

Behavior and compatibility

  • Connection is interactive-terminal-only and opt-in. Existing defaults, persisted sessions, and permission policy are unchanged; there is no daemon, second agent loop, or transcript store.
  • Remote input uses existing follow-up delivery without expanding prompt templates or executing remote slash commands. Ordinary messages are rejected during terminal dialogs or compaction; they are not deferred.
  • Only explicitly mirrorable select/confirm requests are exposed. Login, input, editor, and custom dialogs remain terminal-only. Oversized approvals remain terminal-only rather than being truncated.
  • Callback configuration requires the user to confirm card.action.trigger through the official launcher. Connecting does not prove callbacks are configured.
  • No reaction API calls are added. /connect off revokes remote access while leaving a pending local approval available.

Validation

  • pnpm install --frozen-lockfile --ignore-scripts: passed with the committed lockfile.
  • npm run check: passed; no formatter changes. Type, dependency, UI-layer, workspace, public-source, and secret-boundary checks passed.
  • TMPDIR=/tmp ./test.sh: passed on macOS / Node.js 24.18.0, including the automatic offline workspace build, script tests, TUI tests, adapter tests (35), coding-agent tests (4760 passed, 58 skipped), and CLI tests (725).
  • Existing provider/credential-dependent tests remain intentionally skipped by the isolated test environment; three script tests require unavailable PowerShell.
  • Local structure review: R1-R12 and O1 passed. The new adapter is registered with its dependency, testing, and lifecycle justification; no TUI or interactive host responsibilities were added.
  • git diff --cached --check: passed.

Limitations

  • Live device authorization, chat delivery, callback launcher permissions, and terminal/chat approval races have not been verified against a real Lark account. Callback setup previously produced a blank launcher page and still needs live acceptance.
  • Projection is bounded per-turn output, not complete transcript synchronization. Input during compaction is not queued.
  • Standalone platform binaries and live provider prompts were not smoke-tested. CI and maintainer review are pending.
  • On this macOS environment, the default long TMPDIR makes an existing tsx subprocess socket fail with EINVAL; the passing isolated run used TMPDIR=/tmp without weakening tests.

xuxujo97-coder and others added 2 commits October 19, 2026 17:59
Settle transport startup on readiness, initial failure, timeout or close instead of trusting the SDK start return. Retain message IDs throughout their eligibility window and bound future clock skew without evicting live IDs.

Cover startup cleanup, retries, late success, installed SDK behavior and redelivery boundaries with offline regressions.
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