Skip to content

fix: deduplicate project and global prompt guidance - #1245

Open
1jehuang wants to merge 2 commits into
masterfrom
fix/issue-1240-prompt-dedup
Open

fix: deduplicate project and global prompt guidance#1245
1jehuang wants to merge 2 commits into
masterfrom
fix/issue-1240-prompt-dedup

Conversation

@1jehuang

@1jehuang 1jehuang commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #1240.
Closes #1092.

  • Deduplicate project/global prompt overlays and preferred-tools guidance by canonical path, retaining the project heading and counting the content once.
  • Reuse the existing AGENTS.md canonical-path comparison. Distinct files, even with identical contents, remain separate.
  • Document the behavior and add coverage for matching paths, symlink aliases, distinct files, unreadable/missing project files, full/split prompt assembly, and character counts.

Verification

All verification below was rerun together on final commit cb2178be67f666c3e65e1907a871a8b3b687ac15: 37 prompt tests passed, all three native public-API integration cases passed, the CLI rebuilt successfully, and all four isolated CLI capture runs completed. The full base suite again reported 1,387 passed / 11 failed / 1 ignored, with the exact same 11 baseline failures.

  • Before the fix: matching-path and symlink regressions failed with duplicate content (2 occurrences instead of 1).
  • After the fix: all 37 prompt tests passed on Linux.
  • scripts/dev_cargo.sh build --profile selfdev -p jcode --bin jcode passed, as did the built binary's --version startup check.
  • Additional real CLI/daemon observation using isolated sockets and a local mock streaming endpoint: the installed pre-fix binary sent each overlay/tool marker twice, while the PR binary sent each once (2,028 → 1,852 system-message characters in the same fixture). Symlink aliases also sent each once. Distinct project/global files retained both copies for all three guidance layers. All four CLI turns completed with the expected reply. No external model or real credentials were used.
  • Native public-API integration acceptance also passed: scripts/dev_cargo.sh test --profile selfdev -p jcode-base --test prompt_guidance_integration -- --nocapture. It exercises actual HOME/cwd filesystem resolution and both public prompt builders in fresh processes, with no provider mock. Home, symlink-alias, and distinct-file cases passed all content, heading, and character-count assertions. The same integration test failed against unchanged upstream (2 copies instead of 1). The ignored child entry is explicitly executed by the parent for all three cases.
  • Formatting and git diff --check passed. Independent read-only review found no concerns.
  • Full jcode-base suite: 1,387 passed, 11 failed, 1 ignored. Unchanged upstream (37159430c) reproduced the exact same 11 auth/config/catalog failures (1,383 passed, 1 ignored). This PR does not claim a clean full suite.

Hosted CI status (2026-09-13 triage refresh)

The exact head cb2178be67f666c3e65e1907a871a8b3b687ac15 does not have passing hosted CI. CI run 34785842487, Windows smoke, and iOS runs fail before creating jobs because the inherited workflows contain duplicate top-level env mappings. The green linked-issue/review checks and CLEAN mergeability do not represent build/test success. Existing PR #1193 addresses the workflow parse defect but has separate failing quality/macOS/Ubuntu jobs. The local verification above remains the evidence for this patch. Hosted validation is still blocked.

Scoped branch based on master. Existing local changes and the shared daemon were left untouched.


— Jcode agent (automated triage), on behalf of @1jehuang

@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

No blocking issue was established; the reviewed implementation is suitable to merge.

What we checked:

  • A reproducible before/after validation wrapper for focused public prompt-guidance checks was prepared. T-Rex
  • The base-checkout run started in an isolated working directory and progressed toward compiling jcode-base, but did not complete due to the execution limit. T-Rex
  • The exact authored command wrapper trex-artifacts/prompt-guidance-validation.sh was identified and used for the run. T-Rex
  • The base-command output was captured in prompt-guidance-01-before.log, showing the wrapper and progress up to jcode-base but no test result before the execution limit. T-Rex

Summary

  • Canonical-path comparison prevents the same project and global guidance file from being added twice.
  • The change retains separate project and global guidance when they are distinct files, including when their contents match.
  • Documentation and focused coverage describe the expected path, symlink, and character-accounting behavior.

T-Rex validation blocked

  • The isolated base-checkout compilation did not finish before the execution limit, so the focused before/after runtime checks could not complete.

Reviews (1) · Last reviewed commit: "test: cover public prompt guidance accep..."

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System prompt loader double-loads global overlay files when cwd == $HOME Prompt overlay injected twice when working directory is $HOME

1 participant