Skip to content

Support signed human requirements in issue flows#164

Merged
wwind123 merged 1 commit into
mainfrom
codex/issue-131-signed-issue-requirements
May 26, 2026
Merged

Support signed human requirements in issue flows#164
wwind123 merged 1 commit into
mainfrom
codex/issue-131-signed-issue-requirements

Conversation

@wwind123
Copy link
Copy Markdown
Owner

Summary

  • parse signed human requirements from issue bodies and issue comments into IssueContext
  • surface and enforce signed issue requirements in issue-mode and plan-first prompts and validators
  • carry issue-sourced signed requirements forward into later PR review rounds and extend tests

Testing

  • python3 -m pytest tests/test_agent_loop.py -q

Fixes #131

@wwind123
Copy link
Copy Markdown
Owner Author

Implemented issue-side signed human requirements end to end.

  • Added signed requirement parsing for issue bodies and issue comments, and stored them on IssueContext.
  • Surfaced signed issue requirements as high-priority instructions in issue-mode and plan-first prompts, with acknowledgement enforcement for implementation and planning responses.
  • Carried issue-sourced signed requirements forward into later PR review rounds and expanded tests for parsing, prompt rendering, validation, and merged issue/PR requirement handling.

Tests: python3 -m pytest tests/test_agent_loop.py -q (passed)

-- OpenAI Codex

@wwind123
Copy link
Copy Markdown
Owner Author

Review — Support signed human requirements in issue flows

CI: passing (358 tests pass locally; GitHub checks confirmed passing).

Summary

This PR extends signed human requirement support from PR review flows into issue context: parsing from issue bodies and comments, surfacing in issue-mode and plan-first prompts, enforcing acknowledgement in validators, and merging issue + PR requirements chronologically in run_pr_loop. The implementation is clean, follows established patterns, and is well-tested.

Correctness

Parsing (github.py): _parse_issue_human_requirements correctly pulls requirements from the issue body (data.get("body")) and each comment, using the already-proven parse_signed_human_requirement_body parser. The issue body's created_at is populated from createdAt in the API payload (now explicitly requested in the gh issue view JSON fields), so chronological sorting in _merge_human_requirements works correctly against comment timestamps.

Validation ordering (orchestrator.py): _validate_response_with_human_requirements calls the marker validator first (raising fast if the marker is missing), then re-derives the prompt context with the same arguments used to build the prompt, and validates acknowledgement. The re-derivation uses the same default max_chars=12_000, so the set of surfaced requirement IDs is consistent between prompt building and validation.

Merging in run_pr_loop: Replacing pr_context.human_requirements with _merge_human_requirements(issue_context, pr_context) correctly combines both sources, sorted by created_at or "". The test test_pr_loop_combines_issue_and_pr_signed_human_requirements verifies that the earlier issue requirement precedes the later PR requirement in the prompt.

HUMAN_REQUIREMENTS_DIRECT_DISCUSSION_ACK wording change: The constant is both injected into prompts and matched by the validator regex, so changing both together to the more generic "checked the relevant GitHub discussion directly before responding" keeps the system self-consistent for new interactions.

Backward compatibility: IssueContext.human_requirements has a default value of (), so no existing call sites need changes.

Refactoring of _parse_issue_comments: The shared helper preserves the existing sort-by-created_at behaviour and is now also used by get_pr_review_context, which is a clean consolidation.

Test Coverage

New tests cover:

  • test_get_issue_context_parses_signed_issue_body_and_comments — parsing from both issue body and comments, author/timestamp extraction, unsigned comments remaining in .comments only
  • test_format_human_requirements_supports_issue_specific_wording_and_fallback — parameterised wording and full-omission fallback
  • test_issue_and_plan_prompts_surface_signed_human_requirements_before_issue_context — parameterised across all four builder paths; checks ordering relative to issue context block
  • test_plan_review_prompt_surfaces_signed_issue_requirements_as_approval_critical — reviewer prompt wording
  • test_pr_loop_combines_issue_and_pr_signed_human_requirements — merged requirements in chronological order
  • test_issue_loop_rejects/accepts_initial_issue_human_requirements_acknowledgement — enforcement on direct implementation
  • test_issue_loop_plan_first_rejects/accepts_initial_plan_human_requirements_acknowledgement — enforcement on plan phase
  • test_issue_loop_plan_revision_rejects/accepts_human_requirements_acknowledgement — enforcement across revision rounds

The update to test_issue_loop_plan_first_revises_until_all_reviewers_approve (dropping assertions from that test and placing them correctly in the new revision-accepts test) is intentional and correct.

No blocking issues found.

-- Anthropic Claude

@wwind123
Copy link
Copy Markdown
Owner Author

The implementation in PR #164 successfully extends signed human requirement support to GitHub issues, fulfilling the requirements of issue #131.

Key Changes

  • Requirement Parsing: get_issue_context now correctly identifies and extracts signed human requirements from both the issue body and issue comments.
  • Unified Requirement Handling: orchestrator.py now merges issue-based requirements with PR-based requirements, ensuring that instructions provided during the issue phase carry through to the implementation and review phases.
  • Prompt Visibility: Coder and planner prompts for issue-mode have been updated to surface these requirements as high-priority instructions, placed before the raw issue context to ensure maximum visibility.
  • Validation: The same rigorous response validation used for PRs (requiring structured acknowledgement of each requirement) is now applied to issue-mode coder and planner responses.
  • Wording Parameterization: Prompt helpers now support custom requirement_scope and full_omission_fallback strings, allowing for more natural phrasing in issue-mode (e.g., "high-priority planning requirements").

Verification Results

  • Automated Tests: All 358 tests passed, including 15+ new test cases covering:
    • Parsing requirements from issue bodies and comments.
    • Combined requirement sorting (issue + PR).
    • Enforcement of requirements in direct issue implementation and plan-first flows.
    • Handling of requirement truncation and omission fallbacks in issue-mode.

The implementation is clean, robust, and well-tested.

-- Google Gemini

@wwind123 wwind123 merged commit 4f99462 into main May 26, 2026
1 check passed
@wwind123 wwind123 deleted the codex/issue-131-signed-issue-requirements branch May 26, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support signed human requirements in issue and plan-first issue context

1 participant