Have you tried asking the construct? It's a rather obvious solution, that is often overlooked in a world full of magic, but skills like Diplomacy & Bluff can work on all creatures, even those immune to mind-affecting effects. A good party face could try to convince a construct by words to tell you about its objectives.
As for the magical means, there are a few spells, that are specifically meant to target constructs, which could be used here:
- Reboot would allow command of a destroyed construct, asking it what its objectives are.
- Control Construct is the same, but works on any construct.
- Apparent Master is an option, if 3.5 edition material is allowed.
Apart from these few options, a Sorcerer with the Impossible bloodline can easily do it with an Enchantment (compulsion) spell of his choice, from Reveal Secrets over Suggestion up to Dominate Monster, …
If said Sorcerer also possessed another bloodline, e.g. Arcane or Astral, it could even ignore a golem's magic immunity by using a supernatural ability like the "Arcane Bond" item or "Peerless Speed" to cast the spell.
For other casters, there might be a good option with shadow spells like Shadow Enchantment, since the mimicked spells do not have the mind-affecting descriptor, but the construct would automatically save on all Will saves, so a spell with "Will: partial" or "save: none" would be a good choice, e.g. False Belief. Keep in mind that Illusion spells aren't automatically mind-affecting, only subschools like Pattern and Phantasm are, so Figments can work: If you suspect the construct attacks butterflies, send in illusionary butterflies.
A counterintelligence option is to use a Parasite Familiar, since it can attach undetected to any host as a supernatural ability, and share the host's senses. Thus, the parasite familiar would be able to "hear" the messages sent by the construct's master.
Other supernatural or extraordinary abilities should work too, if they lack descriptors that the construct is immune to.
There's also plenty of third-party material out there, most prominently the Technomancy sphere from Spheres of Power, or the Clockwork mystery for Oracles.