Skip to content

fix(agent-core): allow skill questions in auto mode#925

Open
tt-a1i wants to merge 1 commit into
MoonshotAI:mainfrom
tt-a1i:fix/skill-questions-auto-mode
Open

fix(agent-core): allow skill questions in auto mode#925
tt-a1i wants to merge 1 commit into
MoonshotAI:mainfrom
tt-a1i:fix/skill-questions-auto-mode

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Jun 20, 2026

Copy link
Copy Markdown

Summary

Fixes #824.

Auto permission mode still blocks normal AskUserQuestion calls, but loaded skills can now ask clarifying questions when the current request comes from a skill activation.

The policy now looks at the most recent non-internal user request:

  • regular user request -> keep blocking AskUserQuestion in auto mode
  • loaded skill request -> let AskUserQuestion through so it reaches the question UI
  • internal reminders/retries/compaction messages do not change that decision

Also updates the auto-mode reminder text and adds a changeset for the CLI-visible behavior fix.

Validation

  • pnpm --filter @moonshot-ai/agent-core exec vitest run test/agent/permission.test.ts
  • pnpm --filter @moonshot-ai/agent-core exec vitest run test/agent/tool.test.ts
  • pnpm --filter @moonshot-ai/agent-core run test
  • pnpm --filter @moonshot-ai/agent-core run typecheck
  • pnpm exec oxlint --type-aware packages/agent-core/src/agent/permission/policies/auto-mode-ask-user-question-deny.ts packages/agent-core/src/agent/injection/permission-mode.ts packages/agent-core/test/agent/permission.test.ts packages/agent-core/test/agent/tool.test.ts --quiet
  • pnpm --filter @moonshot-ai/agent-core run build
  • git diff --check

Checklist

  • Tests updated
  • Changeset added

AI Assistance Disclosure

I used Codex to review the changes, sanity-check the implementation against existing patterns, and help spot potential edge cases.

@changeset-bot

changeset-bot Bot commented Jun 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b0f7284

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tt-a1i tt-a1i marked this pull request as ready for review June 20, 2026 04:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0f72842a1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

evaluate(context: PermissionPolicyContext): PermissionPolicyResult | undefined {
if (this.agent.permission.mode !== 'auto') return;
if (context.toolCall.name !== 'AskUserQuestion') return;
if (currentRequestIsLoadedSkill(this.agent.context?.history ?? [])) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve skill context after compaction

When auto/full compaction runs during a long skill-triggered turn, ContextMemory.applyCompaction() replaces the compacted prefix, including the original skill_activation user message, with an assistant compaction_summary. This policy then scans history for the latest non-internal user message and can no longer see that the current request came from a loaded skill, so subsequent AskUserQuestion calls from that same skill are denied again in auto mode. Please persist the active skill/request origin outside compactable history or teach the compaction summary path to preserve it.

Useful? React with 👍 / 👎.

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.

auto模式下未能区分普通权限ask和由技能发起的ask

1 participant