Repository navigation
feat(mantis): programmable proof boundaries with recipe library - #127782
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
--until-text and --until-events evaluated the whole lane timeline, so a reused marker or any prior event satisfied the early return before the observed action produced evidence. Event predicates now count only events after the requested cursor; provider-request counts stay cumulative because the provider log has no per-observe cursor. Regression: nonzero-cursor observe with stale matching history times out instead of returning early.
|
Codex review: needs changes before merge. Reviewed August 22, 2026, 1:20 AM ET / 05:20 UTC. ClawSweeper reviewWhat this changesThis PR adds declarative Mantis scenario controls for provider scripts, Telegram Bot API faults and request facts, early observation, and reusable proof recipes. Merge readinessKeep this PR open: its new callback-payload recipe cannot target the bot message or inspect the requests that carry callback bytes, so it does not deliver the advertised proof path. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherMantis runs isolated Telegram Desktop comparison lanes for a baseline and a candidate revision. Its lane helper configures the test environment, a separate proxy records Bot API calls, and the workflow publishes validated evidence artifacts. flowchart LR
Agent[Unprivileged proof agent] --> Controls[Declarative scenario controls]
Controls --> Lane[Trusted lane helper]
Lane --> SUT[Isolated baseline or candidate]
SUT --> Proxy[Separate Bot API proxy]
Proxy --> Facts[Recorded lane facts]
Lane --> Facts
Facts --> Validation[Workflow validation]
Validation --> Evidence[PR proof artifacts]
Decision needed
Why: Static source supports the intended isolation, but the final Docker mount behavior and the dependency-backed effort setting cannot be established from this read-only checkout. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceTests +539, Docs +102, Config +12, Other +810. Total +1463 across 17 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Repair the callback recipe to derive the SUT message ID and inspect callback-bearing markup requests, then prove proxy isolation and trusted evidence publishing in a real Mantis workflow run before merge. Do we have a high-confidence way to reproduce the issue? Yes, source reproducible: the callback recipe references an unset bot-message variable and filters out the requests that normally carry callback_data. Is this the best way to solve the issue? No: the programmable boundaries are a plausible direction, but the callback recipe must first capture the actual bot message and inspect sendMessage or editMessageReplyMarkup facts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 500bb6031d17. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
The SUT container bind-mounts the whole runtime read-write as the mantis-sut UID, which included proxy-control/ — the trusted Bot API fault rules and recorded request facts the proxy container writes. Untrusted candidate code could rewrite its own evidence before finish published it. An inaccessible tmpfs now shadows proxy-control inside the SUT container (cap-drop ALL prevents unmounting), and the prompt no longer presents SUT-co-located provider request logs as standalone comparison evidence.
Pre-land review disposition (head 49c6e6b)Local ClawSweeper round 3 (gpt-5.6-terra, high reasoning) on head 1. Final-effect proof: candidate code cannot access
|
…claw#127782) Makes the Mantis Telegram Desktop proof agent programmable at its trust boundaries: declarative Bot API fault rules (drop/status per method), per-request scripted mock-provider responses, observe-until predicates (post-cursor events/text, cumulative provider count), and bounded proxy-side recording of outbound Bot API requests as trusted lane facts. Adds a reusable recipe library under .github/codex/prompts/mantis-recipes/ and raises the proof agent's reasoning effort to high. Security: the SUT container shadows proxy-control with an inaccessible tmpfs so candidate PR code sharing the mantis-sut uid cannot read or rewrite the proxy's recorded evidence; unmount is blocked by cap-drop/no-new-privileges. Proof doctrine now treats proxy-recorded Bot API facts as trusted comparison evidence and provider request logs as diagnostics. Follow-up named in PR: move the mock OpenAI server out of the SUT container so provider request facts also become candidate-tamper-proof.
What Problem This Solves
Mantis (the automated Telegram Desktop PR proof agent) currently blocks on three recurring scenario classes because its harness boundaries are static:
callback_data) produce pixel-identical lanes, forcingblockeven when the change is provable.All three blocked runs in the recent evidence archive fail at exactly these seams.
Why This Change Was Made
Instead of letting the proof agent author harness code (which would break the trusted evidence chain), the boundaries become data-programmable: the agent supplies declarative JSON (fault rules, ordered provider response scripts, observe-until predicates) through the existing sudo-wrapped lane CLI, and trusted root/
mantis-sut-owned code interprets it and records bounded facts into the lane facts file. The prompt gains a recipes library (.github/codex/prompts/mantis-recipes/) mirroring the Telegram E2E userbot skill's feature-recipe pattern, so working scenarios accumulate; the agent can propose new ones via a quarantinedrecipe-suggestion.mdartifact.The trust boundary is unchanged: the unprivileged
codexuser gains no new writable paths, controls land inmantis-sut-owned mode-0700 directories, workflow validation of lane facts is strengthened (Bot API request facts are now required), and no sudoers changes. The candidate SUT container cannot see the proxy's record sink: an inaccessible tmpfs shadowsproxy-control/inside the runtime mount, so the lane under test cannot rewrite its own recorded Bot API evidence, and the prompt treats SUT-co-located provider request logs as diagnostic rather than standalone comparison evidence. Follow-up worth naming: moving the mock OpenAI server out of the SUT container (its own container like the Bot API proxy) would make provider request facts trustworthy against candidate code too.User Impact
Maintainers get Mantis proofs for whole PR classes that previously ended in
block: Bot API failure/retry behavior, ordered multi-turn provider scenarios, and payload-level differences with pixel-identical UI. Runs also finish faster:observe --until-*predicates replace fixed 60-second windows (~14 minutes of dead waiting in one archived run), and agent effort rises tohigh(verified against the Codex runtime source:codex-rs/protocol/src/openai_models.rs:62,sdk/typescript/src/exec.ts:129).New primitives (all declarative, executed by trusted code):
botapi-fail <method> [--times N] [--status CODE | --drop]/botapi-clear/botapi-requests— injected faults plus bounded outbound Bot API payload/status recording (32 KiB body cap, token-redacted), always published in lane facts.mock --script <file> <sha256>— ordered per-request provider responses (text, raw events file, or injected failure), withdefault/last-entry exhaustion semantics.observe --until-events/--until-text/--until-provider-requests— AND-semantics early return, 60 s cap retained.Evidence
node scripts/run-vitest.mjs test/scripts/telegram-bot-api-proxy.test.ts test/scripts/e2e-mock-config-limits.test.ts test/scripts/telegram-mantis-lane.test.ts test/scripts/mantis-build-telegram-desktop-proof-evidence.test.ts test/scripts/mantis-telegram-desktop-proof-workflow.test.ts— 5 files, 79/79 passed.node scripts/check-changed.mjs -- <all touched files>— formatting, lint, Node erasability, and type checks passed.git diff --checkclean..botApiRequestsarray is now required in lane facts (empty array required for infra-error lanes); recipe-suggestion quarantine copy enforces regular-file/no-link/size bounds with root installation.