feat(cli): COR-447/448/449 fast mode, plugin hash pin, instruction omit - #74
Conversation
1 similar comment
Greptile SummaryThis PR adds organization-governed Fast mode, command-hash-pinned plugin installation and updates, and configurable instruction omission for subagents.
Confidence Score: 5/5Safe to merge. All previously reported threads are resolved and the current implementation reflects the stated fixes. There are no outstanding blocking issues. Files Needing Attention: None. Reviews (12): Last reviewed commit: "fix(ci): green the rebase — duplicate te..." | Re-trigger Greptile |
1 similar comment
|
@greptileai review |
|
@greptileai re-review after P1 fixes on
|
|
@greptileai tip |
Designer cli — LOCKPR: #74 · head Chrome QA (pass)Runtime lock boards present at both 40×12 and 120×40:
Pixel histogram + visual: ink palette only — Design status
AlexaChrome is lockable for this tip — TUI surfaces OK to undraft/squash once Greptile + Protect clear. No HOLD on #74. (#73 prior HARD HOLD still stands — missing runtime 40×12 for |
|
@greptileai tip |
|
@greptileai tip |
Designer cli — LOCK (reaffirm)PR: #74 · tip Prior LOCK was on Chrome QA (pass @ tip)Runtime boards still present at both 40×12 and 120×40:
Pixel histogram: ink only — Design status
AlexaChrome remains lockable at tip |
Batch 56 Code/CLI only. Three fail-closed surfaces for remote Code sessions and organization policy. COR-447 — Remote Fast chip + `/fast` - Remote (cloud / self-hosted) sessions show `Remote · Fast mode on` and a Fast chip in the composer model chip while fast mode is on; a Standard remote session shows `Remote · Standard`. - `/fast` (and `/fast on|off`) follows the host setting where policy allows it. An unknown token is an error, never a toggle. - When the organization disabled fast mode the request is refused with `Fast mode is disabled for your organization. Contact your admin.` and `Staying on Standard.` The session stays on Standard, nothing is re-sent, and there is no client bypass flag. COR-448 — `--accept-command` hash pin - `plugin install` / `plugin update` accept `--accept-command <sha256>` pinning exactly the commands a prior `--json` review printed, and `--json` prints that review plus its `command_hash` without installing. - A mismatch fails closed with `Command hash mismatch. Manifest may have changed. Re-run with --json and accept the new hash.` The package never reaches the plugin root, the previous install is untouched, and there is no `-y` shortcut that accepts a changed manifest. - Accepted hashes are appended to the audit journal. Organization policy can require the pin for every member. COR-449 — omit user/project instruction documents - Subagent frontmatter and the `Task` tool accept `omit_instructions` (user, project, local, managed). A skipped document is never opened. - Organization-managed policy is never omitted: a request that names `managed` is accepted, recorded, and ignored. - An unknown scope name is an error rather than a silent no-op. Each omission is appended to the audit journal. Policy resolution fails closed for both keys: a `policy.json` that exists but cannot be read, cannot be parsed, or carries an unrecognized value denies the restricted behavior. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Capture the 12 real MockTerminal boards for the Batch 56 Code/CLI surfaces, at 120x40 and 40x12, into the existing runtime pack. - `remote-fast` (COR-447): `Remote · Fast mode on` plus the composer `Cortex Mini 1 (medium) · Fast` chip. - `remote-standard` (COR-447): `Remote · Standard`, no Fast chip. - `org-disabled-fast` (COR-447): the `/fast on` refusal — `Fast mode is disabled for your organization. Contact your admin.` and `Staying on Standard.` No Fast chip, status line stays Standard. - `plugin-accept-command` (COR-448): the install review with its real `command_hash` and the `--accept-command` pin. - `command-hash-mismatch` (COR-448): the fail-closed copy. - `omit-instructions` (COR-449): `omit_instructions` loads managed policy, skips user/project/local, and records the audit line. The scenes live in `lock_v2_batch56` and are captured through a dedicated `--batch56` path, so the SPEC §7 id lists stay at 96 wide / 50 narrow and no existing runtime board is rewritten. Copy is Cortex-only; chrome is ink/gray/accent with zero violet or cyan. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Unblock CI on the Batch 56 branch. - Security audit: `cargo update -p rustls` moves the lockfile to 0.23.45, clearing RUSTSEC-2026-0285. - Source policy: the only regressions were three files over the 1000 line target. Move each test module into a sibling file with the repository's `#[path]` pattern, so behavior is unchanged: `plugin_cmd/install.rs` 1290 -> 642, `app/state.rs` 1004 -> 989, `minimal_session/view.rs` 1003 -> 981. No other over-1000 file is touched. - Test: `python3 scripts/readiness/schema.py --write` regenerates `docs/reference/cli.commands.json`, whose only change is the COR-448 `--accept-command` and `--json` flags. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
`rustls` 0.23.45 is the patched release for RUSTSEC-2026-0285 (GHSA-2mjx-qc3c-rqvc), but it was published inside the seven-day window the release-age gate enforces, so Security Audit and Source policy disagreed. 0.23.44 is not patched. Add a narrow, temporary advisory exception that excuses only the age rule for one exact name/version pair, only until 2026-09-21, and only when the release is not yanked. Anything else still fails the general seven-day rule, and the exception is printed on every run so it stays visible. - `advisory_exception()` returns the live entry or `None`; the caller checks `yanked` first, so a yanked release is never excused. - Unit tests cover the boundary, the expiry instant, that 0.23.44 and unrelated crates are not excused, and that every exception names an advisory and a finite expiry. - No `deny.toml` change. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…scopes Wire Fast mode into CodeTurnContext/turn JSON; length-prefix command-pin fields and include hook function/priority/pattern; fail closed on audit journal write and dangling org policy; discover instruction sources for subagents and transfer custom-agent omit_instructions; extend rustls release-age exception through the exact 7-day boundary.
Unblock CI after Greptile P1 follow-up: format command_pin/streaming, pass fast_mode into tui_code_turn_context test call sites, and extract frontmatter omit merge so run_subagent complexity matches the prior tip.
Move managed_policy_sources/record_instruction_audit to instruction_audit.rs so executor.rs stays under the source-quality line limit.
Sibling module visibility so cortex-engine compiles after the line-cap split.
JSON plugin command review now includes hook priority/pattern/function (matching the pin digest). Managed instruction paths that cannot be read error instead of silently dropping org directives.
Rebase onto main 6ed7a0a keeps both sides of two conflicts (`cmd_permissions` + `cmd_fast`, and the COR-35 + Batch 56 scene dispatchers), then clears the remaining reds for real: - Clippy: `instruction_scopes.rs` carried a duplicated `#[test]`, which also left `only_omitting_user_keeps_the_project_documents` without an attribute, so it was dead code. One attribute each, both tests run. - Source policy: `run_subagent` was at cyclomatic complexity 35 against a target of 25. Move event forwarding, summary-turn handling, and result assembly into `subagent/run_helpers.rs`; the function is now 11. The three files the new code pushed over 1000 lines are split the same way the repo already splits them: `lock_v2_settings.rs` and `event_loop/fast_mode.rs`. No threshold was relaxed. - Release-age: unchanged; the rustls exception still applies. Validation: fmt, `./scripts/clippy.sh`, `cargo test --workspace`, the TUI matrix, `cargo audit`, `check-cli-version.sh`, `quality.py` (0 regressions, 0 policy failures), `release_age.py`, and the readiness unit tests all pass locally. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
62d7101 to
0b067a9
Compare
|
@greptileai review the latest push (tip 0b067a9). Rebased onto main 6ed7a0a and fixed the CI reds: duplicate |
Batch 56 · Designeur FE/Code GO — Code/CLI only (Chat web SPA untouched).
Paper: W-0 · vol2 W-0
Linear: COR-447 · COR-448 · COR-449
Comp AI gates — implemented in code AND covered by tests
/fastsrc/cortex-engine/src/org_policy.rs(FastModePolicy),src/cortex-engine/src/fast_mode.rs(apply_fast_mode→RefusedByOrgPolicy),src/cortex-tui/src/runner/event_loop/commands.rs(apply_fast_modekeeps the session on Standard)fast_mode::tests::a_disabled_organization_refuses_fast_mode,…::a_refusal_is_independent_of_the_current_state,…::an_unparseable_or_unreadable_policy_fails_closed,views::minimal_session::tests::harness_snapshots::snapshot_org_disabled_fast_mode_copysrc/cortex-plugins/src/command_pin.rs(verify_command_hash,HASH_MISMATCH),src/cortex-cli/src/plugin_cmd/install.rs(enforce_command_pin_with, checked before anything reaches the plugin root)command_pin::tests::a_mismatch_fails_closed_with_the_review_copy,…::a_malformed_hash_is_rejected_before_any_work,plugin_cmd::install::tests::an_accepted_hash_installs_and_a_changed_manifest_does_not,…::organization_policy_requires_the_pinsrc/cortex-engine/src/instruction_scopes.rs(InstructionPlan::newdropsManagedfrom the skip set;loadnever opens a skipped file),…/subagent/executor.rs(apply_instruction_plan)instruction_scopes::tests::managed_policy_is_never_omitted,…::a_skipped_scope_is_never_read,…::managed_policy_loads_even_when_nothing_else_does,subagent::types::tests::subagent_omission_never_drops_managed_policy,handlers::task::tests::test_task_params_omit_instructionsCOR-447 — Remote Fast chip +
/fastfail-closedRemote · Fast mode onon the status line and a Fast chip in the composer model chip (Cortex Mini 1 (medium) · Fast) while fast mode is on. A remote session on the default path showsRemote · Standard; a local session shows neither./fast(and/fast on|off) follows the host setting where organization policy allows it. An unknown token is an error, never a silent toggle.Fast mode is disabled for your organization. Contact your admin.Staying on Standard.The session stays on Standard, nothing is re-sent after the refusal, and there is no client bypass flag. Turning fast mode off is always allowed.
COR-448 —
--accept-commandhash pinplugin installandplugin updateaccept--accept-command <sha256>, pinning exactly the command set a prior--jsonreview displayed.--jsonprints the review (id, version, every command with aliases/args, hooks, tools) plus itscommand_hash, without installing.Command hash mismatch. Manifest may have changed. Re-run with --json and accept the new hash.The package never reaches the plugin root, the previously installed package is left untouched, no trust is renewed, and there is no
-yshortcut that accepts a changed manifest.{cortex_home}/audit/events.jsonlasplugin_command_accepted.plugin_install: "require_accept_command").COR-449 — omit user/project instruction documents
omit_instructions/omit-instructions) and theTasktool JSON (omit_instructions: [...]) opt in to skipping instruction documents:user,project,local,managed.managedis accepted, recorded, and ignored — the managed document still loads.instructions_omitted; a request that named managed policy is recorded asmanaged_policy_never_omitted.Policy resolution fails closed
CORTEX_ORG_POLICY_DIR/policy.jsondrives both keys. A document that exists but cannot be read, cannot be parsed, or carries an unrecognized value denies the restricted behavior. Only an absent document (or absent key) leaves the host default. Seedocs/configuration/policy.md.Scope
cortex-app-serverAPI change.cortex.foundation.paint_status_markerheader row (as/sharedoes), theCommandResult::{Toggle,SetValue}command path, the plugin install lock/staging flow, and the subagent system-prompt assembly.Test plan
cargo fmt --all -- --check./scripts/clippy.sh(clean under-D warnings)cargo test --locked -p cortex-engine -p cortex-plugins -p cortex-agents -p cortex-tui -p cortex-cli --lib— 3915 passed, 0 failedcargo test --locked -p cortex-cli --test cli_schema— 4 passed (--accept-commandparse coverage)snapshot_remote_fast_chip_and_status_line,snapshot_fast_chip_is_absent_off_and_locally,snapshot_org_disabled_fast_mode_copy,fast_command_toggles_and_parses_on_off./scripts/check-cli-version.shcargo test --workspace(CI)cargo audit(CI)Attestation
.envfiles included.Risk
Organization policy is a new surface. Both keys default to today's behavior when no policy document exists, so an unconfigured host is unchanged. A malformed document denies rather than allows, which is the intended direction.
--accept-commandis additive; existing installs without the flag behave as before unless policy requires the pin.DRAFT only — do not merge.