Skip to content

test(cosh-ng): [shell] route bare CJK after Insight - #3154

Draft
zhoukailong wants to merge 1 commit into
agentic-os-org:mainfrom
zhoukailong:test/3055-zsh-insight-cjk-routing-regression
Draft

zhoukailong wants to merge 1 commit into
agentic-os-org:mainfrom
zhoukailong:test/3055-zsh-insight-cjk-routing-regression

Conversation

@zhoukailong

Copy link
Copy Markdown
Collaborator

Why

GitHub issue #3055 reports intermittent loss of Agent routing for bare CJK natural-language prompts. The issue's observation matrix shows the sequence "failed command shows Insight, then 测试 and 继续测试" currently passes on main, but no existing test covers the combined sequence (real Insight → two consecutive bare CJK prompts → both reach the Agent) in a default Zsh session. This PR is a partial slice: regression test for the first acceptance item only — it locks in known-good default behavior and does not attempt to fix the intermittent incident or implement the diagnostic proposal.

What changed

  • src/cosh-ng/crates/cosh-shell/tests/raw_cli/failed_command.rs: append one #[test], raw_cli_zsh_insight_keeps_bare_cjk_natural_language_routing_to_agent (+63 lines, test-only).
  • The test drives cosh-shell raw fake --shell zsh through the existing zero-sleep, marker-gated harness with an isolated HOME and a fake make that fails with exit code 2: wait for prompt → make all → wait for the real Insight line → submit 测试 → wait for Received shell prompt request: 测试 → submit 继续测试 → wait for its request line → exit.
  • Assertions: the Insight text appears before both distinct Received shell prompt request: lines (emitted by the fake adapter when the Agent receives the request — terminal echo cannot forge them), no command not found output, and clean child exit (harness status assertion).
  • No production (src/) code, public API, or documentation changes.

Related issue

Refs #3055 (partial slice — first acceptance item only; does not close the issue)

User / Agent impact

None. Test-only addition; no runtime behavior change.

Risk and compatibility

  • Public CLI, API, configuration, or documented behavior changed
  • Privileged or security-sensitive behavior changed
  • Cross-component contract changed
  • Migration or rollback guidance is needed

Low risk: pure test append in an existing integration test file.

Validation

Environment: Linux x86_64, Rust 1.96.0, base 80301fb9e4a9fa047f95e8c943b1db1884c0b9af.

  • cargo fmt --all -- --check → exit 0.
  • cargo clippy --locked -p cosh-shell --test raw_cli -- -D warnings → exit 0, no warnings.
  • cargo test --locked -p cosh-shell --test raw_cli failed_command::raw_cli_build_failure_respects_analysis_mode_matrix -- --exact → 1 matched, 1 passed (real execution).
  • cargo test --locked -p cosh-shell --test raw_cli failed_command::raw_cli_natural_language_after_failure_does_not_bind_generic_failure -- --exact → 1 matched, 1 passed (real execution).
  • New test and the two zsh-adjacent tests (agent_input::raw_cli_zsh_shell_arg_intercepts_fragmented_natural_language, failed_command::raw_cli_zsh_generic_failure_restores_prompt_without_insight): compile and run, but the local runtime has no zsh, so each exits through the existing availability guard ("zsh unavailable; mandatory coverage runs in the amd64 Anolis gate") — recorded as env-blocked, not counted as passed. The authoritative zsh execution evidence is the CI amd64 Anolis gate.
  • macOS: not tested.

Documentation and rollback

No documentation changes. Rollback: revert the single commit (pure test addition, no production coupling).

Add a raw_cli regression test for the first acceptance item of agentic-os-org#3055:
in a default (smart mode) Zsh session, a fake `make` build failure
surfaces a real Insight, and the two consecutive bare CJK prompts
submitted afterwards must still route to the Agent.

The marker-gated harness drives `raw fake --shell zsh` with zero
sleeps: wait for the prompt, run `make all`, wait for the Insight
line, then submit the two distinct CJK prompts. Assertions verify the
Insight text precedes both distinct `Received shell prompt request:`
lines emitted by the fake adapter (terminal echo cannot forge these),
that no `command not found` appears, and the child exits cleanly via
the harness status assertion. The existing zsh availability guard
defers mandatory coverage to the amd64 Anolis gate.

Refs agentic-os-org#3055

Assisted-by: Codex:0.152.1
Signed-off-by: OmniSolve <324835893+zhoukailong@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant