Skip to content

[Agent] [Ops] Implement formatting settings contract in output writers (#303)#308

Merged
stranske merged 3 commits intomainfrom
codex/issue-303-formatting-contract
Mar 1, 2026
Merged

[Agent] [Ops] Implement formatting settings contract in output writers (#303)#308
stranske merged 3 commits intomainfrom
codex/issue-303-formatting-contract

Conversation

@stranske
Copy link
Copy Markdown
Owner

@stranske stranske commented Mar 1, 2026

Source: Issue #303

Automated Status Summary

Scope

Runner settings currently capture formatting_profile, but output writers do not consistently apply operator-configurable formatting behavior. This blocks a key operator requirement (decimal/currency/accounting controls) for finicky presentation standards.

Tasks

  • Define and document the formatting settings schema (profile + explicit knobs where needed).
  • Parse formatting settings from runner/CLI settings payload into a typed runtime object.
  • Apply formatting rules in primary output writers (at minimum generated workbook writes and static table render outputs).
  • Ensure default behavior preserves template formatting when no override is selected.
  • Add tests that verify currency/decimal/accounting behavior for representative output cells/tables.
  • Update operator documentation with supported formatting options and defaults.

Acceptance criteria

  • Selecting a non-default formatting profile changes output formatting in documented surfaces.
  • Default profile preserves current template-driven formatting behavior.
  • Automated tests verify at least decimal precision, currency symbol handling, and negative/accounting style behavior.
  • Runner/CLI docs describe exactly what formatting settings are honored today.

Head SHA: 2369c02
Latest Runs: ✅ success — Gate
Required: gate: ✅ success

Workflow / Job Result Logs
.github/workflows/autofix.yml ❌ failure View run
Agents PR Event Hub ⏭️ skipped View run
Agents PR Meta ❔ in progress View run
Dependabot Auto-merge ⏭️ skipped View run
Gate ✅ success View run
Health 45 Agents Guard ✅ success View run

Copilot AI review requested due to automatic review settings March 1, 2026 01:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial “formatting profile” contract layer to the Counter Risk codebase by defining a small, typed formatting-policy resolver and validating its behavior with unit tests.

Changes:

  • Introduce counter_risk.formatting with FormattingPolicy, profile normalization, and profile→policy resolution.
  • Add unit tests covering profile normalization and expected Excel number-format strings for supported profiles.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/counter_risk/formatting.py Defines supported formatting profiles and resolves them into a typed FormattingPolicy (Excel number formats or None to preserve template formatting).
tests/test_formatting.py Adds baseline unit tests for normalization and policy resolution outputs.

@agents-workflows-bot
Copy link
Copy Markdown
Contributor

agents-workflows-bot bot commented Mar 1, 2026

🤖 Keepalive Loop Status

PR #308 | Agent: Codex | Iteration 0/5

Current State

Metric Value
Iteration progress [----------] 0/5
Action wait (missing-agent-label)
Disposition skipped (transient)
Gate success
Tasks 0/10 complete
Timeout 45 min (default)
Timeout usage 6m elapsed (14%, 39m remaining)
Keepalive ❌ disabled
Autofix ❌ disabled

🔍 Failure Classification

| Error type | infrastructure |
| Error category | resource |
| Suggested recovery | Confirm the referenced resource exists (repo, PR, branch, workflow, or file). |

@agents-workflows-bot
Copy link
Copy Markdown
Contributor

agents-workflows-bot bot commented Mar 1, 2026

Keepalive Work Log (click to expand)
# Time (UTC) Agent Action Result Files Tasks Progress Commit Gate
0 2026-03-01 01:48:54 Codex wait (missing-agent-label-transient) skipped 0 0/10 cancelled
0 2026-03-01 01:53:49 Codex wait (missing-agent-label-transient) skipped 0 0/10 failure
0 2026-03-01 02:00:32 Codex wait (missing-agent-label-transient) skipped 0 0/10 success
0 2026-03-01 02:01:43 Codex wait (missing-agent-label-transient) skipped 0 0/10
0 2026-03-01 02:07:16 Codex wait (missing-agent-label-transient) skipped 0 0/10 success

@stranske
Copy link
Copy Markdown
Owner Author

stranske commented Mar 1, 2026

Reviewed inline note: this branch now includes runtime wiring (CLI -> pipeline -> historical output writer) for ; scope is no longer helpers-only. No further changes needed for that comment.

@stranske
Copy link
Copy Markdown
Owner Author

stranske commented Mar 1, 2026

Reviewed inline note: this branch includes runtime wiring (CLI -> pipeline -> historical output writer) for formatting_profile; scope is no longer helpers-only. No further code changes were needed for that comment.

@stranske stranske merged commit 391281b into main Mar 1, 2026
276 checks passed
@stranske stranske added the verify:compare Runs verifier comparison mode after merge label Mar 1, 2026
@stranske stranske temporarily deployed to agent-standard March 1, 2026 02:01 — with GitHub Actions Inactive
@stranske stranske temporarily deployed to agent-standard March 1, 2026 02:01 — with GitHub Actions Inactive
@stranske stranske temporarily deployed to agent-standard March 1, 2026 02:01 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 1, 2026

Provider Comparison Report

Provider Summary

Provider Model Verdict Confidence Summary
openai gpt-5.2 CONCERNS 74% Implements a typed formatting profile/policy resolver and threads a formatting_profile from CLI/settings through the pipeline OutputContext to the historical workbook writer, applying Excel number_...
anthropic claude-sonnet-4-5-20250929 PASS 92% The implementation successfully addresses the core acceptance criteria for formatting settings contract. Key achievements: (1) Formatting schema is defined with four profiles (default, currency, ac...
📋 Full Provider Details (click to expand)

openai

  • Model: gpt-5.2
  • Verdict: CONCERNS
  • Confidence: 74%
  • Scores:
    • Correctness: 8.0/10
    • Completeness: 7.0/10
    • Quality: 8.0/10
    • Testing: 8.0/10
    • Risks: 4.0/10
  • Summary: Implements a typed formatting profile/policy resolver and threads a formatting_profile from CLI/settings through the pipeline OutputContext to the historical workbook writer, applying Excel number_format overrides for notional and counterparties cells for currency/accounting/plain profiles while leaving default as template-driven (no override). Adds automated tests covering decimal precision via format strings, currency symbol handling, and accounting-style behavior, plus docs describing honored settings and current scope. However, acceptance criteria implying broader output-writer coverage (e.g., static table renders) is not met in code, and default preservation is not directly asserted in tests. Additional unrelated GUI/chat/logging dependency changes expand risk/scope.
  • Concerns:
    • Acceptance scope called for applying formatting rules in "primary output writers" including "static table render outputs"; this PR wires formatting into the historical workbook append path only (pipeline -> OutputContext -> _merge_historical_workbook). README explicitly states current scope is limited to historical workbook. If there are other table/static outputs expected by the criterion, they are not updated here.
    • Formatting settings schema is implemented only as a profile selector -> resolved policy (FormattingPolicy with two number-format fields). The task list mentions "explicit knobs where needed"; no additional explicit knobs beyond the profile are supported/parsed.
    • Default behavior preservation is implemented by not overriding number_format when policy fields are None, but tests do not explicitly assert that template formatting is preserved under the default profile (they only validate currency/accounting overrides).
    • Non-formatting changes are bundled (GUI runner, chat provider dependency guidance, chat logging modes, new hard dependencies on langchain-openai/langchain-anthropic). This increases change surface area and operational risk relative to the PR’s stated formatting focus (though not necessarily incorrect).

anthropic

  • Model: claude-sonnet-4-5-20250929
  • Verdict: PASS
  • Confidence: 92%
  • Scores:
    • Correctness: 9.0/10
    • Completeness: 9.0/10
    • Quality: 9.0/10
    • Testing: 8.0/10
    • Risks: 8.0/10
  • Summary: The implementation successfully addresses the core acceptance criteria for formatting settings contract. Key achievements: (1) Formatting schema is defined with four profiles (default, currency, accounting, plain) in src/counter_risk/formatting.py with clear resolution logic. (2) Settings are parsed from runner/CLI via --formatting-profile flag and propagated through the pipeline to output writers. (3) Historical workbook writer applies formatting rules to notional and counterparty columns based on selected profile. (4) Default profile preserves template formatting (None values). (5) Comprehensive tests verify currency/accounting/plain formatting behavior in tests/test_formatting.py and tests/pipeline/test_run_pipeline.py. (6) Documentation updated in README.md with supported profiles and scope.

The implementation is well-structured with proper separation of concerns (formatting.py module, OutputContext extension, pipeline threading). Code quality is high with type hints, clear naming, and defensive validation. Testing coverage includes unit tests for formatting resolution and integration tests for workbook cell formatting.

Limitations: Formatting currently only applies to historical workbook append operations, not to all output surfaces mentioned in the original scope (static table renders). The GUI runner addition (while valuable) is tangential to the core formatting requirement and introduces additional complexity. Chat logging changes are well-tested but represent behavioral changes that operators should be aware of.

Overall, the core formatting contract is correctly implemented and tested, meeting the primary acceptance criteria despite some scope limitations.

  • Concerns:
    • Formatting profile application is limited to historical workbook append rows only - other output surfaces mentioned in scope (static table renders) are not yet implemented
    • GUI runner implementation adds significant new surface area with Tkinter dependency that may have platform-specific behavior not fully covered by tests
    • Chat logging mode changes alter default behavior (transcript always on) which could impact existing deployments expecting no logging overhead
    • Missing dependency detection relies on importlib.util.find_spec which may not catch all edge cases in frozen/packaged environments

Agreement

  • Correctness: scores within 1 point (avg 8.5/10, range 8.0-9.0)
  • Quality: scores within 1 point (avg 8.5/10, range 8.0-9.0)
  • Testing: scores within 1 point (avg 8.0/10, range 8.0-8.0)

Disagreement

Dimension openai anthropic
Verdict CONCERNS PASS
Completeness 7.0/10 9.0/10
Risks 4.0/10 8.0/10

Unique Insights

  • openai: Acceptance scope called for applying formatting rules in "primary output writers" including "static table render outputs"; this PR wires formatting into the historical workbook append path only (pipeline -> OutputContext -> _merge_historical_workbook). README explicitly states current scope is limited to historical workbook. If there are other table/static outputs expected by the criterion, they are not updated here.; Formatting settings schema is implemented only as a profile selector -> resolved policy (FormattingPolicy with two number-format fields). The task list mentions "explicit knobs where needed"; no additional explicit knobs beyond the profile are supported/parsed.; Default behavior preservation is implemented by not overriding number_format when policy fields are None, but tests do not explicitly assert that template formatting is preserved under the default profile (they only validate currency/accounting overrides).; Non-formatting changes are bundled (GUI runner, chat provider dependency guidance, chat logging modes, new hard dependencies on langchain-openai/langchain-anthropic). This increases change surface area and operational risk relative to the PR’s stated formatting focus (though not necessarily incorrect).
  • anthropic: Formatting profile application is limited to historical workbook append rows only - other output surfaces mentioned in scope (static table renders) are not yet implemented; GUI runner implementation adds significant new surface area with Tkinter dependency that may have platform-specific behavior not fully covered by tests; Chat logging mode changes alter default behavior (transcript always on) which could impact existing deployments expecting no logging overhead; Missing dependency detection relies on importlib.util.find_spec which may not catch all edge cases in frozen/packaged environments

🔍 LangSmith Traces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

verify:compare Runs verifier comparison mode after merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants