Repository navigation
feat: never auto-answer human-gate questions; reject human-gated agents - #2
Merged
Merged
Conversation
Questions beginning with the HUMAN_GATE: marker (the contract defined by unbound-force/dewey's curator-agent-human-gates change, design D7) always go to the human, regardless of engine confidence. Detection is lenient (leading whitespace, any case, header too) because a false or spoofed marker can only force a human answer. One marked question defers the whole request. A new humanGatedAgents config key (built-in "curator" always included) makes config load fail with an actionable error when "agents" overlaps it; a gated session agent is also refused at runtime as defense in depth. Both checks run before pass 0, so project guidance cannot override them. Config load failures now log at error level. Closes #1 Co-Authored-By: Claude Opus 5.5 <[email protected]>
- .github/workflows/ci.yml: bun 1.4.4, typecheck, bun test --coverage on pull requests and pushes to main. - src/test-harness.ts: fake opencode HTTP client (replies, summaries, child sessions) plus a stubbed LLM engine for end-to-end tests. - gate tests: the pass-0 assertion counted client.session.create, which subagents never call, so it could not fail; it now counts real child sessions, with a control case proving pass 0 runs when unmarked. - orchestrator flow tests: pass 0/1/2, thresholds, engine errors, immediate context, handler timeout, settled and non-autonomous sessions. Coverage 57% -> 84% lines (orchestrator 51% -> 91%). Co-Authored-By: Claude Opus 5.5 <[email protected]>
jflowers
marked this pull request as ready for review
November 13, 2026 14:36
- Detect HUMAN_GATE markers a model may decorate or respell: leading markdown (**, _, `, >, #, -, list numbers), zero-width chars, HUMAN GATE / HUMAN-GATE spellings, emphasis before the colon. A marker mentioned mid-sentence still does not gate. - A gated agent listed in `agents` is dropped with a logged error instead of failing the whole config load, which left every other agent's questions unanswered (a fleet-wide stall for unattended runs). - Gated requests are settled atomically, so a repeat delivery (question.asked plus question.v2.asked, or a replay) no longer posts a duplicate "Deferred to human" summary. Shared markSettled helper. - humanGatedAgents are deduplicated case-insensitively. - Document that a false marker stalls unattended runs. - Commit bun.lock and install with --frozen-lockfile in CI. - Test harness installs its fetch stub only after setup succeeds and removes its temp dir if setup throws. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Closes #1. Part of unbound-force/dewey#153.
What
HUMAN_GATE:marker. A question, or its header, that begins withHUMAN_GATE:always goes to the human, whatever the engine's confidence.curator-agent-human-gates(design D7) and emits from/dewey-distillsince feat: curator agent for /dewey-distill with enforced human gates unbound-force/dewey#187.humanGatedAgentsconfig key (default["curator"]).agentsoverlaps this list, with an error that names the agent and says to remove it.curator; they can't remove it.errorinstead ofwarn.Compatibility
~/.config/opencode/auto-question.jsoncand the shipped template both still load.dewey gate auto-answerreads only theagentskey, so the new key doesn't affect it.Tests and CI
.github/workflows/ci.ymlrunsbun run typecheckandbun test --coverage(bun 1.4.4) on pull requests and on pushes tomain.bun.lockis gitignored, so install resolves from thepackage.jsonranges.orchestrator.tsfrom 51% to 91%.src/test-harness.ts: a fake opencode HTTP client (question replies, session summaries, child sessions for subagents, session messages) plus a stubbed LLM engine, for end-to-end tests throughhandleQuestionAsked.src/gate.test.ts: marker detection, config load (overlap, case-insensitive matching, the built-in list can only be extended, invalid type), and end to end with an engine that always returns 0.99 confidence:client.session.create, which subagents never call. It now counts the real child sessions.handleQuestionAskedfails all 5 behavioural gate tests.src/orchestrator.flow.test.ts(new, covering existing behaviour):sessionSummary: false.🤖 Generated with Claude Code