Skip to content

gstack-learnings-search --cross-project hides current project observed learnings #1618

@jbetala7

Description

@jbetala7

Observed problem

gstack-learnings-search --cross-project can hide current-project learnings whose source is observed or inferred.

The cross-project trust gate currently decides whether a JSONL entry is from another project by checking whether the raw JSON line contains the current project slug:

const isCrossProject = !line.includes(slug) && process.env.GSTACK_SEARCH_CROSS === 'true';

Current-project learning records do not normally include the project slug in their JSON body, so when --cross-project is enabled they are misclassified as cross-project entries. Because observed/inferred entries have trusted:false, the trust gate then drops them.

Current behavior on upstream main

With a current project learning:

{"type":"pattern","key":"current-observed","insight":"current project only","confidence":8,"source":"observed","trusted":false}

and --cross-project --query current, the command prints nothing even though the current project has a matching learning.

A trusted user-stated entry from another project is still shown, which confirms the trust gate is active but is tagging the current file incorrectly.

Expected behavior

--cross-project should keep all matching learnings from the current project while applying the trust gate only to entries loaded from other project files.

Duplicate searches performed

I checked for open issues and PRs with these terms:

  • cross-project learnings
  • gstack-learnings-search cross-project trusted
  • current project learnings --cross-project
  • cross-project trust gate learnings
  • gstack-learnings-search --cross-project
  • bin/gstack-learnings-search

Closest open PR: #1514 touches learnings limits/resolvers, not the bin/gstack-learnings-search source tagging logic. I did not find an open issue or PR covering this behavior.

Candidate fix shape

Tag each line with whether it came from the current project's learnings file or an extra cross-project file before passing it to the Bun parser, then apply the trust gate only when the tag is cross-project. Add regression coverage for:

  • current-project observed learnings still showing under --cross-project
  • untrusted observed learnings from other projects staying hidden
  • trusted user-stated learnings from other projects still showing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions