[Bug] kimi -p /goal exits 0 while the goal is still active

Abierto Apto para principiantes
#5,062 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
cli

Línea de trabajo

Empieza con goalExitCode en apps/kimi-code/src/cli/goal-prompt.ts y sus pruebas en apps/kimi-code/test/cli/goal-prompt.test.ts. Comprueba cómo debe corresponder active a los códigos de salida documentados en docs/en/guides/interaction.md y luego ejecuta pnpm -C apps/kimi-code exec vitest run test/cli/goal-prompt.test.ts. La tarea estará completa cuando un objetivo activo termine con un estado distinto de cero y el comportamiento esté cubierto por una prueba que pase.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What version of Kimi Code is running?

2.6.3 (source main snapshot, 2026-11-18). Confirmed with a unit test.

Which open platform/subscription were you using?

None involved.

Which model were you using?

None involved.

What platform is your computer?

Windows 11 x64.

What issue are you seeing?

kimi -p "/goal ..." can exit with status 0 while the goal is still active.

When the goal does not reach a terminal state before print_wait_ceiling_s, applyPrintBackgroundPolicy warns print goal wait ceiling reached and returns. runNativeGoalTurn then calls goalExitCode('active'), which falls through to the default and returns 0. CI therefore sees success for an incomplete goal.

What steps can reproduce the bug?
  1. Run a goal that will not finish quickly:

    kimi -p "/goal <long-running objective>"
    
  2. Set a small print_wait_ceiling_s, or let the default ceiling expire.

  3. Observe the print goal wait ceiling reached warning.

  4. The process exits 0, and the goal summary still has status: active.

A unit-level reproduction is:

expect(goalExitCode('active')).toBe(GOAL_EXIT_CODES.complete); // currently passes, but is wrong

Running:

pnpm -C apps/kimi-code exec vitest run test/cli/goal-prompt.test.ts

with:

it('does not report success for an active goal', () => {
  expect(goalExitCode('active')).not.toBe(GOAL_EXIT_CODES.complete);
});

fails with expected +0 not to be +0.

What is the expected behavior?

A non-terminal goal should not exit with the success code. The docs currently define 0 for complete, 3 for blocked, and 6 for paused. active should either map to a non-zero code (for example paused, or a new incomplete code) or the process should keep waiting until the goal reaches a terminal state.

Additional information

Relevant code:

  • apps/kimi-code/src/cli/goal-prompt.ts — GOAL_EXIT_CODES / goalExitCode
  • apps/kimi-code/src/cli/v2/run-v2-print.ts — goal wait ceiling and exit-code assignment
  • packages/agent-core-v2/src/features/goal/goalOps.ts — active is a valid non-terminal status

The documented exit-code contract is in docs/en/guides/interaction.md (0 complete, 3 blocked, 6 paused), and the changelog for #1704 says kimi -p "/goal ..." stays alive until the goal reaches a terminal state.

Contribution
  • I am willing to submit a PR for this bug fix myself. I will wait for a maintainer's /approve in this issue before opening the PR.
Lenguaje dominante
TypeScript
Estrellas
8.3k
Forks
1.4k
Merge medio
12 h 6 min
PR fusionados (30 d)
596

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MoonshotAI/kimi-code

Todos los issues de MoonshotAI/kimi-code

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.