Repository navigation
Report hook context and refused instruction files in context inspection (4.1-4.4) - #137
Merged
Merged
Conversation
Committed hook additional_context is now its own hook_context source (origin hook) instead of being folded into history, in both the stored projection and the last prepared request. Context queued by background hook handlers and a compaction requested during a turn are reported as pending updates; queued hook context is added to the next-request estimate and a pending compaction is listed as an assumption. The /context panel shows both without hook text. OpenAPI/SDK regenerated.
Project instruction files and imports refused because they resolve outside the project (outside_project) or because read rules deny them (read_denied) were only warnings, so context inspection could not show them. The loader now records them as typed withheld entries like rule definitions; inspection lists them and doctor reports them once by reason instead of repeating the loader warning.
The Safe Boundary commits queued hook context while holding the state lock; reading the queue and the state under the same lock keeps an inspection from counting a text both as pending and as committed.
leonardoaraujosantos
changed the base branch from
feat/managed-recovery-owner
to
main
November 17, 2026 13:57
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Advances #93. Stacked on #123 (
feat/managed-recovery-owner); retarget tomainonce #123 merges.Summary
Finishes tasks 4.1–4.4 of
complete-daily-coding-surfaces(rules and context inspection). I checked every 4.x clause against thesystem-context,configurationandtuideltas, the code and the tests. Most of the work was already on #123: rule discovery and precedence,AGENTS.override.md, validated globs, bounded assembly andinstruction_limits, delivery fencing and withdrawal, restart, the inspection route,/contextand doctor. This PR closes the two real gaps the audit found:Hook
additional_contextin context inspection. Committed hook context used to be counted insidehistory. It is now its ownhook_contextsource with originhook, both in the stored projection and inlast_prepared_request. Two kinds of pending update were invisible before and are now reported:pending_hook_contextsandpending_hook_context_tokens, and those tokens are added tonext_request.compaction_pending, with a newcompaction_pendingassumption.The hook text is never returned. The TUI
/contextpanel shows all of this. The queue and the state are read under the Session state lock, the same lock the Safe Boundary uses to commit, so a text is never counted both as pending and as committed. New delta scenario: "Hook context and queued updates in inspection".Refused non-rule instruction files are typed withheld entries. Project instruction files and imports refused because they resolve outside the project (new reason
outside_project) or because read rules deny them (read_denied) used to be warnings only. They now appear inwithheld_sources.cyber doctorlists them once by reason and no longer repeats the loader warning.OpenAPI and the TypeScript SDK are regenerated.
docs/local-core-guide.md,docs/features.md,tasks.md(4.1–4.4 checked off, with an audit note) andimplementation.mdare updated.Decisions
Tests
New:
cyber-servercontext_compaction:inspection_reports_hook_context_as_pending_then_as_its_own_source,inspection_reports_a_compaction_requested_during_a_turn,inspection_reports_instruction_files_refused_outside_the_projectcyber-tui:inspection_shows_pending_hook_context_and_compaction_without_hook_textExtended:
cyber-serverinstructions unit tests:project_imports_stay_inside_the_project,the_read_gate_refuses_project_files_and_imports_but_not_global_files(typed withheld entries)cyber-cli:doctor_warns_about_an_instruction_file_outside_the_project(regression: listed once, asoutside_project) anddoctor_refuses_protected_imports_and_project_files_under_a_broken_configResults under nextest
ci:cyber-server: lib pluscontext_compaction,http,structured_root,tool_hook_effects,hook_receipts,prompt_hook_shutdownandfork_context: 645 passedcyber-app --test instructions: 31 passedcyber-tools --test instruction_config: 2 passedcyber-tui --lib: 687 passedcyber-clidoctor tests (--bin cyberand--test cli): passedOther checks, all passing:
generate_sdk.py --checkcargo fmt --checkandcargo clippy --all-targets -D warningsopenspec validate --all --strict,spec_lint(0 errors),spec_inventory --checkcyber help-markdownmatchesdocs/cli.mdNot covered
additional_contextis not redacted before it reaches the model. The redaction requirement covers tool output only, so changing this needs a spec decision.