Skip to content

sl pull mistakes an issue number for the pull-request number #1355

Open

Description

@omry

When a GitHub squash commit title contains both an issue reference and the appended pull-request number, Sapling selects the issue number as the pull request.

Example commit:

hydra-ecosystem/omegaconf@93023e7

Its title is:

Preserve ValueNode types in OmegaConf.masked_copy (#813) (#1308)

#813 is an issue. The actual pull request is #1308:

hydra-ecosystem/omegaconf#1308

Running:

$ sl pull
pulling from ssh://git@github.com/omry/omegaconf.git
warning: failed to read from Github for landed commits (RuntimeError('{
 "data": {
  "repository": {
   "pullRequest": null
  }
 },
 "errors": [
  {
   "type": "NOT_FOUND",
   "path": ["repository", "pullRequest"],
   "message": "Could not resolve to a PullRequest with the number of 813."
  }
 ]
}')), not marking commits as landed

The pull succeeds, but Sapling does not mark the corresponding local commits as landed.

Expected behavior:

sl pull should identify #1308 as the associated pull request and correctly mark the corresponding commits as landed.

Environment:

Sapling 0.2.20260317-201835+0234c21f

Related reports with the same top-level warning but different causes:

Activity

  1. hippi345 commented on Oct 15, 2026

    @hippi345

    I tried to reproduce this on current main (79071c2) and couldn't: the PR-number parser matches the last (#N) at the end of the title, so "Preserve ValueNode types in OmegaConf.masked_copy (#813) (#1308)" resolves to #1308. Which sl version were you on? The wrong number might come from an older release, or from GitHub's commit-to-PR association rather than the title.

  2. omry commented on Oct 15, 2026

    @omry
    Author

    Still reproducible, with a correction to the original diagnosis.

    In OmegaConf, the public squash commit 93023e78016f, titled Preserve ValueNode types in OmegaConf.masked_copy (#813) (#1308), correctly resolves to PR #1308.

    The failing lookup comes from local draft 95f38dc723ca, titled Preserve ValueNode types in OmegaConf.masked_copy (#813). It has no stored PR association, so Sapling interprets the issue reference as PR #813. GitHub rejects that lookup, and landed-commit cleanup aborts.

    More generally, I question treating commit titles as authoritative evidence of PR association. Here, (#813) referred to an issue, but Sapling interpreted it as a PR association and aborted landed-commit cleanup. The title alone did not establish that association.

    Verified using the parser and landed-commit hook from upstream Sapling HEAD 79071c2a3ea20c36ed71332608535e5801101bba, loaded into the installed Sapling runtime, against live GitHub. A complete HEAD binary was not built.

    The following minimal reproduction needs no existing OmegaConf checkout. Run it with the latest Sapling on PATH, plus Git and an authenticated GitHub CLI (gh auth login). It creates a temporary repository and performs a read-only GitHub lookup:

    #!/bin/sh
    set -eu
    
    export CHGDISABLE=1 SL_CONFIG_PATH=/dev/null HGRCPATH=/dev/null
    repro_dir=$(mktemp -d "${TMPDIR:-/tmp}/sapling-1355-minimal.XXXXXX")
    echo "Reproduction directory: $repro_dir"
    
    sl version
    sl init --git "$repro_dir/repo"
    
    cat > "$repro_dir/config" <<'EOF'
    [extensions]
    github =
    [paths]
    default = https://github.com/hydra-ecosystem/omegaconf.git
    [github]
    hide-landed-commits = true
    [ui]
    username = Repro <repro@example.com>
    EOF
    
    slr() {
        sl -R "$repro_dir/repo" --configfile "$repro_dir/config" "$@"
    }
    
    printf 'repro\n' > "$repro_dir/repo/repro.txt"
    slr add "$repro_dir/repo/repro.txt"
    slr commit -m 'Preserve ValueNode types in OmegaConf.masked_copy (#813)'
    slr log -r . -T 'Inferred PR: {github_pull_request_number}\n'
    slr debugprmarker --dry-run

    Actual result: Inferred PR: 813, followed by the warning containing:

    Could not resolve to a PullRequest with the number of 813.
    

    debugprmarker exits 0 despite the warning; the output demonstrates the failure.

    Expected: an issue reference in a draft title should not be treated as a PR association or cause landed-commit cleanup to abort.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions