Skip to content

🌿 feat: Accept Lane Git State and Pull Request Contract - #16792

Merged
berry-13 merged 1 commit into
devfrom
berry-13/lane-git-contract
Oct 5, 2026
Merged

berry-13 merged 1 commit into
devfrom
berry-13/lane-git-contract

Conversation

@berry-13

@berry-13 berry-13 commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Code workers can report the git branch and head commit of the lane a command ran in, but LibreChat rejected any execute_command result carrying an extra key, so the first worker to send it would have failed every command. This accepts an optional laneGit of { branch, head } on those results: a branch is null or 1 to 256 characters with no control characters, a head is null or 40 or 64 lowercase hex, and anything else invalidates the result as an unknown key already did. An absent key still means unknown, and null fields mean a detached lane or one with no commit yet.

It also adds the shared pieces the pull request chip needs: the TConversationPullRequest types, the GET /api/convos/:id/pull-request endpoint helper with its query key and service method, and an endpoints.agents.pullRequests config block. The block is off by default, the token is accepted only as an environment variable reference such as ${GITHUB_PULL_REQUEST_TOKEN}, and enabling it without one fails validation.

Nothing reads laneGit yet and nothing calls the endpoint, so behavior is unchanged. This is the first of three stacked pull requests; the next ones record the branch and serve the pull request, then show it in the chat header. It is safe to merge before the worker side: old workers never send the key. Related to LibreChat-AI/code-interpreter#311.

Type of change

  • Feature

Testing

Tested environments/configuration:

  • Database: none needed for these tests
  • Feature flags: none

Automated tests:

  • Added 20 tests under "lane git on command results" in packages/api/src/code/workspace.spec.ts. The three accept cases failed before the validator change with Workspace tool request invalid and pass now. The reject cases are guards on the bounds.
  • Added packages/data-provider/src/pullRequest.spec.ts (endpoint encoding, query key, enum values) and a config spec for the new block (defaults, token reference only, required when enabled, cache bounds).
  • lc test on the touched files: packages/data-provider passes (971 tests); the workspace.spec.ts suite passes.
  • npx tsc --noEmit in packages/data-provider and packages/api exits 0. npm run static-checks:full -- --against origin/dev passes ESLint, Prettier, import sorting, design-rule suppressions, circular dependencies, TypeScript and unused i18n keys. Its config migration tests fail with Instance closed unexpectedly from the Mongo memory server in this sandbox; the same specs fail on origin/dev.

Screenshots / recordings

No user-facing change.

Risk / compatibility

None for existing deployments: the new key is optional, the config block is off by default, and the endpoint has no caller yet. The bounds are copied across three repositories (this one, the worker and the Code API), so a change to one needs the others.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • User-facing or complex behavior is documented where necessary
  • Required dependency changes have been merged/published
  • Required documentation PR: N/A

Code workers can report the branch and head commit of the lane a command ran in. LibreChat now accepts an optional laneGit key on execute_command results, bounded to a 256 character branch without control characters and a 40 or 64 character lowercase hex head, and rejects anything else. The data-provider gains the pull request types, endpoint, query key and service method, and an endpoints.agents.pullRequests config block that is off by default and takes the token only as an environment variable reference.
Copilot AI balanced review requested due to automatic review settings October 5, 2026 21:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T21:40:51.661331Z 2b92393 PR opened
🔒 Security Review ✅ Completed 2026-10-05T21:42:36.964482Z 2b92393 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codegraph-librechat codegraph-librechat Bot added the 🗺️ Backend Infra codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 5, 2026
@berry-13
berry-13 added this pull request to stack #16796 October 5, 2026 21:57
@berry-13
berry-13 merged commit 22b1d4f into dev Oct 5, 2026
45 checks passed
@berry-13
berry-13 deleted the berry-13/lane-git-contract branch October 5, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗺️ Backend Infra codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants