Repository navigation
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @DZH166 on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
🦋 Changeset detectedLatest commit: dc6657a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
TASTE.md review. Checked: parity (T-1, T-2), result labels and enums (T-15, T-16), errors (T-57 to T-63), docstrings (T-69, T-71), changeset and test placement.
1 violation, T-1 (JS / sync Python / async Python mirror 1:1 in semantics). The Python fix is correct, and because parse.py is shared, sync and async Python both get it (T-2 holds). The JS SDK has the same bug and this PR leaves it alone. deriveStatus in packages/js-sdk/src/sandbox/git/utils.ts (around line 332) still does if (statuses.has('U')) return 'conflict'. After this change, sandbox.git.status() in JS still reports AA/DD as added/deleted with hasConflicts === false, while Python reports conflict. The JS file is not in the diff, so the details are in the body and on the inline comment. Please add the same pair check in JS, add a matching unit test, and include 'e2b': patch in the changeset.
No other violations in the changed lines. Adding _UNMERGED_STATUS_PAIRS as a named module constant is the right shape.
| if index_status + working_status in _UNMERGED_STATUS_PAIRS: | ||
| return "conflict" |
There was a problem hiding this comment.
T-1: JS, sync Python and async Python must match 1:1 in semantics. This fixes Python only. JS deriveStatus in packages/js-sdk/src/sandbox/git/utils.ts still checks only for 'U', so the two SDKs now disagree about AA/DD. The compliant form is the same check in JS:
const UNMERGED_STATUS_PAIRS = new Set(['DD', 'AU', 'UD', 'UA', 'DU', 'AA', 'UU'])
function deriveStatus(indexStatus: string, workingStatus: string): GitStatusLabel {
if (UNMERGED_STATUS_PAIRS.has(indexStatus + workingStatus)) return 'conflict'
const statuses = new Set([indexStatus, workingStatus])
if (statuses.has('R')) return 'renamed'
// ...
}Add a JS unit test that mirrors test_git_conflict_status.py, and add 'e2b': patch to the changeset.
There was a problem hiding this comment.
Devin Review found 1 potential issue.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| """ | ||
| statuses = {index_status, working_status} | ||
| if "U" in statuses: | ||
| if index_status + working_status in _UNMERGED_STATUS_PAIRS: |
There was a problem hiding this comment.
🟡 Merge conflict detection differs across SDKs
For AA or DD entries, JavaScript’s deriveStatus still requires U and reports an addition or deletion. Python reports a conflict, while JavaScript reports none when those are the only conflicts.
Learn more
The SDK parity rule requires equivalent changes in JavaScript and both Python implementations. JavaScript’s status method reads the same Git porcelain format, but deriveStatus still recognizes conflicts only when a status character is U. Its conflict summary counts only entries labeled conflict.
Example: Both branches add settings.json differently, so Git reports AA settings.json. Python now reports one conflict. JavaScript labels the file added and reports zero conflicts if no other files are unmerged.
Recommended fix: Apply the same seven-pair check before JavaScript’s per-character rules, add coverage for AA and DD, and include the JavaScript SDK in the patch changeset.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc6657a1f0
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if index_status + working_status in _UNMERGED_STATUS_PAIRS: | ||
| return "conflict" |
There was a problem hiding this comment.
Mirror the conflict-pair check in the JavaScript SDK
For the AA/DD cases covered here, this changes Python's results but leaves JavaScript returning added/deleted with hasConflicts: false and conflictCount: 0: packages/js-sdk/src/sandbox/git/utils.ts:326-336 still recognizes conflicts only through U, and the public status method uses that parser. Mirror the pair check and regression coverage in JS so conflict reporting remains consistent across SDKs. The root AGENTS.md explicitly requires equivalent changes across JS and sync/async Python implementations.
AGENTS.md reference: AGENTS.md:L3-L3
Useful? React with 👍 / 👎.
Problem
Sandbox.git.status()andAsyncSandbox.git.status()parsegit status --porcelain=1 -bwith
_derive_statusinpackages/python-sdk/e2b/sandbox/_git/parse.py. That functionclassified a path as a conflict only when one of the two porcelain characters was
U.git-status(1)lists seven pairs for an unmerged path:DD,AU,UD,UA,DU,AA,UU. Two of them,AA(both added) andDD(both deleted), contain noU, so a mergestopped on one of those conflicts was reported as if it had no conflict at all:
Callers that gate a commit, a rebase or a "resolve the conflicts" step on
has_conflictstherefore proceeded as if the working tree were clean of conflicts, and the entry was
reported with the wrong label.
DDwas reported asdeletedin the same way.Fix
_derive_statusnow matches the porcelain pair against the set of unmerged pairs fromgit-status(1)before the per-character rules, soAAandDDmap toconflictlike thefive pairs that contain a
U. Pairs that are not unmerged keep their existing labels: astaged add (
A) is stilladdedand a deleted path (D) is stilldeleted, because thesingle characters are only matched after the pair check.
AA conflict.txtnow yields:The porcelain parsing is shared by
Sandbox.gitandAsyncSandbox.git, so both flavors arefixed. A patch changeset is included.
Tests
packages/python-sdk/tests/test_git_conflict_status.py(new, offline): every unmergedpair from
git-status(1)is reported asconflictwithhas_conflictstrue andconflict_count1, a two-entry conflicted merge is counted as two, and the pairs that arenot unmerged (
A,D,M,M,R,C,T,aa) keep their labels withconflict_count0. 16 passed.packages/python-sdk/tests/shared/git(nearest existing module, live-sandbox suite gatedbehind
ENABLE_GIT_TESTS): 31 skipped, unchanged.tests/sharedplus the unit modules at the tests root): 610 passed,33 skipped, and the 6 failures that predate this change on Windows (symlink creation
privileges,
ntpathabsolute-path semantics) are identical before and after.repro-1.pyexits 1 on the unpatched tree with six failed assertions (both entries labeledadded/deleted,has_conflictsfalse,conflict_count0) and exits 0 with the fix.