Skip to content

feat(sheets): add +undo shortcut for AI-tool edits#1321

Open
zhengzhijiej-tech wants to merge 2 commits into
feat/lark-sheets-developfrom
feat-undo-last-zzj
Open

feat(sheets): add +undo shortcut for AI-tool edits#1321
zhengzhijiej-tech wants to merge 2 commits into
feat/lark-sheets-developfrom
feat-undo-last-zzj

Conversation

@zhengzhijiej-tech

Copy link
Copy Markdown
Collaborator

What

Add a token-scoped +undo shortcut that reverses recent sheet edits made through the sheet-ai write tools, by invoking the undo_last write tool.

  • +undo [--steps N | --op NAME]: undo the last N steps, or a named operation
  • Thread a session-stable transaction id (LARK_CLI_SHEET_TRANSACTION_ID) into the tool request's extra.transaction_id, so a group of edits and a later +undo share one server-side undo stack; omitted when unset to preserve per-request behavior
  • flag-defs + generated defs for the new shortcut

Why

Lets an agent driving lark-cli undo a group of AI-tool sheet edits in one call, rather than manually reconstructing prior state.

Notes

Depends on the backend undo_last write tool (byted-sheet) + facade registration (sheet-facade-agg). The backend reverse-changeset path is still being finalized; the CLI side here is self-contained and gated by the transaction-id env var.

Add a token-scoped +undo shortcut that reverses recent sheet edits made
through the sheet-ai write tools, by invoking the undo_last write tool.

- +undo [--steps N | --op NAME]: undo the last N steps, or a named op
- thread a session-stable transaction id (LARK_CLI_SHEET_TRANSACTION_ID)
  into the tool request's extra.transaction_id, so a group of edits and a
  later +undo share one server-side undo stack; omitted when unset to
  preserve per-request behavior
- flag-defs + generated defs for the new shortcut
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 39df81ad-65af-4923-8036-911e4e72c007

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-undo-last-zzj

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added domain/ccm PR touches the ccm domain size/M Single-domain feat or fix with limited business impact labels Jun 8, 2026
buildToolBody attached extra.transaction_id to every tool invocation,
including read tools (get_cell_ranges, get_range_as_csv, search_data,
get_workbook_structure, ...). A read scoped to a transaction id resolves
against that transaction's snapshot instead of the live document, so
reads returned blank cells whenever LARK_CLI_SHEET_TRANSACTION_ID was
set. Gate the extra block to ToolKindWrite — the undo stack only ever
concerns writes — by threading kind into buildToolBody at every call
site. Adds a regression test that read tools omit the transaction id.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant