Skip to content

feat: adjust agent timeout hint output conditions#1328

Merged
JackZhao10086 merged 1 commit into
mainfrom
feat/auth_hint_opt
Jun 9, 2026
Merged

feat: adjust agent timeout hint output conditions#1328
JackZhao10086 merged 1 commit into
mainfrom
feat/auth_hint_opt

Conversation

@JackZhao10086

@JackZhao10086 JackZhao10086 commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improve auth login output behavior so AI-agent-specific authorization guidance is shown only when it is useful for agent or non-interactive environments, while keeping the interactive terminal experience cleaner for human users.

Changes

  • Show AgentTimeoutHint only for non-TTY text login flows, while preserving agent_hint in JSON output for structured agent consumption.
  • Add temporary diagnostic output for auth login text flows to print the parent process name and terminal detection result, helping verify agent-vs-human execution environments.

Test Plan

  • Unit tests pass: go test ./cmd/auth/ -run "TestAgentTimeoutHint|TestLogin" -count=1
  • Manual local verification confirms the lark-cli auth login --domain calendar flow prints the authorization URL, AgentTimeoutHint, and diagnostic info in the current agent environment.

Related Issues

  • None

Summary by CodeRabbit

  • Bug Fixes
    • Improved timeout hint behavior in the auth login command for device flow. Hints are now displayed contextually: shown in non-interactive (piped) environments and in JSON output, while suppressed in interactive terminal sessions for cleaner output.

@JackZhao10086 JackZhao10086 requested a review from MaxHuang22 June 8, 2026 11:51
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 643e18dd-e5e5-4079-be3a-46272d5b5cd8

📥 Commits

Reviewing files that changed from the base of the PR and between d0a896c and 12e4f90.

📒 Files selected for processing (1)
  • cmd/auth/login.go

📝 Walkthrough

Walkthrough

This PR adjusts device-flow hint output behavior in auth login. The AgentTimeoutHint is now printed to stderr conditionally: in text mode only for non-TTY environments, and skipped in JSON mode or when running interactively. The same rule applies to both the initial device authorization and --device-code resume paths.

Changes

Device-flow agent timeout hint output

Layer / File(s) Summary
Hint output suppression for TTY environments
cmd/auth/login.go
Comments clarified to document that text-mode hints are emitted only in non-TTY/piped environments. Initial device authorization flow and --device-code polling path both now suppress hint printing when running on interactive terminals, printing the hint only for non-terminal harness or piped environments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • larksuite/cli#1088: Modifies agent/device-flow "hint" behavior representation/output during the login polling flow.
  • larksuite/cli#968: Adjusts device-flow "agent timeout" hint behavior content to instruct QR-code generation via auth qrcode command.
  • larksuite/cli#933: Updates device-flow "agent timeout" hint guidance including the --device-code poll path messaging and test expectations.

Suggested labels

size/M

Suggested reviewers

  • albertnusouo
  • liangshuo-1

Poem

🐰 A hint grows quiet on terminals bright,
Yet whispers through pipes in the dark of the night,
JSON keeps secrets, TTY stays mute,
Device flows run cleaner, a polished pursuit! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adjusting the conditions for when the agent timeout hint is output in the auth login flow.
Description check ✅ Passed The description follows the required template with all sections completed: Summary clearly explains the motivation, Changes lists the main modifications, Test Plan includes test execution details, and Related Issues is addressed.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/auth_hint_opt

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 the size/L Large or sensitive change across domains or core paths label Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@12e4f90fcbc678e033d7fa64964f96c87467bd25

🧩 Skill update

npx skills add larksuite/cli#feat/auth_hint_opt -y -g

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.47%. Comparing base (ee5113f) to head (12e4f90).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1328      +/-   ##
==========================================
+ Coverage   71.42%   71.47%   +0.05%     
==========================================
  Files         688      688              
  Lines       65384    65483      +99     
==========================================
+ Hits        46703    46807     +104     
+ Misses      15035    15031       -4     
+ Partials     3646     3645       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JackZhao10086 JackZhao10086 merged commit 00d45f8 into main Jun 9, 2026
21 checks passed
@JackZhao10086 JackZhao10086 deleted the feat/auth_hint_opt branch June 9, 2026 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants