fix(inference-profile): self-review gap fixes#29957
Conversation
…istry (#29956) * feat(inference-profile): CLI open/close/list + shared cli/utils + registry * fix: address review feedback (help text, null safety, llm alias comment) - Replace "daemon" with "assistant" in profile open help text (user-facing) - Fix sticky branch condition: use `== null` to catch ttlSeconds null/undefined - Remove unsafe non-null assertion on resultTtlSeconds in non-sticky branch - Add null guard on expiresAt in list --json output - Update JSDoc and llm command description/help to accurately reflect that llm only aliases inference send, not all subcommands (profile is inference-only) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(inference-profile-cli): correct help text TTL default and guard clamp notice in JSON mode - Update `profile open` help text: omitting --ttl yields a sticky session (no expiry), not a "configured default TTL" which does not exist in the daemon handler. - Update --ttl option description to mention that omitting it also gives a sticky session. - Move the TTL-clamped notice into the non-JSON (else) branch so that `--json` output is always valid JSON with no non-JSON prefix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(inference-profile-cli): default TTL to 30m and reject partial duration parses - `profile open` without `--ttl` now sends `ttlSeconds: 1800` (30 min default) instead of omitting it, so the daemon creates a session-backed override that `profile close` can properly undo (sticky overrides with no sessionId cannot be closed by the session handler). - `parseDuration` now validates that the entire input string is composed of `<digits><unit>` groups before parsing, rejecting inputs like "1hxyz" or "1h-30m" that would previously silently return partial matches. - Updated `--ttl` option description and help text to reflect the new default. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: credence-the-bot <credence@vellum.ai> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion coverage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2c5667147
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| process.stdout.write( | ||
| JSON.stringify({ | ||
| ok: true, | ||
| conversationId, |
There was a problem hiding this comment.
Return resolved conversationId in JSON responses
In profile open --json, the command emits the locally resolved input conversationId instead of the daemon response field (result.conversationId). This loses canonicalization when callers pass a conversation key/alias rather than an internal ID: the operation applies to the resolved conversation on the server, but the JSON output reports a different identifier, which can break automation that chains IDs from CLI output. The same pattern is repeated in profile close --json.
Useful? React with 👍 / 👎.
…tests Replace loadConfig() with getConfigReadOnly() in the profile open action handler to avoid filesystem side effects (ensureMigratedDataDir, default config writes) during CLI reads. Add a hermetic mock.module for ../../config/loader.js in the test file so the no-TTL test case does not depend on local config state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@codex review this PR |
|
@devin review this PR |
In the `profile open --json` and `profile close --json` handlers, the JSON output was using the locally-resolved `conversationId` variable instead of `result.conversationId` (the server's canonical conversation ID). When callers pass a conversation key/alias rather than an internal ID, the server canonicalizes it — the JSON output now returns what the server resolved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Review (cycle 3)
Looks good — would approve if I could. Ready for Noa's merge.
What I verified
- Default TTL:
getConfigReadOnly().llm?.profileSession?.defaultTtlSeconds ?? 1800. Closes the sticky-trap (defaultopencreates a session-backed override thatclosecan undo). - Codex P2 (conversationId canonicalization): both
openandcloseJSON paths now emitresult.conversationIdfrom the daemon response, not local input. --ttl neverplumbing: Zod schema ininference-profile-session-routes.tsacceptsnull, OpenAPI regenerated to match.parseDurationstrictness: anchored regex^(\d+[hms])+$rejects partial parses like1hxyz/1h-30m. Test coverage added.- Shared utils refactor: clean lift of
resolveConversationId+parseDurationintocli/utils/.browser.tscorrectly skipped (different return semantics). - Trust rule:
inference profile open|close|listregistered withrisk: "low". Auto-approves at Relaxed (threshold ≥ low), prompts at Strict (threshold = none). - Test mismatch + isolation fixes from self-review remediation.
Cycle history
- Cycle 1 (sub-PR #29956): Devin findings (help text daemon→assistant, null safety,
llmalias, list null guard) + Codex P2 (clamp/JSON purity, sticky-trap on default) addressed across9d25911c,f339abc9,68f821d0. - Cycle 2 (PR #29957 open): self-review remediation (test mismatch, Zod null, parseDuration coverage,
getConfigReadOnly, test mocking) addressed acrossa2c5667,fcb6dff,7e6164d3. - Cycle 3 (current HEAD
d6e9319e2): Codex P2 conversationId canonicalization addressed; CI 9/9 green; all prior findings resolved.
Ready to merge.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6e9319e28
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| }), | ||
| })); | ||
|
|
||
| mock.module("../../config/loader.js", () => ({ |
There was a problem hiding this comment.
Mock the correct config module path
mock.module("../../config/loader.js", ...) resolves relative to this test file, so it targets assistant/src/cli/config/loader.js instead of the assistant/src/config/loader.js module imported by inference-profile.ts. As a result, these tests silently use the real config loader and can become environment-dependent (for example if llm.profileSession.defaultTtlSeconds differs from 1800 in the active workspace), reducing test reliability.
Useful? React with 👍 / 👎.
Codex P3: `mock.module("../../config/loader.js", ...)` resolves to
`assistant/src/cli/config/loader.js` from this test's location, not
`assistant/src/config/loader.js` which is what `inference-profile.ts`
actually imports. The mock therefore wasn't taking effect and tests
silently used the real config loader. Fix: change to `../../../` (one
more level up) to match the canonical pattern used by the other mocks
in this same file.
|
@codexbot review again — Codex P3 (config loader mock path) addressed in commit |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Summary
Part of plan: inference-profile-cli.md (fix PR)