Harden context handling end to end - #32
Merged
Merged
Conversation
Centralize trust-aware context assembly and conservative request budgeting across chat, agents, Watch, MCP, Vault, cloud, and MLX. Enforce scoped cloud approvals, protocol-safe tool exchanges, bounded MCP payloads, provider fidelity, context lineage, and hidden-context UI boundaries. Add adversarial core and app regression coverage. Validated with 273 PinesCore tests, PinesCoreTestRunner, a clean iOS build-for-testing, 115 passing app tests with 3 device-only skips, and the public-hygiene suite.
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.
Summary
Root cause
Context construction had evolved independently across several product surfaces. Trust, privacy, token budgeting, transcript repair, and provider-specific request accounting could therefore drift or be bypassed depending on the entry point.
Impact
Every production inference path now uses one fail-closed assembly contract. Local-only or private context requires explicit per-turn approval before cloud egress, external evidence cannot become system instructions, malformed tool exchanges cannot reach providers, and requests fail clearly instead of silently clipping required user input.
Validation
PinesCoreTestRunnerpassedbuild-for-testingpassedgit diff --checkpassed