Repository navigation
Conversation
…me every setup step
…y for listed approvers
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 20, 2026, 8:55 AM ET / 12:55 UTC (Revision 7). ClawSweeper reviewWhat this changesAdds signed LINE approval cards, approver direct-message delivery, button handling, and outcome notices for exec, plugin, and OpenClaw-change requests. Merge readiness⛔ Blocked before merge - 9 items remain Keep open: this remains a useful, distinct LINE integration. Fresh real LINE evidence strengthens the contribution, but the prior upgrade finding and an unresolved authorization defect still block merge. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw pauses sensitive operations for approval through the Gateway. The LINE plugin presents those requests as cards and sends the tapping user's account identity and decision back to the Gateway. flowchart TD
A[Paused operation] --> B[Gateway approval request]
B --> C[LINE routing and approver policy]
C --> D[Signed card in approver DM]
D --> E[Webhook and actor checks]
E --> F[Gateway custody check]
F --> G[Recorded decision and operation outcome]
Decision needed
Why: The contributor has documented both paths and explicitly requested direction; introducing configuration or accepting changed permissions requires maintainer intent. Before merge
Findings
Agent review detailsSecurityNeeds attention: Signed callbacks and account binding are sound controls, but native authorization can degrade to command-only fallback before the final write. PR surfaceSource +898, Tests +1506, Docs +97. Total +2501 across 23 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the existing native approval SDK owner, make activation preserve existing approval rights unless maintainers approve an explicit migration, and enforce callback-specific live authority at the Gateway decision write. Do we have a high-confidence way to reproduce the issue? Yes, from source for the findings: existing forwarding plus a DM allowlist changes group authorization, and disabling native eligibility between the local tap check and Gateway resolution reaches the implicit fallback. These paths were traced, not executed. Is this the best way to solve the issue? Not yet: using the existing native approval SDK is appropriate, but automatic permission changes need an accepted upgrade policy and native authorization must survive the complete resolution path. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fcc927f58d02. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
LINE chats approved with typed /approve before native cards existed, and allowFrom is the DM allowlist before it names approvers. Report approvals as available on every LINE chat, restrict deciding to listed approvers only for approval kinds whose cards are on, and check a tap's authority against the config current when the decision is sent.
The card handler decides with the config its LINE account started with, while forwarding settings hot-reload. Turning forwarding on, or widening it, without a restart let the forwarder drop the text prompt for a chat no card would reach. Drop a forwarded prompt only when both the start config and the current config would draw the card.
… built Replies can carry postback buttons built from agent-authored content, and LINE returns postback data unchanged. Tag each card decision with an HMAC derived from the account's channel secret and ignore approval data without a valid tag. Also look up started accounts with the same id normalizer that records them, and log card and fallback delivery failures at error level.
… card tag across accounts Verify a tap's tag with the secret the webhook carrying it was verified with, draw no card without a channel secret, normalize the default account id on the forwarding lookup, and warn when a tap carries approval data no card built. Document that buttons stop working after a secret change until the restart re-sends pending approvals.
|
On the recommendation to keep typed Addendum: Gateway custody checks LINE's On P2 (forwarded prompts dropped while the native handler isn't running): this isn't LINE-specific. The forwarder asks every channel's suppressor using config alone, while the local prompt path already checks whether a native runtime is active. It's tracked separately in #148031. |
…t observable Forwarding cannot tell whether an account's card handler actually started, and the start-config record treated registration as readiness. Keep the forwarded text prompt for every target instead, so a failed or disabled handler never leaves a chat with neither a card nor the prompt. The local prompt still yields to the card through core's running-runtime hint.
…w that core checks the running handler
…ecret do to cards and prompts
…nClaw-change fallbacks off /approve
…d document who approves
|
The latest review (Revision 6, 1. Upgrade semantics for typed LINE has no approver list of its own. Cards take approvers from I see two ways forward:
If you prefer the second, I'll add the schema, docs and tests in this PR. 2. Custody when native authority ends while a tap is in flight This part isn't LINE-specific. Gateway custody reads only The fix I have in mind is a separate core change: carry the authorization source on the channel reviewer and have custody reject implicit authorization when the source is a native callback. That touches the gateway protocol schema and the generated Swift models, so I'd open an issue for the design first. Should that land before this PR, or is a tracked follow-up enough? Separately, the live suppression runs in the body used a local workaround for the ingress failure that #148548 fixes; current main fails every LINE turn before any approval can be raised. |
…ovals # Conflicts: # extensions/line/src/gateway.ts # extensions/line/src/outbound.ts
…rue alone turns cards on
|
This pull request has been automatically marked as stale due to inactivity. |
Related: #104521
What Problem This Solves
When an operator is asked in LINE to approve a command, they have to copy the approval ID out of a text prompt and type
/approve <id> <decision>back. Discord, Slack, Telegram, Matrix, and other channels give them a button instead.User Impact
Cards are added on top of what LINE does today; they never replace it.
/approveis now scoped to the LINE account (see "Typed/approvenow reaches the Gateway" below). Cards are on when forwarding issessionorbothinapprovals.exec/approvals.pluginand approvers are listed inchannels.line.allowFrom. Until then, a request raised from a LINE chat stays pending,/approve <id> <decision>from that chat decides it, and command authorization decides who may. Listing users inallowFromfor DM access does not restrict/approve.Uuser IDs written inchannels.line.allowFrom. Users admitted through pairing oraccessGroup:entries are not approvers. Every listed approver gets every card and outcome notice, and each is a push that counts against the monthly message quota./approveincluded. Some setups already forward approvals insessionmode and list DM users inallowFrom; upgrading turns cards on for them. Group members outsideallowFromthen lose typed/approvefor that type until they are listed./approvenow reaches the Gateway with the sender's LINE identity, whether or not cards are on. As on the other channels with approver authorization, it decides only exec and plugin requests that belong to that LINE account, meaning requests raised from it or forwarded to it. A request raised in the Control UI or on another channel is approved where it was raised; on main,/approvefrom LINE could decide it. Typed/approvenever handled OpenClaw-change approvals; those are decided with their card (fix(channels): make system-agent approval cards actionable #147152) or from the Control UI./approvecommand instead (for an OpenClaw-change approval, decide from the Control UI). Achannels.linechange, such as removing an approver, takes effect once active runs and replies finish.Why This Change Was Made
LINE already carries typed callback data through postbacks for
ask_user(#133421), so approval decisions can use the same transport instead of the text-only fallback. This change wires LINE into the existing approver-restricted native approval capability.Forwarded prompts. LINE uses the SDK's forwarding suppressor, which reports the origin chat and approver DMs as reached by a card or routed notice and every other target as not reached. Since #148228, core applies that answer only while a native approval runtime for the account is active, so a handler that failed to start or was never registered no longer takes the prompt away. After a forwarding change without a restart, the handler keeps its start configuration and can decline a request whose prompt core still suppresses. For a request raised from a LINE chat, core then reports the owner as unavailable and posts its
/approvenotice in that chat (live run below), so I did not add a per-request check in core: it would send the full prompt and an outcome notice next to that notice.Availability. Approval availability stays
enabledon every LINE chat. Adisabledstate makes the Gateway expire any request that no other client holds, which would take away the same-chat/approvethat LINE chats have on main. Approver authorization uses the same predicate as card delivery, soallowFromnarrows who decides only where cards are on. Elsewhere, LINE returns implicit same-chat authorization and command authorization keeps deciding, as before.Typed
/approvewhere cards are on. It is restricted to listed approvers too, rather than staying on command authorization while only card taps are restricted. Right before writing a decision, Gateway custody checks LINE'sauthorizeActorActionagainst the live config, for taps and typed/approvealike, and the hook cannot tell the two apart. If typed/approvestayed on command authorization, the hook would return same-chat authorization for every LINE sender. Custody would then stop checking the approver list at write time, and a tap from someone just removed or replaced as an approver could still be written. Keeping existing typed rights without that trade-off needs either maintainer acceptance of the upgrade restriction (the stepc2cbdea28cftook for other shipped channels) or an explicit opt-in setting, which is a new config key.Button tags. Each decision button on a card carries a tag derived from the sending account's channel secret. The key is derived under a fixed label, the way Mattermost derives its interaction secret from the bot token. A tap decides only when its tag verifies against the secret that verified the webhook carrying it. Postback data from any other button that merely reuses the approval parameters decides nothing: it is logged as a warning and answered with a fixed notice that repeats none of the data. Without a channel secret, no card is drawn and the approver gets the approval command text.
After a channel secret change, a tap on an earlier card decides nothing. It replies that the button could not be verified, and points to the Control UI, or to
/approvewith the ID shown on the card for exec and plugin approvals. Approvals still waiting are not sent again as new cards: each approval's route is chosen once, so a handler restarted with the new secret does not take over approvals raised before it started. A card or fallback text that fails to send is logged at error level, since it stands in for a prompt that native delivery suppressed.Card size. A Flex bubble LINE rejects takes the whole card away and leaves the approver with the command text, and an approval body carries a command, a working directory, and a host line that no single field owns. The builder therefore shrinks the body as one region until the bubble fits, keeping the approval ID in what it retains, instead of capping one field and hoping the rest fits (#135229 is the same platform limit hit from the reply path).
Tap authorization. A card tap decides only for a listed approver. It checks authority against the configuration current just before the decision is sent (after the lazy Gateway import, not when the tap arrived). It treats implicit same-chat authorization as "use
/approve", following the SDK rule for native callbacks indocs/plugins/sdk-channel-plugins/approvals.md. For an OpenClaw-change approval, which typed/approvecannot decide, that fallback, the Gateway-error fallback, and the text sent when a card cannot be drawn or sent point to the Control UI instead of a command that would fail.Remaining custody window. One window remains outside this PR. The Gateway's custody check re-reads live config but does not distinguish implicit same-chat authorization, so a tap already on its way to the Gateway when the last approver is removed could still be written. Custody cannot simply refuse same-chat authorization, because typed
/approvewithout approvers depends on it. The reviewer identity sent to the Gateway (channel, account, sender) also has no field that tells a typed command from a native button. Closing the window therefore needs a core change for every channel. In practice, removing an approver is achannels.linechange, and the Gateway does not publish it while runs and Gateway requests are active (live log below), up to its restart deferral timeout.LINE cannot edit sent messages, so the terminal state is published as a new message. A later tap on an old card replies that the approval is no longer waiting.
lineQuestionOutcomeNoticemoved frombot-handlers.tstoquestion-postback.tsto keepbot-handlers.tsunder the max-lines limit after the approval branch was added.Evidence
Live on a LINE test channel, with the Gateway built from this branch and a local model stand-in issuing an
exectool call (the test rig has no model credentials). The first two blocks run on the merge of this branch with current main, with nothing patched: the ingress failure that earlier runs had to work around locally is fixed on main by #148548. The blocks below them are from earlier heads and say so.Current head on plain main: one card instead of a prompt to retype, and today's behavior next to it
Each run is its own Gateway (own state dir and port), with injected signed webhook events from the operator's DM and real pushes. Two bounded observables: the channel's monthly push consumption, and a local diagnostic printed after each successful LINE send that names the message type.
With approvers listed (
approvals.execsession,allowFrom= operator), request raised in the approver's DM:[line-wire] push ok n=1 types=flex text="Exec Approval Required: date"✅ Exec approval deny. Resolved by cli. ID: e372af9b-…, thenexec finished. Output: Exec denied (…)line inbound:→embedded run tool start tool=exec→[line] received request e372af9b-…: the turn completes on plain main, and nothing else is pushed while the request waits. No forwarded text prompt.Same settings without a listed approver (
allowFrom: ["*"], so the approver set is empty and cards stay off), fresh state dir — this is what an install does today:[line-wire] push ok n=1 types=text text="🔒 Exec approval required\nID: 451100df-…\nCommand: date\nCWD: …"✅ Exec approval denied. Resolved by cli., thenexec finished. Output: …No
[line] received request: the card handler does not take that request. The message count is the same; the difference is that one is a button and the other is an ID to retype.Current head: signed card taps, and a decision attempted through the wrong account
Approvers are the operator only (
dmPolicy: "open",allowFrom: ["*", <operator>], so anyone may talk to the bot but only the operator may decide). The three postbacks use the card's encoding and a tag computed from the channel's real secret, which was never printed.Wrong account, on one Gateway carrying two LINE accounts (
defaultandwork, each listing the operator as its approver). The request belongs todefault; the tap arrives onworkwith a validworktag, so LINE's own check passes:Gateway custody refused a reviewer from an account the request does not belong to. Not covered live: an approver removed while a tap is already on its way to the Gateway (see the remaining window above); with custody reading only
authorized, the outcome of that race today is acceptance, not rejection.What the two look like in the chat (captures from dist 2862c1d)
One Gateway with two LINE accounts, both listing the operator as approver, with
approvals.execinsessionmode. Only the build changes between the two captures: first a build without LINE approvals, then dist2862c1d29c1. Each capture is cropped to the message, with the working directory redacted.dist 4f865fd: same-chat approval with cards off, and taps after an approver is removed
Injected webhook events from the operator's DM and real pushes, with quota consumption as the bounded observable. Postbacks below use that build's card encoding, which had no tag yet. On the current head a tap also needs the tag the card carries; the signed-tap run above checks that tag live.
Cards off (no
approvalsblock,allowFrom: [<operator>]), same-chat typed/approve:Cards on (
approvals.execsession,allowFrom: ["*", <operator>]), card delivered ([line] received request 2dc8424c-…, quota +1), thenallowFromedited to["*"]:After the removal was published, a request raised afterwards gets no card. The former approver's decision postback is therefore built with the card encoding and that request's ID, which is what a card from before the removal would send:
Main flow on an earlier head: a real tap on a card resolves the approval and the command runs
Webhook bodies came from the real LINE client, captured through the tunnel inspector.
Routing paths on earlier heads (injected webhook events, real pushes)
allowFrom: ["*"], DM origin: no card, text prompt only (quota +1); typed/approve … allow-onceresolves and the command runs.Tests:
pnpm exec vitest run --config test/vitest/vitest.extension-line.config.tspasses 75 files / 1118 tests. Bothtsgolanes,lint:extensions,oxfmt --check,check:assertion-safety,check:max-lines-ratchet, anddocs:check-mdxpass.I removed or rewrote each guard one at a time and confirmed that a named test fails for each:
/approve(the Control UI for OpenClaw-change); a sender who is not a listed approver is refused;/approvenarrows to listed approvers only for a type whose cards are on, and same-chat/approvestays available;Not live-verified:
allowFromusing typed/approvewhile cards are off. Unit tests cover it against the real capability.approvals.exec.targetswithmode: "both". Unit tests cover it./bashchat commands create approvals without a turn source and hold the conversation's ingress lane until they finish, so a card tap during/bashwaits for the stall watchdog. Model-driven exec does not have this limitation.Follow-ups outside this PR, in core for every channel:
buildExecMetadata, which never includes the question asked or the node the command would run on, although the forwarded text prompt this card replaces shows both. Every channel drawing an approval card is missing them the same way./approvecommands for them, and core's "could not deliver the native approval request" notice names/approve, but typed/approvedecides only exec and plugin approvals. When a LINE card cannot be drawn or sent for a request raised in the approver's own chat, that chat gets LINE's fallback (Control UI) and then core's notice (/approve).