Conversation
|
CI triage: the only current blocker is the I tried to rerun the failed/cancelled workflow job, but this bot does not have the required repository admin permission: This looks like a transient/cancelled CI run, not a branch-local regression from the available logs. Maintainer action: rerun the |
74dd2df to
d733c01
Compare
…ion (NousResearch#27616) When migrate_codex_runtime() re-runs, it strips the old managed block (including the user's default_permissions) and rebuilds with the hardcoded default :workspace profile. Users who manually set :danger-no-sandbox / danger-full-access lose their setting on every migration pass — a footgun in gateway/iMessage contexts where there's no interactive approval UI. Changes: - New _extract_existing_permissions() reads top-level permission keys from the existing config before the managed block is stripped - migrate_codex_runtime() now checks for full-access values and preserves them instead of overwriting with :workspace - MigrationReport.preserved_permissions field surfaces the preservation in summary output - wrote_permissions_default tracking moved after the preservation check so it reflects the actual (possibly preserved) value Fixes NousResearch#27616
d733c01 to
7e874af
Compare
|
Thanks for taking on #27616 — I verified the bug still exists on current main and this PR is aimed at the right code path. Problems
Suggested changes
This is an automated hermes-sweeper review. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing the re-migration downgrade; the current-main path still replaces the managed permission profile, so the premise is valid.
Problems
- PR head
hermes_cli/codex_runtime_plugin_migration.py:748-770reads a user-owned rootdefault_permissions, then emits it in the new managed block._strip_existing_managed_block()preserves content outside the markers, and_insert_managed_block_at_top_level()preserves root-key prefixes (hermes_cli/codex_runtime_plugin_migration.py:307-335on current main). A manually repaired root key therefore survives and is duplicated, yielding invalid TOML. _extract_existing_permissions()collectssandbox_modeandapproval_policy(:456-483), butmigrate()only consumesdefault_permissions(:756-759); the renderer only writes that one profile.danger-full-accessis accepted as a default profile at:751-755, although current main documents:danger-no-sandboxas the applicable built-in profile (hermes_cli/codex_runtime_plugin_migration.py:629-635).
Suggested changes
- Establish one owner for root permission keys and test migrated TOML with
tomllibfor duplicate-free manually repaired configs. - Preserve all intended permission keys, or narrow extraction to the one supported key.
- Validate default-profile values separately from
sandbox_modevalues.
This is an automated hermes-sweeper review.
| dp = existing_perms.get("default_permissions", "") | ||
| if dp in _full_access_values: | ||
| default_permission_profile = dp | ||
| report.preserved_permissions = existing_perms |
There was a problem hiding this comment.
This leaves any manually repaired root permission lines intact, but line 769 regenerates default_permissions inside the managed block. Please remove or avoid re-emitting user-owned root keys so migration cannot produce duplicate TOML keys.
| # Preserve an explicit full-access or no-sandbox setting. | ||
| _full_access_values = { | ||
| ":danger-no-sandbox", | ||
| "danger-full-access", |
There was a problem hiding this comment.
danger-full-access is the reported sandbox_mode value, while current migration documentation identifies :danger-no-sandbox as the built-in default profile. Passing this through the renderer creates :danger-full-access; validate profile values separately.
| dp = existing_perms.get("default_permissions", "") | ||
| if dp in _full_access_values: | ||
| default_permission_profile = dp | ||
| report.preserved_permissions = existing_perms |
There was a problem hiding this comment.
The extracted sandbox_mode and approval_policy are only recorded in the report here; neither is supplied to the renderer. Either preserve those keys through migration or limit the extractor and report to default_permissions.
Summary
Fixes #27616 — codex-runtime re-migration silently downgrades user's full-access Codex permissions back to
:workspace.Root Cause
migrate_codex_runtime()strips the entire old managed block (including the user'sdefault_permissions) via_strip_existing_managed_block(), then rebuilds with the hardcoded default:workspaceprofile. Users who set:danger-no-sandbox/danger-full-accesslose their setting on every migration pass.Fix
_extract_existing_permissions()— new function that reads top-level permission keys from existing config before strippingMigrationReport.preserved_permissions— new field surfaces preservation in summary outputTesting
75/75 tests pass, including 5 new unit tests + 3 new integration tests for permission preservation behavior.