Skip to content

refactor: remove dead code and redundant patterns#56

Merged
robbycochran merged 4 commits into
mainfrom
clean-up
Jun 10, 2026
Merged

refactor: remove dead code and redundant patterns#56
robbycochran merged 4 commits into
mainfrom
clean-up

Conversation

@robbycochran

Copy link
Copy Markdown
Collaborator

Summary

Cleanup based on multi-perspective workflow findings that scanned the codebase from 5 different angles (dead code, finished TODOs, redundant docs/code/plans) with adversarial verification.

Net result: -152 lines (217 deleted, 65 added)

Changes

Dead Code Removal

  • ✅ Removed Parse(), ParseFile(), BuildSandboxEnv() from internal/profile
    • These functions were never called in production code (only tests)
    • Represents abandoned TOML-based profile configuration approach
  • ✅ Simplified StageHarnessDir() to only create directory (payload rendering moved to agent package)
  • ✅ Updated tests to match streamlined profile package
  • ✅ Added build/runner/openshell and harness-openshell to .gitignore

Code Deduplication

  • ✅ Extracted resolveSandboxImage() helper
    • Eliminates duplicate logic in create.go, up.go, launch.go
    • Consistent precedence: SANDBOX_IMAGE env > agent config > default
  • ✅ Replaced custom providerInList() with slices.Contains from stdlib (Go 1.21+)

Documentation Cleanup

  • ✅ Archived docs/design.mddocs/archive/design-v1-2026-06-08.md
    • 485-line design proposal with outdated naming (harness.toml vs openshell.toml, profiles/*.toml vs agents/*.yaml)
    • Implementation diverged on 2026-06-08; marked as historical reference
    • Added docs/archive/README.md explaining archived content
  • ✅ Updated plans/nemoclaw-arch.md gap analysis
  • ✅ Updated TODO.md to reflect partial completion of profile consolidation

Deleted Scratch Files

  • Removed untracked/gitignored planning artifacts:
    • demo.md (superseded by demo/ directory)
    • fix-startup.md, remainingbanners.md (debugging notes for completed PR fix: add claude wrapper to skip sandbox startup modals #53)
    • dashboard.html, strategy-dashboard.html (planning artifacts)
    • plans/ocp-sandbox.sh, plans/verify-integrations.py (unreferenced scripts)

Testing

  • ✅ All internal/profile tests pass
  • ✅ Code compiles successfully (go build .)
  • ✅ No production functionality changes (pure refactoring)

Next Steps

Remaining work identified in TODO.md:

  • Move ValidateProviders to agent or gateway package
  • Inline Config struct into sandbox.go
  • Remove TOML dependency if no longer needed elsewhere

Generated via multi-agent workflow: 56 agents, 51 findings → 28 confirmed after adversarial verification

Cleanup based on multi-perspective workflow findings:

Dead code removal:
- Removed Parse(), ParseFile(), BuildSandboxEnv() from internal/profile
- Simplified StageHarnessDir to only create directory
- Updated tests to match streamlined profile package
- Updated TODO.md to track remaining consolidation work

Code deduplication:
- Extract resolveSandboxImage() helper (used in create, up, launch)
- Replace providerInList() with slices.Contains from stdlib
- Removed corresponding test for deleted helper

Documentation:
- Archived docs/design.md (outdated naming, superseded by README/SPEC)
- Added docs/archive/README.md explaining archived content
- Updated plans/nemoclaw-arch.md gap analysis (lifecycle commands now implemented)

Build artifacts:
- Add build/runner/openshell and harness-openshell to .gitignore

Net: -152 lines (217 deleted, 65 added)
Fixes identified by multi-perspective fact-checking workflow (213 agents, 78/208 claims inaccurate):

AGENTS.md:
- Line 73: Fix "custom gateway image" → "custom sandbox image" (confuses sandbox vs gateway)
- Line 82: Fix oauth2_refresh_token → oauth2-refresh-token (matches implementation)
- Line 99: Remove non-existent --full flag from --ci equivalence

README.md:
- Line 74: Fix entrypoint example (remove --bare flag, matches actual demo.yaml)

Remaining issues tracked in /tmp/fact-audit-report.md:
- 6 critical (openshell-arch/ already gitignored)
- 47 high-severity (config examples, test comments)
- 23 medium-severity (minor outdated claims)
Additional fixes from fact audit:

README.md:
- Line 12: Add missing 'brew tap nvidia/openshell' prerequisite
- Line 46, 124: Remove --bare flag from examples (not in actual configs)

agents/providers/profiles/atlassian.yaml:
- Line 5: Fix outdated reference to sandbox-ocp.sh (now uses agent.yaml config)

cmd/providers.go:
- Line 286: Fix path sandbox/profiles → agents/providers/profiles

sandbox/policy.yaml:
- Line 87: Update GWS comment (now uses native provider, not uploaded files)

All high/critical severity issues now resolved. Remaining medium/low issues
are accurate or minor inconsistencies not worth changing.
@robbycochran robbycochran merged commit 9513812 into main Jun 10, 2026
6 checks passed
@robbycochran robbycochran deleted the clean-up branch June 13, 2026 14:02
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.

1 participant