Conversation
|
Assessment: Comment Clean, well-scoped fix. Converting the module-level singleton into a per-agent factory correctly addresses the shared-state bug, and the Review notes
Nice, focused bug fix — the per-agent memoization reads cleanly. |
0729f39 to
9870aa7
Compare
|
Assessment: Request Changes Re-reviewed after the latest push. The memoization feedback on the mock fixture was fully addressed — thank you. However, this push introduced a new change that needs attention before merge. Re-review notes
The core singleton→per-agent fix remains clean; the blocker is purely the bundled |
agent-of-mkmeral
left a comment
There was a problem hiding this comment.
Assessment: Request Changes 🔴
Reviewed the works on 9870aa7 — independently cloned, type-checked (src project clean), and ran the full unit-node suite.
✅ The core fix is clean and correct
The singleton→per-agent factory conversion is exactly right and fixes a real shared-state bug:
defaultSandboxFactorystores() => Sandboxinstead of a shared instance, so each unconfigured agent builds its own host default.Agent.sandboxmemoizes viathis._defaultSandbox ??= defaultSandboxFactory.get()()— stable instance per agent across repeated reads (important: sandbox-aware tools readagent.sandboxmultiple times and rely on a shared cwd/filesystem).- The earlier mock-fixture feedback (memoize
createMockAgent's getter to mirror the real semantics) was fully addressed — verified it now matches. - New tests cover the right behaviors: fresh-per-factory-call, per-agent isolation, and per-agent memoization.
Verification results:
tsc --project src/tsconfig.json→ ✅ clean (0 errors)- Sandbox unit tests → ✅ 106/106 pass (incl. the 6 changed default-sandbox tests)
- Full
unit-node→ 3493 pass. The only failures (4 intelemetry/__tests__/config.test.ts) and integ type errors (steering.test.node.ts) are pre-existing onmainand unrelated to this PR (confirmed by re-running againstmain).
🔴 Blocker: the bundled sandbox: false removal is out of scope — and it's a breaking change to a released contract
This PR also drops sandbox?: Sandbox | false → sandbox?: Sandbox from the public AgentConfig (inline comment below). I want to add one fact the prior re-review didn't establish: I checked git merge-base --is-ancestor efa837af typescript/v1.5.0 and #2563 (which introduced sandbox: false) is already shipped in typescript/v1.5.0. So this isn't removing an unreleased placeholder — it's removing an option from an exported type that users may already be passing. Anyone with new Agent({ model, sandbox: false }) will get a compile error after this lands.
Yes, false is behaviorally a no-op today (this._sandbox is falsy → falls through to the default, and the tool-registration if (this._sandbox) block is skipped). So removing it is harmless at runtime but type-breaking at the source level.
Per AGENTS.md ("One logical change per PR") and CONTRIBUTING.md (breaking changes → design proposal / API bar-raising), this belongs in its own PR. Two clean options:
- Revert the
sandbox: falseremoval here (keep this PR a pure singleton→per-agent fix — my preference; smallest, mergeable now), or - Split it out into a dedicated PR with
api/needs-review, a changeset/migration note, and thetreats sandbox: false the same as unconfiguredtest handled there.
The singleton→per-agent fix is ready to merge the moment the sandbox: false change is unbundled. Nice work on the memoization — it reads cleanly. 👍
9870aa7 to
54fe09e
Compare
|
Assessment: Request Changes Re-reviewed after the force-push ( Re-review notes
To unblock: keep this PR to the singleton→per-agent change (revert both the |
54fe09e to
d9f7d1e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Assessment: Request Changes Re-reviewed after This PR now bundles at least five distinct changes, spanning both TypeScript and Python: Distinct changes bundled into this PR
This directly conflicts with the PR's own checklist ("My change is focused and reasonably small; I have split unrelated work into separate PRs"), with AGENTS.md (one logical change per PR), and with CONTRIBUTING (breaking changes → API bar-raising). It also still carries the original Strong recommendation: Reset this PR to just change #1 (the singleton→per-agent fix, which was ready to merge three pushes ago). Each of #2–#5 is a legitimate change, but each is an independent, separately-reviewable API/behavioral decision and should be its own PR with |
|
Assessment: Approve Re-reviewed after What the PR now does, and it does it well:
Verification:
One thing to note for the record: the file-editor tool name moves from Nice tightening of the change — much easier to reason about now that it's a single focused refactor. |
Description
getTools()implementationsType of Change
Refactor
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce new warnings.
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.